Skip to content

Commit e0ceef3

Browse files
mgoldenbergHywan
authored andcommitted
feat(indexeddb): add top-level type for implementing EventCacheStore
Signed-off-by: Michael Goldenberg <[email protected]>
1 parent 72d1332 commit e0ceef3

File tree

1 file changed

+24
-0
lines changed
  • crates/matrix-sdk-indexeddb/src/event_cache_store

1 file changed

+24
-0
lines changed

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,32 @@
1414

1515
#![allow(unused)]
1616

17+
use indexed_db_futures::IdbDatabase;
18+
use matrix_sdk_base::event_cache::store::MemoryStore;
19+
use web_sys::IdbTransactionMode;
20+
21+
use crate::event_cache_store::serializer::IndexeddbEventCacheStoreSerializer;
22+
1723
mod error;
1824
mod migrations;
1925
mod serializer;
2026
mod transaction;
2127
mod types;
28+
29+
/// A type for providing an IndexedDB implementation of [`EventCacheStore`][1].
30+
/// This is meant to be used as a backend to [`EventCacheStore`][1] in browser
31+
/// contexts.
32+
///
33+
/// [1]: matrix_sdk_base::event_cache::store::EventCacheStore
34+
pub struct IndexeddbEventCacheStore {
35+
// A handle to the IndexedDB database
36+
inner: IdbDatabase,
37+
// A serializer with functionality tailored to `IndexeddbEventCacheStore`
38+
serializer: IndexeddbEventCacheStoreSerializer,
39+
// An in-memory store for providing temporary implementations for
40+
// functions of `EventCacheStore`.
41+
//
42+
// NOTE: This will be removed once we have IndexedDB-backed implementations for all
43+
// functions in `EventCacheStore`.
44+
memory_store: MemoryStore,
45+
}

0 commit comments

Comments
 (0)