pub struct BatchedWalWriter { /* private fields */ }Expand description
Batched WAL writer with vectored I/O
Accumulates WAL entries and writes them in batches using writev() for optimal I/O performance.
Implementations§
Source§impl BatchedWalWriter
impl BatchedWalWriter
Sourcepub fn with_config<P: AsRef<Path>>(
path: P,
max_batch_size: usize,
max_batch_bytes: usize,
) -> Result<Self>
pub fn with_config<P: AsRef<Path>>( path: P, max_batch_size: usize, max_batch_bytes: usize, ) -> Result<Self>
Create with custom configuration
§Arguments
path- Path to WAL filemax_batch_size- Maximum entries per batchmax_batch_bytes- Maximum bytes per batch
Sourcepub fn append(&mut self, entry: &TxnWalEntry) -> Result<()>
pub fn append(&mut self, entry: &TxnWalEntry) -> Result<()>
Add entry to pending batch
Entry will be serialized and added to the pending batch. Automatic flush occurs if batch limits are reached.
Sourcepub fn flush(&mut self) -> Result<usize>
pub fn flush(&mut self) -> Result<usize>
Flush pending entries with vectored I/O
Returns the number of entries written.
Sourcepub fn stats(&self) -> BatchedWalStats
pub fn stats(&self) -> BatchedWalStats
Get statistics
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Get pending entry count
Sourcepub fn pending_bytes(&self) -> usize
pub fn pending_bytes(&self) -> usize
Get pending bytes
Trait Implementations§
Source§impl Drop for BatchedWalWriter
impl Drop for BatchedWalWriter
Auto Trait Implementations§
impl Freeze for BatchedWalWriter
impl RefUnwindSafe for BatchedWalWriter
impl Send for BatchedWalWriter
impl Sync for BatchedWalWriter
impl Unpin for BatchedWalWriter
impl UnsafeUnpin for BatchedWalWriter
impl UnwindSafe for BatchedWalWriter
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more