pub struct WriteAheadLog { /* private fields */ }Expand description
Write-Ahead Log for durability and crash recovery
Implementations§
Source§impl WriteAheadLog
impl WriteAheadLog
Sourcepub fn sync(&self) -> Result<()>
pub fn sync(&self) -> Result<()>
Flush the BufWriter and fsync the current WAL file to disk.
Called by the background interval-based fsync task. Acquires the write
lock, flushes buffered data, then issues sync_all() to ensure the
OS has persisted the data to durable storage.
Sourcepub fn fsync_interval_ms(&self) -> Option<u64>
pub fn fsync_interval_ms(&self) -> Option<u64>
Get the configured fsync interval (if any).
Sourcepub fn current_sequence(&self) -> u64
pub fn current_sequence(&self) -> u64
Get current sequence number
Sourcepub fn oldest_sequence(&self) -> Option<u64>
pub fn oldest_sequence(&self) -> Option<u64>
Get the oldest available WAL sequence number.
Returns the first sequence found in the oldest WAL file, or None
if no WAL entries exist. Used by the replication catch-up protocol
to determine whether a follower can catch up from WAL alone.
Sourcepub fn set_replication_tx(&self, tx: Sender<WALEntry>)
pub fn set_replication_tx(&self, tx: Sender<WALEntry>)
Attach a broadcast sender for WAL replication.
When set, every append() call will publish the WAL entry to this
channel so the WAL shipper can stream it to connected followers.