mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-09 16:34:32 -04:00
refactor(indexeddb): track corresponding object store for type in Indexed trait
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
This commit is contained in:
committed by
Ivan Enderlin
parent
60af16ada8
commit
c6ce9c560b
@@ -24,6 +24,9 @@ use crate::serializer::IndexeddbSerializer;
|
||||
/// decryption, in the case the high-level type must be encrypted before
|
||||
/// storage.
|
||||
pub trait Indexed: Sized {
|
||||
/// The name of the object store in IndexedDB.
|
||||
const OBJECT_STORE: &'static str;
|
||||
|
||||
/// The indexed type that is used for storage in IndexedDB.
|
||||
type IndexedType;
|
||||
/// The error type that is returned when conversion fails.
|
||||
|
||||
@@ -144,6 +144,8 @@ pub struct IndexedChunk {
|
||||
}
|
||||
|
||||
impl Indexed for Chunk {
|
||||
const OBJECT_STORE: &'static str = keys::LINKED_CHUNKS;
|
||||
|
||||
type IndexedType = IndexedChunk;
|
||||
type Error = CryptoStoreError;
|
||||
|
||||
@@ -300,6 +302,8 @@ pub enum IndexedEventError {
|
||||
}
|
||||
|
||||
impl Indexed for Event {
|
||||
const OBJECT_STORE: &'static str = keys::EVENTS;
|
||||
|
||||
type IndexedType = IndexedEvent;
|
||||
type Error = IndexedEventError;
|
||||
|
||||
@@ -460,6 +464,8 @@ pub struct IndexedGap {
|
||||
}
|
||||
|
||||
impl Indexed for Gap {
|
||||
const OBJECT_STORE: &'static str = keys::GAPS;
|
||||
|
||||
type IndexedType = IndexedGap;
|
||||
type Error = CryptoStoreError;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user