Skip to main content

WalAdmin

Trait WalAdmin 

Source
pub trait WalAdmin:
    Send
    + Sync
    + 'static {
    // Required methods
    fn checkpoint(&self, path: &Path) -> Result<SnapshotMeta>;
    fn wal_status(&self) -> Result<WalStatus>;
    fn wal_truncate(&self, fence_lsn: u64) -> Result<()>;
}
Expand description

Storage-agnostic admin surface for the WAL.

Database<InMemoryGraph> picks up the blanket impl below when a WAL is attached. Transports (e.g. lora-server) type-erase on Arc<dyn WalAdmin> so they don’t need to name the backend type parameter.

All LSNs cross the trait boundary as raw u64 so callers don’t need a dependency on lora-wal.

Required Methods§

Source

fn checkpoint(&self, path: &Path) -> Result<SnapshotMeta>

Take a checkpoint at path. The snapshot’s header is stamped with the WAL’s durable_lsn; older sealed segments are then dropped.

Source

fn wal_status(&self) -> Result<WalStatus>

Snapshot of the WAL’s current state — durable / next LSN, active / oldest segment id. Cheap; a single WAL mutex acquisition.

Source

fn wal_truncate(&self, fence_lsn: u64) -> Result<()>

Drop sealed segments at or below fence_lsn. Idempotent.

Implementors§