Skip to main content

WalWriter

Struct WalWriter 

Source
pub struct WalWriter { /* private fields */ }
Expand description

WAL Writer

Implementations§

Source§

impl WalWriter

Source

pub fn new<P: AsRef<Path>>(path: P, fsync_policy: FsyncPolicy) -> Result<Self>

Create a new WAL writer

Source

pub fn write(&mut self, entry: &WalEntry) -> Result<()>

Write an entry to the WAL

Source

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.

Source

pub fn flush(&mut self) -> Result<()>

Manually flush the WAL to disk

Source

pub fn truncate(&mut self) -> Result<()>

Truncate the WAL (clear all entries)

Source

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.

Source

pub fn fsync_policy(&self) -> FsyncPolicy

Get the current fsync policy

Source

pub fn bytes_since_fsync(&self) -> usize

Get bytes written since last fsync

Source

pub fn time_since_fsync(&self) -> Duration

Get time since last fsync

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.