pub struct InternalNode<K, V>{
pub id: u64,
pub keys: Vec<K>,
pub children: Vec<u64>,
/* private fields */
}Expand description
Internal node (keys + child pointers)
Fields§
§id: u64Node ID
keys: Vec<K>Keys (separator keys)
children: Vec<u64>Child node IDs (len = keys.len() + 1)
Implementations§
Source§impl<K, V> InternalNode<K, V>
impl<K, V> InternalNode<K, V>
Sourcepub fn new() -> InternalNode<K, V>
pub fn new() -> InternalNode<K, V>
Create new internal node
Sourcepub fn with_child(child_id: u64) -> InternalNode<K, V>
pub fn with_child(child_id: u64) -> InternalNode<K, V>
Create with initial child
Sourcepub fn find_child_index(&self, key: &K) -> usize
pub fn find_child_index(&self, key: &K) -> usize
Find child index for key
Sourcepub fn insert_at(&mut self, idx: usize, key: K, right_child: u64)
pub fn insert_at(&mut self, idx: usize, key: K, right_child: u64)
Insert key and child at position
Sourcepub fn split(&mut self) -> (K, InternalNode<K, V>)
pub fn split(&mut self) -> (K, InternalNode<K, V>)
Split node at middle
Sourcepub fn merge(&mut self, separator: K, right: &mut InternalNode<K, V>)
pub fn merge(&mut self, separator: K, right: &mut InternalNode<K, V>)
Merge with sibling
Sourcepub fn borrow_from_left(
&mut self,
left: &mut InternalNode<K, V>,
parent_key: &K,
) -> K
pub fn borrow_from_left( &mut self, left: &mut InternalNode<K, V>, parent_key: &K, ) -> K
Borrow from left sibling
§Invariant
Caller must have verified that left.keys.len() > MIN_KEYS before
invoking this function (see rebalance logic in tree.rs). Otherwise
borrowing would violate the B-tree invariant on the sibling.
Sourcepub fn borrow_from_right(
&mut self,
right: &mut InternalNode<K, V>,
parent_key: &K,
) -> K
pub fn borrow_from_right( &mut self, right: &mut InternalNode<K, V>, parent_key: &K, ) -> K
Borrow from right sibling
Trait Implementations§
Source§impl<K, V> Debug for InternalNode<K, V>
impl<K, V> Debug for InternalNode<K, V>
Auto Trait Implementations§
impl<K, V> Freeze for InternalNode<K, V>
impl<K, V> RefUnwindSafe for InternalNode<K, V>where
V: RefUnwindSafe,
K: RefUnwindSafe,
impl<K, V> Send for InternalNode<K, V>
impl<K, V> Sync for InternalNode<K, V>
impl<K, V> Unpin for InternalNode<K, V>
impl<K, V> UnsafeUnpin for InternalNode<K, V>
impl<K, V> UnwindSafe for InternalNode<K, V>where
V: UnwindSafe,
K: UnwindSafe,
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request