logos.std.data.persistent.bt.descent

Module std · package logos-std

Functions

fnarc_is_leaf

fn arc_is_leaf(arc: &Arc<dyn BTreeNode>) -> bool

Returns true if the node behind arc is a leaf, via a layout-driven NodeBase header read.

fnas_branch

fn as_branch(arc: &Arc<dyn BTreeNode>) -> *mut BranchNode<K, STORE_CFG, CFG>

Casts arc’s node data pointer to a typed BranchNode pointer; caller must check arc_is_leaf first — no validation is performed.

fnas_leaf

fn as_leaf(arc: &Arc<dyn BTreeNode>) -> *mut LeafNode<K, V, STORE_CFG, CFG>

Casts arc’s node data pointer to a typed LeafNode pointer; caller must check arc_is_leaf first — no validation is performed.

fnbranch_descend_idx

fn branch_descend_idx(branch: *mut BranchNode<K, STORE_CFG, CFG>, key: K::ViewInStore) -> u64

Returns the smallest child index i with keys[i] >= key, or the key count n if key exceeds every subtree max. Invariant: keys[i] = max key of children[i] (parallel arrays); readers treat n as “not in tree”, insert saturates to n-1.

fnbt_contains_rec

fn bt_contains_rec(arc: &Arc<dyn BTreeNode>, key: K::ViewInStore) -> bool

Returns true if key is present in the subtree rooted at arc (read-only recursive descent; no rc bumps).

fnbt_descend_to_n

fn bt_descend_to_n(arc: &Arc<dyn BTreeNode>, n: u64, out_idx: *mut u64) -> Option

Descends from arc to the leaf holding the n-th key (zero-indexed, sorted order).

On success returns the leaf arc (rc bumped) and writes the leaf-relative slot to *out_idx; if n >= tree size, returns None and writes 0. O(depth) via the SUM-column shuttle.

fnbt_get_rec

fn bt_get_rec(arc: &Arc<dyn BTreeNode>, key: K::ViewInStore) -> Option

Returns the stored value view for key in the subtree rooted at arc, or None if absent.

fnbt_lower_bound

fn bt_lower_bound(arc: &Arc<dyn BTreeNode>, key: K::ViewInStore) -> u64

Returns the smallest global sorted position whose key is >= key; the tree size if key exceeds every key in the tree.

fnbt_size_rec

fn bt_size_rec(arc: &Arc<dyn BTreeNode>) -> u64

Returns the total key count of the subtree rooted at arc. Sums the subtree_size SUM column when populated (no descent); otherwise falls back to a recursive walk over children.

fnbt_upper_bound

fn bt_upper_bound(arc: &Arc<dyn BTreeNode>, key: K::ViewInStore) -> u64

Returns the smallest global sorted position whose key is > key (strict); the tree size if no key exceeds key.

fnleaf_find

fn leaf_find(leaf: *mut LeafNode<K, V, STORE_CFG, CFG>, key: K::ViewInStore) -> i64

Returns the index of key in leaf, or -1 if absent (linear scan).

fnleaf_lower_bound

fn leaf_lower_bound(leaf: *mut LeafNode<K, V, STORE_CFG, CFG>, key: K::ViewInStore) -> u64

Returns the first in-leaf index with keys[i] >= key, or the key count if no such index.

fnleaf_upper_bound

fn leaf_upper_bound(leaf: *mut LeafNode<K, V, STORE_CFG, CFG>, key: K::ViewInStore) -> u64

Returns the first in-leaf index with keys[i] > key (strict), or the key count if none. Mirrors leaf_lower_bound with a strict-greater predicate.

fnmax_keys_branch

fn max_keys_branch() -> u64

Returns the max key count for branch nodes: CFG fanout_branch, else fanout, else 4.

fnmax_keys_leaf

fn max_keys_leaf() -> u64

Returns the max key count for leaf nodes: CFG fanout_leaf, else fanout, else 4.

fnmin_keys_branch

fn min_keys_branch() -> u64

Returns the min key count for a branch node (max/2, at least 1); fewer keys means the node underflowed and must borrow from a sibling or merge during remove rebalance.

fnmin_keys_leaf

fn min_keys_leaf() -> u64

Returns the min key count for a leaf node (max/2, at least 1); fewer keys means the node underflowed and must borrow from a sibling or merge during remove rebalance.