pub enum StorageBackend {
Memory,
Sqlite {
path: PathBuf,
encryption_key: Option<Zeroizing<[u8; 32]>>,
},
AsyncBlob {
blob_store: Arc<dyn AsyncBlobStore>,
},
}Expand description
[CR-4] re-export so hosts can build ClientConfig { storage_backend: … } without
pulling ping_mls_store in directly. AsyncBlobStore is the async
single-blob trait WASM hosts implement to back StorageBackend::IndexedDb;
BlobFuture is the matching future-type helper.
Where the persistent provider checkpoints MemoryStorage to. Selected at
MessagingClient::init time via [ping_core::ClientConfig::storage_backend].
Variants§
Memory
In-memory only. Default and what tests use; loses state on process exit.
Cold-start scenarios (iOS NSE, web Service Worker) MUST use Self::Sqlite
or [Self::IndexedDb] instead.
Sqlite
SQLite-backed; native targets only. The SDK owns the file at path; the
parent directory must exist. Pass encryption_key = Some(...) to enable
SQLCipher; absence means the file is unencrypted (tests, dev only).
Fields
AsyncBlob
Host-supplied async blob storage. Available on every target.
The provider snapshots the entire MemoryStorage HashMap into a
single CBOR blob and round-trips it through the
AsyncBlobStore the host implements. This is the universal
persistence path:
- WASM: host wraps its IndexedDB layer (PingStorageWeb, which already AES-GCM-encrypts every row under a non-extractable wrap key kept inside the same IDB).
- iOS / macOS / Android: host wraps the same
Storagetrait it already provides for conv metadata + cursors (typically Keychain-encrypted SQLite or AsyncStorage), so the OpenMLS snapshot sits under a reserved("__mls", "snapshot")slot alongside the host’s other persisted KV.
Why this replaces the wasm-only IndexedDb variant: any host
that already implements Storage (which every binding does)
gets persistence for free, without per-platform path management,
Keychain key plumbing, or SQLCipher dependency. The SQLite
backend remains available for hosts that want a separate file
(e.g. iOS NSE cold-start where the main app’s Storage isn’t
reachable from the extension).
Fields
blob_store: Arc<dyn AsyncBlobStore>Trait Implementations§
Source§impl Clone for StorageBackend
impl Clone for StorageBackend
Source§fn clone(&self) -> StorageBackend
fn clone(&self) -> StorageBackend
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for StorageBackend
impl Debug for StorageBackend
Source§impl Default for StorageBackend
impl Default for StorageBackend
Source§fn default() -> StorageBackend
fn default() -> StorageBackend
Auto Trait Implementations§
impl !RefUnwindSafe for StorageBackend
impl !UnwindSafe for StorageBackend
impl Freeze for StorageBackend
impl Send for StorageBackend
impl Sync for StorageBackend
impl Unpin for StorageBackend
impl UnsafeUnpin for StorageBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more