indexeddb: Update index data in backend#42416
indexeddb: Update index data in backend#42416arihant2math wants to merge 8 commits intoservo:mainfrom
Conversation
b31613a to
69acff2
Compare
|
🔨 Triggering try run (#21771587035) for Linux (WPT) |
|
Test results for linux-wpt from try job (#21771587035): Flaky unexpected result (37)
Stable unexpected results that are known to be intermittent (35)
|
|
✨ Try run (#21771587035) succeeded. |
|
ETA: It does deserialization on a JS thread |
8f5b11b to
a2b2ead
Compare
|
So I think it's safe to put of that discussion for later. However, I do want to have some testing for this PR, so I'll implement some of the script methods. |
|
🔨 Triggering try run (#21806059338) for Linux (WPT) |
|
|
3d0a23c to
efdda4f
Compare
|
🔨 Triggering try run (#21807087904) for Linux (WPT) |
|
Test results for linux-wpt from try job (#21807087904): Flaky unexpected result (22)
Stable unexpected results that are known to be intermittent (27)
Stable unexpected results (15)
|
|
|
a65eba7 to
9aa66aa
Compare
|
🔨 Triggering try run (#22235890609) for Linux (WPT) |
|
Test results for linux-wpt from try job (#22235890609): Flaky unexpected result (29)
Stable unexpected results that are known to be intermittent (12)
Stable unexpected results (4)
|
|
|
|
🔨 Triggering try run (#22237077389) for Linux (WPT) |
9aa66aa to
e2b1eb4
Compare
|
🔨 Triggering try run (#22238236850) for Linux (WPT) |
|
Test results for linux-wpt from try job (#22237077389): Flaky unexpected result (20)
Stable unexpected results that are known to be intermittent (21)
Stable unexpected results (4)
|
|
|
|
Test results for linux-wpt from try job (#22238236850): Flaky unexpected result (24)
Stable unexpected results that are known to be intermittent (18)
|
|
✨ Try run (#22238236850) succeeded. |
Taym95
left a comment
There was a problem hiding this comment.
can we Rename variables to avoid confusion?
primary_key (IDB key for object_data row)
index_key (single key inserted into index row)
index_key_value / extracted_index_key (outer tuple field)
took me some time to figure it out
| ) -> Result<Option<index_data_model::Model>, Error> { | ||
| let index = Self::get_index(connection, &store, index)?; | ||
| let (sql, values) = if index.unique_index { | ||
| let query = range_to_query(&key_range, unique_index_data_model::Column::ObjectDataKey); |
There was a problem hiding this comment.
using ObjectDataKey correct here? same for index_get_all, index_count?
| index: String, | ||
| key_range: IndexedDBKeyRange, | ||
| ) -> Result<Option<Vec<u8>>, Error> { | ||
| Self::index_get(connection, store, index, key_range).map(|opt| opt.map(|model| model.value)) |
There was a problem hiding this comment.
I think(from the spec) IDBIndex.getKey() should return the primary key?
| key_range: IndexedDBKeyRange, | ||
| ) -> Result<Option<Vec<u8>>, Error> { | ||
| Self::index_get(connection, store, index, key_range) | ||
| .map(|opt| opt.map(|model| model.object_data_key)) |
There was a problem hiding this comment.
is this mapped to IDBIndex.get() ? if so function should return the stored object value
| count: Option<u32>, | ||
| ) -> Result<Vec<Vec<u8>>, Error> { | ||
| Self::index_get_all(connection, store, index, key_range, count) | ||
| .map(|models| models.into_iter().map(|m| m.object_data_key).collect()) |
There was a problem hiding this comment.
getAll should to return object values or primary keys ?
| // Step 5. | ||
| let serialized_index_key: Vec<u8> = postcard::to_stdvec(&key).unwrap(); | ||
| connection.execute( | ||
| "INSERT INTO unique_index_data (index_id, object_data_key, value, object_store_id) VALUES (?, ?, ?, ?)", |
There was a problem hiding this comment.
This does not remove old index rows for this primary key, is this spec compliance?
components/storage/indexeddb/engines/sqlite/index_data_model.rs
Outdated
Show resolved
Hide resolved
Signed-off-by: Ashwin Naren <[email protected]>
Signed-off-by: Ashwin Naren <[email protected]>
Signed-off-by: Ashwin Naren <[email protected]>
Signed-off-by: Ashwin Naren <[email protected]>
Signed-off-by: Ashwin Naren <[email protected]>
Signed-off-by: Ashwin Naren <[email protected]>
Signed-off-by: Ashwin Naren <[email protected]>
e2b1eb4 to
9cd8221
Compare
Yeah, I borrowed those names off of firefox, probably not the best idea in the long run. |
Signed-off-by: Ashwin Naren <[email protected]>
Updates indices in the course of regular object store operations. Also allows for querying of indices.
Followups:
Testing: More WPT tests
Fixes: Partially #38100