pub struct BTree {
pub root: PageId,
pub depth: u16,
pub entry_count: u64,
}Expand description
B+ tree metadata. Lightweight struct — pages are stored externally.
Fields§
§root: PageId§depth: u16§entry_count: u64Implementations§
Source§impl BTree
impl BTree
Sourcepub fn new(
pages: &mut HashMap<PageId, Page>,
alloc: &mut PageAllocator,
txn_id: TxnId,
) -> Self
pub fn new( pages: &mut HashMap<PageId, Page>, alloc: &mut PageAllocator, txn_id: TxnId, ) -> Self
Create a new empty B+ tree with a single leaf root.
Sourcepub fn from_existing(root: PageId, depth: u16, entry_count: u64) -> Self
pub fn from_existing(root: PageId, depth: u16, entry_count: u64) -> Self
Create a BTree from existing metadata (e.g., loaded from commit slot).
Sourcepub fn search(
&self,
pages: &HashMap<PageId, Page>,
key: &[u8],
) -> Result<Option<(ValueType, Vec<u8>)>>
pub fn search( &self, pages: &HashMap<PageId, Page>, key: &[u8], ) -> Result<Option<(ValueType, Vec<u8>)>>
Search for a key. Returns Some((val_type, value)) if found, None otherwise.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for BTree
impl RefUnwindSafe for BTree
impl Send for BTree
impl Sync for BTree
impl Unpin for BTree
impl UnsafeUnpin for BTree
impl UnwindSafe for BTree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more