pub struct PageRef<'a> { /* private fields */ }Implementations§
Source§impl<'a> PageRef<'a>
impl<'a> PageRef<'a>
Sourcepub fn open(b: &'a [u8], want: u32) -> Result<Self>
pub fn open(b: &'a [u8], want: u32) -> Result<Self>
Verify and open. want is the page number the caller asked the pool for.
Verify and open a page just off the medium (checksum included). Call
exactly where a page arrives from disk: BufferPool::load, and the raw
buffers recover.rs reads itself.
Sourcepub fn open_resident(b: &'a [u8], want: u32) -> Result<Self>
pub fn open_resident(b: &'a [u8], want: u32) -> Result<Self>
Open a resident pool page: every structural check, no CRC – the pool verified it at load and nothing has been believed off the medium since. NOT a Law 5 relaxation: the law binds the medium boundary. Bounds checks stay per-pin (cheap, and they stop wild reads).
Sourcepub fn open_resident_validated(b: &'a [u8], want: u32) -> Result<Self>
pub fn open_resident_validated(b: &'a [u8], want: u32) -> Result<Self>
Open a page whose slot directory was ALREADY validated once during
this residency (the pool’s per-frame validated bit). Skips the
O(entries) slot-bounds loop; keeps the constant-time identity checks
(magic, version, page_no, kind) because they also guard against a
caller-side page-number mixup, not just against disk damage. The
authoritative validation boundary is load (D8): content can only
have changed since via our own PageMut writes, which maintain the
slot invariants by construction.
pub fn kind(&self) -> PageKind
pub fn tree_id(&self) -> u16
pub fn nentries(&self) -> usize
pub fn page_no(&self) -> u32
pub fn next_leaf(&self) -> u32
pub fn lsn(&self) -> u64
Sourcepub fn free_space(&self) -> usize
pub fn free_space(&self) -> usize
The real free-space figure — identical to PageMut::free_space —
available without taking a write pin. A caller that instead sums
live entry lengths gets a number that silently diverges from this
one the moment anything on the page was ever deleted, because a
deletion reclaims only its slot-directory entry until compact runs.
Sourcepub fn slot_bounds(&self, i: usize) -> (u16, u16)
pub fn slot_bounds(&self, i: usize) -> (u16, u16)
Entry i’s slot-directory pair, verbatim: (offset, length) into this
page image. slot() is these two numbers already applied; a caller
that wants to REMEMBER where a record lives – rather than copy it out
– needs the numbers themselves. Valid for the same reason slot is:
open/open_resident bounds-checked every pair before handing the
page over.