pub struct WalTxn<'a, F: FileBackend = FileHandle> { /* private fields */ }Expand description
An in-progress WAL transaction.
Buffers (page_id, page_body) pairs in memory; the actual disk
writes happen at WalTxn::commit. This is how group commit
works: many calls to WalTxn::append amortise one sync_data.
Implementations§
Source§impl<F: FileBackend> WalTxn<'_, F>
impl<F: FileBackend> WalTxn<'_, F>
Sourcepub fn append(&mut self, page_id: PageId, page: &Page) -> Result<()>
pub fn append(&mut self, page_id: PageId, page: &Page) -> Result<()>
Append (page_id, page) to the transaction. The frame is held
in memory until WalTxn::commit.
§Errors
Returns Error::InvalidArgument if the resulting WAL size
would exceed Config::wal_size_limit.
Sourcepub fn append_header(&mut self, page: &Page) -> Result<()>
pub fn append_header(&mut self, page: &Page) -> Result<()>
M6 #51: append a file-header (page-0) frame to the
transaction. The WAL frame carries page_id = 0; recovery’s
WalkState::absorb routes it into a dedicated header slot.
Used by crate::pager::Pager::commit when
crate::pager::Pager::set_root_catalog dirtied the
in-memory header.
§Errors
As Self::append.
Sourcepub fn staged_frame_count(&self) -> usize
pub fn staged_frame_count(&self) -> usize
Number of frames currently staged in this transaction.
Sourcepub fn drain_staged(self) -> Vec<(PageId, Page)>
pub fn drain_staged(self) -> Vec<(PageId, Page)>
Drain the staged frames into an owned Vec so the pager can
merge them into its in-memory view after a successful commit.
Called by WalTxn::commit_returning_view (see
pager::commit).