Skip to content

Add seek_gte B-tree operation for efficient single-key seek#12

Open
mynameborat wants to merge 1 commit into
hkadayam:rust/mainfrom
mynameborat:seek-gte
Open

Add seek_gte B-tree operation for efficient single-key seek#12
mynameborat wants to merge 1 commit into
hkadayam:rust/mainfrom
mynameborat:seek-gte

Conversation

@mynameborat
Copy link
Copy Markdown

New B-tree primitive that finds the first entry >= a given key using a single binary search (find) per node. More efficient than get_any() which uses match_range (two binary searches) and wraps results in a QueryResultHandle.

Implementation includes cross-leaf fallback: when the target entry is at a leaf boundary, the walk function captures the next child's ID before releasing the parent lock, then descends to the next subtree's leftmost entry. Tree-shared lock prevents structural changes during the operation.

Added across full stack:

  • Btree: seek_gte_internal, seek_gte_walk, seek_gte_in_leaf, leftmost_entry
  • BtreeIndex trait: seek_gte method
  • UnshardedBtree: pass-through to underlying Btree
  • ShardedBtree: partition-routed pass-through
  • TableIndex: seek_gte with key validation and DbKey wrapping
  • Table: convenience method delegating to primary index

New B-tree primitive that finds the first entry >= a given key using a
single binary search (find) per node. More efficient than get_any() which
uses match_range (two binary searches) and wraps results in a
QueryResultHandle.

Implementation includes cross-leaf fallback: when the target entry is at
a leaf boundary, the walk function captures the next child's ID before
releasing the parent lock, then descends to the next subtree's leftmost
entry. Tree-shared lock prevents structural changes during the operation.

Added across full stack:
- Btree: seek_gte_internal, seek_gte_walk, seek_gte_in_leaf, leftmost_entry
- BtreeIndex trait: seek_gte method
- UnshardedBtree: pass-through to underlying Btree
- ShardedBtree: partition-routed pass-through
- TableIndex: seek_gte with key validation and DbKey wrapping
- Table: convenience method delegating to primary index
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant