Skip to main content

Nodes

Struct Nodes 

Source
pub struct Nodes { /* private fields */ }
Expand description

The .bt di-node array: the key at every M-th position.

Copied out of the mapping into one compact arena at first use, so the narrowing search touches only hot, contiguous heap instead of faulting .bt pages scattered across a multi-gigabyte file.

Implementations§

Source§

impl Nodes

Source

pub fn len(&self) -> usize

Number of nodes (ceil(key_count / M)).

Source

pub fn is_empty(&self) -> bool

Whether there are no nodes.

Source

pub fn m(&self) -> u64

The B-tree fanout M these nodes were sampled at.

Source

pub fn heap_bytes(&self) -> usize

Heap held by the arena and (when present) the offset table.

Source

pub fn key(&self, j: usize) -> &[u8]

The j-th node key, which is key number j * M in the file.

§Panics

Panics if j >= self.len().

Source

pub fn narrow(&self, key: &[u8]) -> (u64, u64)

Narrow a search for key to the half-open key-index range that can contain it.

Node j is key j * M, and keys are sorted, so if node[j] <= key < node[j+1] then key, if present, lies in [j*M, (j+1)*M). Returns an empty range when key sorts before the very first key, which cannot be in the file at all.

Auto Trait Implementations§

§

impl Freeze for Nodes

§

impl RefUnwindSafe for Nodes

§

impl Send for Nodes

§

impl Sync for Nodes

§

impl Unpin for Nodes

§

impl UnsafeUnpin for Nodes

§

impl UnwindSafe for Nodes

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.