Skip to main content

InNodeStub

Struct InNodeStub 

Source
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: u64

Node ID.

§level: i32

Level in tree.

§entries: Vec<InEntry>

Child entries (key, lsn).

§targets: TargetRep

T-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: bool

Dirty flag — set whenever this node is modified. IN.dirty (IN_DIRTY_BIT).

§generation: u64

LRU 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: LsnRep

T-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

Source

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

Source

pub fn child_ref(&self, idx: usize) -> Option<&ChildArc>

Borrow the resident child for slot idx without cloning.

Source

pub fn child_is_none(&self, idx: usize) -> bool

True if slot idx has no resident (cached) child. IN.getTarget(idx) == null.

Source

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.

Source

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.

Source

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

Source

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

Source

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.

Source

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

Source

pub fn resident_children(&self) -> Vec<ChildArc>

All resident children (cloned Arcs), in unspecified order. Replaces entries.iter().filter_map(|e| e.child.clone()).

Source

pub fn first_resident_child(&self) -> Option<(usize, ChildArc)>

(slot_index, child) of the first resident child, if any.

Trait Implementations§

Source§

impl Debug for InNodeStub

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.