Skip to main content

PersistedStore

Trait PersistedStore 

Source
pub trait PersistedStore {
    type Error;

    // Required methods
    fn stored_len(
        &self,
        region: SnapshotRegion,
    ) -> Result<Option<usize>, Self::Error>;
    fn load<'b>(
        &self,
        region: SnapshotRegion,
        buf: &'b mut [u8],
    ) -> Result<Option<&'b [u8]>, Self::Error>;
    fn store(
        &mut self,
        region: SnapshotRegion,
        snapshot: &[u8],
    ) -> Result<(), Self::Error>;
    fn remove(&mut self, region: SnapshotRegion) -> Result<Removal, Self::Error>;
}
Expand description

Where snapshots sleep between boots. The engine’s tables stay the truth: a host flushes sealed snapshots here and reads them back at the next boot to seed the tables.

Required Associated Types§

Required Methods§

Source

fn stored_len( &self, region: SnapshotRegion, ) -> Result<Option<usize>, Self::Error>

Source

fn load<'b>( &self, region: SnapshotRegion, buf: &'b mut [u8], ) -> Result<Option<&'b [u8]>, Self::Error>

A buf shorter than the stored snapshot is the impl’s error, never a silent truncation.

Source

fn store( &mut self, region: SnapshotRegion, snapshot: &[u8], ) -> Result<(), Self::Error>

Source

fn remove(&mut self, region: SnapshotRegion) -> Result<Removal, Self::Error>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§