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.
Auto Trait Implementations§
impl !Freeze for WriteAheadLog
impl !RefUnwindSafe for WriteAheadLog
impl Send for WriteAheadLog
impl Sync for WriteAheadLog
impl Unpin for WriteAheadLog
impl UnsafeUnpin for WriteAheadLog
impl !UnwindSafe for WriteAheadLog
Blanket Implementations§
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
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>
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>
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