Skip to content

Commit 8528522

Browse files
committed
Tried to implement insert gap, but missing encode_value on serializer
1 parent d3b6f87 commit 8528522

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

crates/matrix-sdk-indexeddb/src/event_cache_store/idb_operations.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,12 @@ pub async fn insert_chunk(
6262

6363
Ok(())
6464
}
65+
66+
pub async fn insert_gap(
67+
_store: &IdbObjectStore<'_>,
68+
_hashed_room_id: &String,
69+
_new: u64,
70+
_prev_token: Option<u64>,
71+
) -> Result<(), web_sys::DomException> {
72+
Ok(())
73+
}

crates/matrix-sdk-indexeddb/src/event_cache_store/mod.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ impl_event_cache_store!({
151151
.await?;
152152
}
153153
Update::NewGapChunk { previous, new, next, gap } => {
154+
let serialized = serde_json::to_vec(&gap.prev_token)?;
155+
let prev_token = self.serializer.encode_value(serialized)?;
156+
154157
let previous = previous.as_ref().map(ChunkIdentifier::index);
155158
let new = new.index();
156159
let next = next.as_ref().map(ChunkIdentifier::index);
@@ -166,6 +169,9 @@ impl_event_cache_store!({
166169
CHUNK_TYPE_GAP_TYPE_STRING,
167170
)
168171
.await?;
172+
173+
idb_operations::insert_gap(&object_store, &hashed_room_id, new, prev_token)
174+
.await?
169175
}
170176
Update::RemoveChunk(_chunk_identifier) => todo!(),
171177
Update::PushItems { at: _, items: _ } => todo!(),

0 commit comments

Comments
 (0)