pub struct WalStorage<S> { /* private fields */ }Expand description
WAL-wrapped storage that logs all mutations
Implementations§
Source§impl<S> WalStorage<S>
impl<S> WalStorage<S>
Sourcepub fn with_snapshots(self, snapshot_config: SnapshotConfig) -> Result<Self>
pub fn with_snapshots(self, snapshot_config: SnapshotConfig) -> Result<Self>
Enable snapshot-backed checkpointing. With snapshots, snapshot_and_checkpoint
can persist inner state and truncate the log to bound its growth; without them
the log is retained in full so a volatile inner can always be replayed (DAK-7428).
Sourcepub fn wal(&self) -> &WriteAheadLog
pub fn wal(&self) -> &WriteAheadLog
Get WAL reference
Sourcepub fn checkpoint(&self) -> Result<u64>
pub fn checkpoint(&self) -> Result<u64>
Checkpoint the WAL
Source§impl<S: VectorStorage> WalStorage<S>
impl<S: VectorStorage> WalStorage<S>
Sourcepub async fn recover_into_inner(&self) -> Result<usize>
pub async fn recover_into_inner(&self) -> Result<usize>
Replay the WAL into the inner storage at startup so a volatile inner
(e.g. InMemoryStorage) is fully reconstructed after a crash (DAK-7428).
Applies every logged mutation not superseded by a checkpoint, in LSN
order; returns the number of entries applied.
Sourcepub async fn snapshot_and_checkpoint(&self) -> Result<Option<u64>>
pub async fn snapshot_and_checkpoint(&self) -> Result<Option<u64>>
Persist inner state to a durable snapshot, checkpoint the WAL, and truncate the
now-snapshotted prefix — bounding log growth. The write gate is held exclusively
so no mutation is in flight: the snapshot therefore reflects every write up to
current_lsn, making the subsequent truncate crash-safe. A crash at any point
still recovers (snapshot + idempotent replay of the retained tail). Returns
Ok(None) when snapshots are not enabled.