pub struct SnapshotStorage<B, T, C = JsonCodec>{ /* private fields */ }Expand description
Snapshot tier — buffers one pending snapshot; flush() encodes via codec
and writes to the backend under key_of(snapshot). Mirrors TS
snapshotStorage(backend, opts).
Trait Implementations§
Source§impl<B, T, C> BaseStorageTier for SnapshotStorage<B, T, C>
impl<B, T, C> BaseStorageTier for SnapshotStorage<B, T, C>
Source§fn name(&self) -> &str
fn name(&self) -> &str
Diagnostic tier name (e.g.
"snapshot:my-graph"). Surfaces in error
messages and Display impls.Source§fn debounce_ms(&self) -> Option<u32>
fn debounce_ms(&self) -> Option<u32>
Debounce window in milliseconds.
None (default) = sync-through.
Graph-layer attach reads this and schedules timed flush() via its
own reactive timer (M4.E); the tier itself does NOT drive a timer.Source§fn compact_every(&self) -> Option<u32>
fn compact_every(&self) -> Option<u32>
Force a flush every Nth accepted write regardless of debounce.
None = no cap; Some(N) triggers flush() on the Nth save (or
append_entries for log tiers).Source§fn flush(&self) -> Result<(), StorageError>
fn flush(&self) -> Result<(), StorageError>
Commit pending writes. Graph calls at wave-close / debounce-fire.
Source§fn rollback(&self) -> Result<(), StorageError>
fn rollback(&self) -> Result<(), StorageError>
Discard pending writes. Graph calls on wave-throw.
Source§fn list_by_prefix_bytes<'a>(
&'a self,
prefix: &str,
) -> Box<dyn Iterator<Item = Result<(String, Vec<u8>), StorageError>> + 'a>
fn list_by_prefix_bytes<'a>( &'a self, prefix: &str, ) -> Box<dyn Iterator<Item = Result<(String, Vec<u8>), StorageError>> + 'a>
Lazily enumerate raw
(key, bytes) pairs under a literal byte-prefix
(DS-14-storage Q5 lock). Read moreSource§fn compact(&self) -> Result<(), StorageError>
fn compact(&self) -> Result<(), StorageError>
Force a
mode:"full" baseline immediately (Q8 lock). Bypasses
compact_every cadence; useful at deploy boundaries, end-of-process
drains, or test fixtures. Default impl is a flush() so tiers that
don’t write baselines can still implement the method trivially.Source§impl<B, T, C> SnapshotStorageTier<T> for SnapshotStorage<B, T, C>
impl<B, T, C> SnapshotStorageTier<T> for SnapshotStorage<B, T, C>
Source§fn save(&self, snapshot: T) -> Result<(), StorageError>
fn save(&self, snapshot: T) -> Result<(), StorageError>
Buffer a snapshot pending flush. Honors
compact_every and
debounce_ms semantics per the BaseStorageTier contract.Auto Trait Implementations§
impl<B, T, C = JsonCodec> !Freeze for SnapshotStorage<B, T, C>
impl<B, T, C = JsonCodec> !RefUnwindSafe for SnapshotStorage<B, T, C>
impl<B, T, C> Send for SnapshotStorage<B, T, C>where
B: ?Sized,
impl<B, T, C> Sync for SnapshotStorage<B, T, C>where
B: ?Sized,
impl<B, T, C> Unpin for SnapshotStorage<B, T, C>
impl<B, T, C> UnsafeUnpin for SnapshotStorage<B, T, C>
impl<B, T, C = JsonCodec> !UnwindSafe for SnapshotStorage<B, T, C>
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
Mutably borrows from an owned value. Read more