Skip to main content

SnapshotStorage

Struct SnapshotStorage 

Source
pub struct SnapshotStorage<B, T, C = JsonCodec>
where B: StorageBackend + ?Sized, T: Send + Sync + 'static, C: Codec<T>,
{ /* 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>
where B: StorageBackend + ?Sized, T: Send + Sync + 'static, C: Codec<T>,

Source§

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>

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>

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>

Commit pending writes. Graph calls at wave-close / debounce-fire.
Source§

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>

Lazily enumerate raw (key, bytes) pairs under a literal byte-prefix (DS-14-storage Q5 lock). Read more
Source§

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>
where B: StorageBackend + ?Sized, T: Send + Sync + 'static, C: Codec<T>,

Source§

fn save(&self, snapshot: T) -> Result<(), StorageError>

Buffer a snapshot pending flush. Honors compact_every and debounce_ms semantics per the BaseStorageTier contract.
Source§

fn load(&self) -> Result<Option<T>, StorageError>

Load the most-recently-saved snapshot. Returns Ok(None) if no snapshot has been persisted yet.

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>
where C: Unpin, T: Unpin, B: ?Sized,

§

impl<B, T, C> UnsafeUnpin for SnapshotStorage<B, T, C>
where C: UnsafeUnpin, T: UnsafeUnpin, B: ?Sized,

§

impl<B, T, C = JsonCodec> !UnwindSafe for SnapshotStorage<B, T, C>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.