pub struct DecodedNode {
pub kind: NodeKind,
pub level: u8,
pub next_sibling: u64,
pub children: Vec<ChildEntry>,
pub leaves: Vec<LeafEntry>,
pub internals: Vec<InternalEntry>,
}Expand description
Decoded in-memory representation of a B+tree node.
One DecodedNode is built per Pager::read_page of a B+tree
page; lifetime is “until the caller is done inspecting the
node.” See the module-level Rule 3 note for why we use Vec
rather than heapless::Vec for the slot collections.
Fields§
§kind: NodeKindNode kind (internal or leaf).
level: u8Tree level. Leaves are level 0; internals are level ≥ 1.
next_sibling: u64Right-sibling leaf page-id (leaves only; 0 on the last leaf
and on internal nodes).
children: Vec<ChildEntry>Child page-ids (internal nodes only). Length is
internals.len() + 1 when the node is internal, 0 for
leaves.
leaves: Vec<LeafEntry>Leaf slots (leaf nodes only).
internals: Vec<InternalEntry>Internal-node pivots (internal nodes only).
Implementations§
Source§impl DecodedNode
impl DecodedNode
Sourcepub fn occupied_bytes(&self) -> usize
pub fn occupied_bytes(&self) -> usize
Number of bytes the slot directory + key/value heap currently occupy in a freshly-encoded page. Used by the insert path to decide whether a node has room for one more entry.
Sourcepub fn free_bytes(&self) -> usize
pub fn free_bytes(&self) -> usize
Available payload bytes a fresh encode would still have.
Trait Implementations§
Source§impl Clone for DecodedNode
impl Clone for DecodedNode
Source§fn clone(&self) -> DecodedNode
fn clone(&self) -> DecodedNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more