Skip to main content

SnapshotStore

Trait SnapshotStore 

Source
pub trait SnapshotStore: Send + Sync {
    // Required methods
    fn load(&self) -> Result<(VolumeIndex, u64, i64)>;
    fn file_bytes(&self) -> u64;
    fn save_atomic(
        &self,
        idx: &VolumeIndex,
        journal_id: u64,
        next_usn: i64,
    ) -> Result<()>;
    fn remove(&self);
}
Expand description

Snapshot persistence for one volume ({index_dir}\{letter}.fmfidx).

Required Methods§

Source

fn load(&self) -> Result<(VolumeIndex, u64, i64)>

Load the persisted snapshot: the rebuilt index plus the journal checkpoint (journal_id, next_usn) it was saved with. ErrorKind::NotFound means “first run” (not a failure); any other error means a corrupt/unreadable file — the caller counts it in snapshot_load_failures and falls back to a full scan.

Source

fn file_bytes(&self) -> u64

Size of the persisted snapshot in bytes (observability only — the restore ScanTrace). Best effort; 0 when unknown.

Source

fn save_atomic( &self, idx: &VolumeIndex, journal_id: u64, next_usn: i64, ) -> Result<()>

Persist the index with its checkpoint atomically (tmp + rename): a torn write must never become a loadable snapshot.

Source

fn remove(&self)

Best-effort removal (journal-gone: a snapshot pinned to the dead journal id must not be restored on the next start). Failures are intentionally ignored — checkpoint validation on load rejects a stale file anyway.

Implementors§