pub struct LeafNode<K, V>{
pub id: u64,
pub keys: Vec<K>,
pub entries: Vec<LeafEntry<K, V>>,
pub next: Option<u64>,
pub prev: Option<u64>,
}Expand description
Leaf node (keys + versioned values)
Fields§
§id: u64Node ID
keys: Vec<K>Keys
entries: Vec<LeafEntry<K, V>>Versioned values (parallel to keys)
next: Option<u64>Next leaf (for range scans)
prev: Option<u64>Previous leaf (for reverse scans)
Implementations§
Source§impl<K, V> LeafNode<K, V>
impl<K, V> LeafNode<K, V>
Sourcepub fn insert(
&mut self,
key: K,
value: V,
txn_id: TxnId,
timestamp: Timestamp,
) -> bool
pub fn insert( &mut self, key: K, value: V, txn_id: TxnId, timestamp: Timestamp, ) -> bool
Insert key-value pair
Sourcepub fn borrow_from_left(&mut self, left: &mut LeafNode<K, V>) -> K
pub fn borrow_from_left(&mut self, left: &mut LeafNode<K, V>) -> K
Borrow from left sibling
§Invariant
Caller must have verified that left.keys.len() > MIN_KEYS before
invoking this function. In leaf nodes keys.len() == entries.len()
always, so one invariant check covers both pops.
Sourcepub fn borrow_from_right(&mut self, right: &mut LeafNode<K, V>) -> K
pub fn borrow_from_right(&mut self, right: &mut LeafNode<K, V>) -> K
Borrow from right sibling
Trait Implementations§
Auto Trait Implementations§
impl<K, V> Freeze for LeafNode<K, V>
impl<K, V> RefUnwindSafe for LeafNode<K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
impl<K, V> Send for LeafNode<K, V>
impl<K, V> Sync for LeafNode<K, V>
impl<K, V> Unpin for LeafNode<K, V>where
K: Unpin,
impl<K, V> UnsafeUnpin for LeafNode<K, V>
impl<K, V> UnwindSafe for LeafNode<K, V>where
K: UnwindSafe,
V: 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