Skip to main content

PageRef

Struct PageRef 

Source
pub struct PageRef<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> PageRef<'a>

Source

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.

Source

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).

Source

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.

Source

pub fn kind(&self) -> PageKind

Source

pub fn tree_id(&self) -> u16

Source

pub fn nentries(&self) -> usize

Source

pub fn page_no(&self) -> u32

Source

pub fn next_leaf(&self) -> u32

Source

pub fn child0(&self) -> u32

Same field, named for its meaning on an interior page.

Source

pub fn lsn(&self) -> u64

Source

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.

Source

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.

Source

pub fn slot(&self, i: usize) -> &'a [u8] ⓘ

Trait Implementations§

Source§

impl<'a> Debug for PageRef<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PageRef<'a>

§

impl<'a> RefUnwindSafe for PageRef<'a>

§

impl<'a> Send for PageRef<'a>

§

impl<'a> Sync for PageRef<'a>

§

impl<'a> Unpin for PageRef<'a>

§

impl<'a> UnsafeUnpin for PageRef<'a>

§

impl<'a> UnwindSafe for PageRef<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.