pub struct InteriorPage { /* private fields */ }Expand description
An interior B-Tree page. Owns a heap-allocated 4089-byte payload buffer.
Implementations§
Source§impl InteriorPage
impl InteriorPage
Sourcepub fn empty(rightmost_child: u32) -> Self
pub fn empty(rightmost_child: u32) -> Self
Creates an empty interior page with the given rightmost-child pointer. Every interior page must have a valid rightmost-child — even if no dividers are present, the rightmost pointer serves as the catch-all route for all rowids.
pub fn from_bytes(bytes: &[u8; 4089]) -> Self
pub fn as_bytes(&self) -> &[u8; 4089]
pub fn slot_count(&self) -> usize
pub fn cells_top(&self) -> usize
pub fn rightmost_child(&self) -> u32
pub fn set_rightmost_child(&mut self, page: u32)
pub fn free_space(&self) -> usize
pub fn would_fit(&self, cell_encoded_size: usize) -> bool
Sourcepub fn divider_at(&self, slot: usize) -> Result<i64>
pub fn divider_at(&self, slot: usize) -> Result<i64>
Divider rowid of the cell at slot, without full decode.
pub fn cell_at(&self, slot: usize) -> Result<InteriorCell>
Sourcepub fn insert_divider(
&mut self,
divider_rowid: i64,
child_page: u32,
) -> Result<()>
pub fn insert_divider( &mut self, divider_rowid: i64, child_page: u32, ) -> Result<()>
Inserts a divider in ascending divider_rowid order. Returns an
error if the new divider duplicates an existing one — the bulk-build
code that populates interior pages always passes strictly increasing
dividers, so a duplicate means a programmer-level bug.
Sourcepub fn child_for(&self, rowid: i64) -> Result<u32>
pub fn child_for(&self, rowid: i64) -> Result<u32>
Returns the child page that rowid routes to: the first divider
with rowid <= divider owns the subtree; if rowid is larger than
every divider, the rightmost child catches it.
Sourcepub fn leftmost_child(&self) -> Result<u32>
pub fn leftmost_child(&self) -> Result<u32>
Returns the child page to descend into to find the smallest rowid under this interior. If there are dividers, it’s slot 0’s child; otherwise it’s the rightmost (which is also the only) child.