Skip to content

Commit 2689e2d

Browse files
mgoldenbergHywan
authored andcommitted
refactor(indexeddb): add trait for constructing key bounds for indexed types in event cache store
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
1 parent 2cfba4c commit 2689e2d

File tree

1 file changed

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

1 file changed

+11
-0
lines changed

crates/matrix-sdk-indexeddb/src/event_cache_store/serializer/traits.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,14 @@ pub trait IndexedKey<T: Indexed> {
6363
serializer: &IndexeddbSerializer,
6464
) -> Self;
6565
}
66+
67+
/// A trait for constructing the bounds of an [`IndexedKey`].
68+
///
69+
/// This is useful when constructing range queries in IndexedDB.
70+
pub trait IndexedKeyBounds<T: Indexed>: IndexedKey<T> {
71+
/// Encodes the lower bound of the key.
72+
fn encode_lower(room_id: &RoomId, serializer: &IndexeddbSerializer) -> Self;
73+
74+
/// Encodes the upper bound of the key.
75+
fn encode_upper(room_id: &RoomId, serializer: &IndexeddbSerializer) -> Self;
76+
}

0 commit comments

Comments
 (0)