pub struct WalManager { /* private fields */ }Expand description
WAL Manager
Manages write-ahead log for durability.
Implementations§
Source§impl WalManager
impl WalManager
Sourcepub fn open(path: impl AsRef<Path>) -> KernelResult<Self>
pub fn open(path: impl AsRef<Path>) -> KernelResult<Self>
Open or create a WAL file
Sourcepub fn append(&self, record: &mut WalRecord) -> KernelResult<LogSequenceNumber>
pub fn append(&self, record: &mut WalRecord) -> KernelResult<LogSequenceNumber>
Append a record to the WAL
Returns the LSN of the appended record.
Sourcepub fn flush(&self) -> KernelResult<()>
pub fn flush(&self) -> KernelResult<()>
Flush buffered writes to disk
Sourcepub fn sync(&self) -> KernelResult<LogSequenceNumber>
pub fn sync(&self) -> KernelResult<LogSequenceNumber>
Sync WAL to durable storage (fsync)
Sourcepub fn durable_lsn(&self) -> LogSequenceNumber
pub fn durable_lsn(&self) -> LogSequenceNumber
Get the current durable LSN
Sourcepub fn next_lsn(&self) -> LogSequenceNumber
pub fn next_lsn(&self) -> LogSequenceNumber
Get the next LSN that will be allocated
Sourcepub fn log_begin(
&self,
txn_id: TransactionId,
) -> KernelResult<LogSequenceNumber>
pub fn log_begin( &self, txn_id: TransactionId, ) -> KernelResult<LogSequenceNumber>
Log a transaction begin
Sourcepub fn log_commit(
&self,
txn_id: TransactionId,
) -> KernelResult<LogSequenceNumber>
pub fn log_commit( &self, txn_id: TransactionId, ) -> KernelResult<LogSequenceNumber>
Log a transaction commit
Sourcepub fn log_abort(
&self,
txn_id: TransactionId,
) -> KernelResult<LogSequenceNumber>
pub fn log_abort( &self, txn_id: TransactionId, ) -> KernelResult<LogSequenceNumber>
Log a transaction abort
Sourcepub fn log_update(
&self,
txn_id: TransactionId,
page_id: PageId,
redo_data: Bytes,
undo_data: Bytes,
) -> KernelResult<LogSequenceNumber>
pub fn log_update( &self, txn_id: TransactionId, page_id: PageId, redo_data: Bytes, undo_data: Bytes, ) -> KernelResult<LogSequenceNumber>
Log an update operation
Sourcepub fn log_checkpoint_begin(&self) -> KernelResult<LogSequenceNumber>
pub fn log_checkpoint_begin(&self) -> KernelResult<LogSequenceNumber>
Log a checkpoint begin
Sourcepub fn log_checkpoint_end(
&self,
active_txns: &[TransactionId],
) -> KernelResult<LogSequenceNumber>
pub fn log_checkpoint_end( &self, active_txns: &[TransactionId], ) -> KernelResult<LogSequenceNumber>
Log a checkpoint end with active transactions
Sourcepub fn checkpoint_lsn(&self) -> Option<LogSequenceNumber>
pub fn checkpoint_lsn(&self) -> Option<LogSequenceNumber>
Get last checkpoint LSN
Sourcepub fn read_from(
&self,
start_lsn: LogSequenceNumber,
) -> KernelResult<Vec<WalRecord>>
pub fn read_from( &self, start_lsn: LogSequenceNumber, ) -> KernelResult<Vec<WalRecord>>
Read all records from a given LSN
Sourcepub fn truncate_before(&self, _lsn: LogSequenceNumber) -> KernelResult<()>
pub fn truncate_before(&self, _lsn: LogSequenceNumber) -> KernelResult<()>
Truncate WAL up to a given LSN (for space reclamation after checkpoint)
Auto Trait Implementations§
impl !Freeze for WalManager
impl !RefUnwindSafe for WalManager
impl Send for WalManager
impl Sync for WalManager
impl Unpin for WalManager
impl UnsafeUnpin for WalManager
impl UnwindSafe for WalManager
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
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