pub struct WalWriter { /* private fields */ }Expand description
WAL Writer
Implementations§
Source§impl WalWriter
impl WalWriter
Sourcepub fn new<P: AsRef<Path>>(path: P, fsync_policy: FsyncPolicy) -> Result<Self>
pub fn new<P: AsRef<Path>>(path: P, fsync_policy: FsyncPolicy) -> Result<Self>
Create a new WAL writer
Sourcepub fn write_buffered(&mut self, entry: &WalEntry) -> Result<()>
pub fn write_buffered(&mut self, entry: &WalEntry) -> Result<()>
Append an entry WITHOUT fsyncing, regardless of the fsync policy (#170
group commit). Durability is deferred to an explicit flush
at the batch/transaction commit boundary — so a batch of N appends pays one
barrier instead of N. Safe only for writes whose visibility is gated on a
later durable marker (e.g. MVCC-Tier-1 staged rows, which crash-recovery
drops unless the transaction journal committed): a crash before the flush
loses these appends, which is exactly correct for not-yet-committed data.
Sourcepub fn truncate_to(&mut self, offset: u64) -> Result<()>
pub fn truncate_to(&mut self, offset: u64) -> Result<()>
Truncate the WAL to offset bytes, dropping any tail past it (MVCC Tier 1
transaction rollback). A no-op if offset is already at or past the
current length. The file is opened in append mode, so no cursor reset is
needed — the next write still appends at the (new, shorter) end.
Sourcepub fn fsync_policy(&self) -> FsyncPolicy
pub fn fsync_policy(&self) -> FsyncPolicy
Get the current fsync policy
Sourcepub fn bytes_since_fsync(&self) -> usize
pub fn bytes_since_fsync(&self) -> usize
Get bytes written since last fsync
Sourcepub fn time_since_fsync(&self) -> Duration
pub fn time_since_fsync(&self) -> Duration
Get time since last fsync