pub struct WalManager { /* private fields */ }Expand description
Implementations§
Source§impl WalManager
impl WalManager
Sourcepub fn open<P: AsRef<Path>>(path: P, fsync_policy: FsyncPolicy) -> Result<Self>
pub fn open<P: AsRef<Path>>(path: P, fsync_policy: FsyncPolicy) -> Result<Self>
Open or create a WAL at path.
Creates any missing parent directories. The WAL file is opened for append-only writes; an existing file is not truncated.
Sourcepub fn write_buffered(&mut self, entry: &WalEntry) -> Result<()>
pub fn write_buffered(&mut self, entry: &WalEntry) -> Result<()>
Append an entry WITHOUT fsyncing (#170 group commit) — durability deferred
to a later flush. Only for writes gated on a later durable
marker (MVCC-Tier-1 staged rows). See WalWriter::write_buffered.
Sourcepub fn replay<F>(&mut self, callback: F) -> Result<Vec<WalEntry>>
pub fn replay<F>(&mut self, callback: F) -> Result<Vec<WalEntry>>
Replay every entry from the WAL in file order, passing each to
callback.
The replay is schema-blind: entries are returned as WalEntry
values carrying opaque Raw payloads. No decode step is applied.
Stops at the first corrupt or incomplete entry (torn tail) and returns
the entries recovered up to that point.
Sourcepub fn truncate_to(&mut self, offset: u64) -> Result<()>
pub fn truncate_to(&mut self, offset: u64) -> Result<()>
Truncate the WAL to a specific byte offset, dropping every byte after it
(MVCC Tier 1 transaction rollback).
Unlike truncate (which clears the whole log), this rolls the file back
to a previously-recorded size mark, so a committed WAL prefix survives
and only the aborted transaction’s staged records are discarded.
A no-op if offset is already >= the current length.
Sourcepub fn rotate(&mut self) -> Result<PathBuf>
pub fn rotate(&mut self) -> Result<PathBuf>
Rotate the WAL: archive the current file under a timestamped name and start a fresh, empty WAL at the original path.
Returns the path of the archived WAL file.