pub struct HeaderSnapshot {
pub root_catalog: u64,
pub freelist_head: u64,
pub page_count: u64,
pub view: HashMap<PageId, Arc<Page>>,
}Expand description
Snapshot of the page-0 header fields that the M5 catalog + freelist code mutates directly (not through the WAL).
Returned by Pager::header_snapshot at txn-begin; passed back
to Pager::restore_header_snapshot on rollback so the on-disk
header is rewound alongside the WAL pending buffer. M5 wrote
these fields direct-to-disk for performance; the M6 transaction
layer compensates by snapshotting them whenever a WriteTxn
might roll back.
Fields§
§root_catalog: u64Catalog B-tree root page id captured at snapshot time.
freelist_head: u64Freelist head page id captured at snapshot time.
page_count: u64File page count captured at snapshot time. Used so an alloc-then-rollback does not leak the appended page.
view: HashMap<PageId, Arc<Page>>WAL “committed view” snapshot. See
Pager::header_snapshot for the rationale — free_page
removes per-page entries from the live view, and the
rollback path needs to put them back.
#80: pages are held behind Arc so cloning this map (in the
rollback snapshot path) is a set of refcount bumps rather than
per-page 4 KiB memcpys, matching the live committed view.
Trait Implementations§
Source§impl Clone for HeaderSnapshot
impl Clone for HeaderSnapshot
Source§fn clone(&self) -> HeaderSnapshot
fn clone(&self) -> HeaderSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more