pub struct Wal { /* private fields */ }Expand description
Append-only write-ahead log.
Implementations§
Source§impl Wal
impl Wal
Sourcepub fn open(dir_path: &Path) -> MenteResult<Self>
pub fn open(dir_path: &Path) -> MenteResult<Self>
Open or create a WAL file at dir_path/wal.log.
Sourcepub fn append(
&mut self,
entry_type: WalEntryType,
page_id: u64,
data: &[u8],
) -> MenteResult<Lsn>
pub fn append( &mut self, entry_type: WalEntryType, page_id: u64, data: &[u8], ) -> MenteResult<Lsn>
Append an entry to the WAL and return its LSN.
Sourcepub fn sync(&mut self) -> MenteResult<()>
pub fn sync(&mut self) -> MenteResult<()>
Flush the WAL to durable storage (fdatasync).
Sourcepub fn iterate(&mut self) -> MenteResult<Vec<WalEntry>>
pub fn iterate(&mut self) -> MenteResult<Vec<WalEntry>>
Read all valid entries from the WAL for recovery.
Sourcepub fn truncate(&mut self, before_lsn: Lsn) -> MenteResult<()>
pub fn truncate(&mut self, before_lsn: Lsn) -> MenteResult<()>
Truncate all entries with LSN less than before_lsn.
Auto Trait Implementations§
impl Freeze for Wal
impl RefUnwindSafe for Wal
impl Send for Wal
impl Sync for Wal
impl Unpin for Wal
impl UnsafeUnpin for Wal
impl UnwindSafe for Wal
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
Mutably borrows from an owned value. Read more