Expand description
Page primitives: the fixed page size, the strongly-typed page id, and the owned page buffer.
All multi-byte integers in the on-disk page format are little-endian;
this module is the single place that knows that fact for the M2
pager. Encoders and decoders for individual page bodies live next
to their owners (header in super::header, freelist in
super::freelist).
Structs§
- Page
- An owned, page-sized buffer. Lives in the cache’s
Vec<Frame>and is reused across loads — the pager never allocates a newPageon the read hot path (Rule 3). - PageId
- Identifier of a page in a database file.
Constants§
- ENCRYPTION_
OVERHEAD - Phase 4 (issue #9): per-page on-disk overhead added by the
encryption layer (24-byte XChaCha20-Poly1305 nonce + 16-byte
Poly1305 tag = 40 bytes). Defined as a public constant in
pager::pageso callers that don’t link theencryptionCargo feature can still reason about the encrypted physical stride (e.g. recovery tools that need to compute file offsets without invoking any crypto). Kept in lock-step withcrypto::ENCRYPTION_OVERHEAD(24-byte nonce + 16-byte tag). - PAGE_
SIZE - Page size in bytes. Fixed at 4 KiB for format version 0 (see
docs/format.md). Parameterising this is deferred to a future milestone; the header reserves the byte for it. - PAGE_
TRAILER_ SIZE - Number of bytes a CRC32C page trailer occupies. The trailer is
written by
super::Pager::write_pagein milestone M3 issue #6; at issue #5 the trailing four bytes are reserved.
Functions§
- physical_
offset_ for - Phase 4 (issue #9): byte offset of page
raw_id’s on-disk slot for a file with the givenfeature_flags. - physical_
page_ stride - Phase 4 (issue #9): physical-stride helper. Returns the on-disk
size of a single non-header page given the file’s
feature_flagsbit-set: