BTreeInternalPage

Struct BTreeInternalPage 

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

The internal page is used to store the keys and the page id of the children.

§Binary Layout

  • 4 bytes: page category
  • 4 bytes: parent page index
  • 4 bytes: children category (leaf/internal)
  • n bytes: header bytes, indicate whether every slot of the page is used or not.
  • n bytes: keys
  • n bytes: children

§Stable Criteria

count(used_slots) >= floor_dev(slot_count, 2)

Implementations§

Source§

impl BTreeInternalPage

Source

pub fn get_coresponding_entry( &self, left_pid: Option<&BTreePageID>, right_pid: Option<&BTreePageID>, ) -> Option<Entry>

Source

pub fn stable(&self) -> bool

Source

pub fn get_entry(&self, index: usize) -> Option<Entry>

Source

pub fn delete_key_and_right_child(&mut self, record_id: usize)

Source

pub fn delete_key_and_left_child(&mut self, record_id: usize)

Source

pub fn update_entry(&mut self, entry: &Entry)

Source

pub fn is_slot_used(&self, slot_index: usize) -> bool

Returns true if associated slot on this page is filled.

Source

pub fn get_child_pid(&self, _index: usize) -> Option<BTreePageID>

Source

pub fn get_first_child_pid(&self) -> BTreePageID

Source

pub fn get_last_child_pid(&self) -> BTreePageID

Source

pub fn get_left_sibling_pid(&self, tx: &Transaction) -> Option<BTreePageID>

Source

pub fn get_right_sibling_pid(&self, tx: &Transaction) -> Option<BTreePageID>

Source

pub fn get_entry_by_children( &self, left_pid: &BTreePageID, right_pid: &BTreePageID, ) -> Option<Entry>

Source

pub fn check_integrity( &self, parent_pid: &BTreePageID, lower_bound: Option<IntField>, upper_bound: Option<IntField>, check_occupancy: bool, depth: usize, )

Source§

impl BTreeInternalPage

Source

pub fn insert_entry(&mut self, e: &Entry) -> SmallResult

Source§

impl BTreeInternalPage

Source

pub fn empty_slots_count(&self) -> usize

Empty slots (entries/children) count.

Source

pub fn children_count(&self) -> usize

Source

pub fn entries_count(&self) -> usize

Source§

impl BTreeInternalPage

Source

pub fn get_children_capacity(&self) -> usize

Source

pub fn get_stable_threshold(key_size: usize) -> usize

Retrive the minimum number of children needed to keep this page stable.

Source

pub fn get_children_cap(key_size: usize) -> usize

Retrieve the maximum number of children this page can hold.

Trait Implementations§

Source§

impl BTreePage for BTreeInternalPage

Source§

fn new( pid: &BTreePageID, bytes: &[u8], tuple_scheme: &Schema, key_field: usize, ) -> Self

Source§

fn get_pid(&self) -> BTreePageID

Source§

fn get_parent_pid(&self) -> BTreePageID

Source§

fn set_parent_pid(&mut self, pid: &BTreePageID)

Source§

fn get_page_data(&self) -> Vec<u8>

Generates a byte array representing the contents of this page. Used to serialize this page to disk. Read more
Source§

fn set_before_image(&mut self)

Source§

fn get_before_image(&self) -> Vec<u8>

Provide a representation of this page before any modifications were made to it. Used by recovery.
Source§

fn peek(&self)

Auto Trait Implementations§

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.