pub struct Wal { /* private fields */ }Expand description
Write-Ahead Log
Implementations§
Source§impl Wal
impl Wal
Sourcepub fn create(path: impl AsRef<Path>) -> Result<Self>
pub fn create(path: impl AsRef<Path>) -> Result<Self>
Create or open a WAL file (simple API for backward compatibility)
Sourcepub fn with_config(config: WalConfig) -> Result<Self>
pub fn with_config(config: WalConfig) -> Result<Self>
Create a new WAL with custom configuration
Sourcepub fn current_file_size(&self) -> u64
pub fn current_file_size(&self) -> u64
Get current WAL file size
Sourcepub fn current_file_number(&self) -> u64
pub fn current_file_number(&self) -> u64
Get current WAL file number
Sourcepub fn recover(wal_dir: impl AsRef<Path>) -> Result<(Vec<WalEntry>, u64)>
pub fn recover(wal_dir: impl AsRef<Path>) -> Result<(Vec<WalEntry>, u64)>
Recover all entries from WAL files in a directory
Reads all WAL files in sequence order and returns recovered entries. Handles corrupted and incomplete entries gracefully by skipping them.
Returns (entries, max_sequence) where max_sequence is the highest sequence number found during recovery.
Sourcepub fn replay_to_memtable(
wal_dir: impl AsRef<Path>,
memtable: &Memtable,
) -> Result<u64>
pub fn replay_to_memtable( wal_dir: impl AsRef<Path>, memtable: &Memtable, ) -> Result<u64>
Replay WAL entries to a memtable
Applies all entries from the WAL directory to the provided memtable. This is used during crash recovery to rebuild memtable state.
Returns the maximum sequence number found during replay.
Auto Trait Implementations§
impl Freeze for Wal
impl RefUnwindSafe for Wal
impl Send for Wal
impl Sync for Wal
impl Unpin for Wal
impl UnwindSafe for Wal
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.