pub struct InNodeStub {
pub node_id: u64,
pub level: i32,
pub entries: Vec<InEntry>,
pub targets: TargetRep,
pub dirty: bool,
pub generation: u64,
pub parent: Option<Weak<RwLock<TreeNode>>>,
pub lsn_rep: LsnRep,
}Expand description
Lightweight upper-IN representation used by the tree traversal layer.
IN: carries the dirty flag (IN_DIRTY_BIT), the LRU
generation counter, and a weak back-pointer to the parent so that
dirty state can be propagated upward.
Fields§
§node_id: u64Node ID.
level: i32Level in tree.
entries: Vec<InEntry>Child entries (key, lsn).
targets: TargetRepT-4: per-node resident-child-pointer representation.
IN.entryTargets (INTargetRep). The cached child pointer is no
longer a per-InEntry Option<Arc> (which cost a pointer-sized slot
even when no child was resident); it lives here as a compact
node-level rep that starts None (0 child-pointer bytes — most upper
INs have no resident children), grows to Sparse for a few cached
children, and inflates to Default (the full parallel array) once
many children are resident. See INTargetRep.{None,Sparse,Default}.
dirty: boolDirty flag — set whenever this node is modified.
IN.dirty (IN_DIRTY_BIT).
generation: u64LRU generation counter for the evictor.
IN.generation.
parent: Option<Weak<RwLock<TreeNode>>>Weak back-pointer to parent IN.
Enables dirty-propagation and latch-coupling validation.
IN.parent reference used during splits and logging.
lsn_rep: LsnRepT-3: per-node packed LSN array (IN.entryLsnByteArray). The per-slot
lsn (8 bytes) that used to live in InEntry is hoisted here as a
base_file_number-relative 4-byte-per-slot rep, falling back to a
u64-per-slot Long rep only when a node’s LSN range exceeds the
compact form. Access via get_lsn(slot) / set_lsn(slot, lsn).
Implementations§
Source§impl InNodeStub
impl InNodeStub
Sourcepub fn get_child(&self, idx: usize) -> Option<ChildArc>
pub fn get_child(&self, idx: usize) -> Option<ChildArc>
IN.getTarget(idx) — the resident child cached for slot idx, cloned
(a strong Arc), or None if the child is not cached. Routes through
the node-level INTargetRep (T-4).
Sourcepub fn child_ref(&self, idx: usize) -> Option<&ChildArc>
pub fn child_ref(&self, idx: usize) -> Option<&ChildArc>
Borrow the resident child for slot idx without cloning.
Sourcepub fn child_is_none(&self, idx: usize) -> bool
pub fn child_is_none(&self, idx: usize) -> bool
True if slot idx has no resident (cached) child.
IN.getTarget(idx) == null.
Sourcepub fn set_child(&mut self, idx: usize, node: Option<ChildArc>)
pub fn set_child(&mut self, idx: usize, node: Option<ChildArc>)
IN.setTarget(idx, node) — set (or clear) the cached child for slot
idx, mutating the INTargetRep upward as needed.
Sourcepub fn take_child(&mut self, idx: usize) -> Option<ChildArc>
pub fn take_child(&mut self, idx: usize) -> Option<ChildArc>
IN.detachNode helper — remove and return the cached child for slot
idx, leaving the slot’s key/LSN intact for re-fetch.
Sourcepub fn get_lsn(&self, idx: usize) -> Lsn
pub fn get_lsn(&self, idx: usize) -> Lsn
IN.getLsn(idx) (IN.java:1752) — the LSN of slot idx via the
node-level packed LsnRep (T-3).
Sourcepub fn set_lsn(&mut self, idx: usize, lsn: Lsn)
pub fn set_lsn(&mut self, idx: usize, lsn: Lsn)
IN.setLsn(idx, lsn) (IN.java:1773) — set the LSN of slot idx via
the node-level packed LsnRep (T-3).
Sourcepub fn insert_entry(
&mut self,
idx: usize,
key: Vec<u8>,
lsn: Lsn,
child: Option<ChildArc>,
)
pub fn insert_entry( &mut self, idx: usize, key: Vec<u8>, lsn: Lsn, child: Option<ChildArc>, )
Insert an entry at idx, shifting the child mapping to stay aligned
(INArrayRep.copy), then set the new slot’s cached child. Mirrors the
old entries.insert(idx, InEntry{ child: ..}) in one call.
Sourcepub fn remove_entry(&mut self, idx: usize) -> InEntry
pub fn remove_entry(&mut self, idx: usize) -> InEntry
Remove the entry at idx, shifting the child mapping to stay aligned
(INArrayRep.copy). Returns the removed InEntry (key).
Sourcepub fn resident_children(&self) -> Vec<ChildArc> ⓘ
pub fn resident_children(&self) -> Vec<ChildArc> ⓘ
All resident children (cloned Arcs), in unspecified order.
Replaces entries.iter().filter_map(|e| e.child.clone()).
Sourcepub fn first_resident_child(&self) -> Option<(usize, ChildArc)>
pub fn first_resident_child(&self) -> Option<(usize, ChildArc)>
(slot_index, child) of the first resident child, if any.