pub struct BTreeLeafPage {
pub slot_count: usize,
pub tuple_scheme: Schema,
/* private fields */
}Expand description
A leaf page in the B+ tree.
§Binary Layout
- 4 bytes: page category
- 4 bytes: parent page index
- 4 bytes: left sibling page index
- 4 bytes: right sibling page index
- n bytes: header bytes, indicate whether every slot of the page is used or not.
- n bytes: tuple bytes
Fields§
§slot_count: usize§tuple_scheme: SchemaImplementations§
Source§impl BTreeLeafPage
impl BTreeLeafPage
pub fn set_right_pid(&mut self, pid: Option<BTreePageID>)
pub fn get_right_pid(&self) -> Option<BTreePageID>
pub fn set_left_pid(&mut self, pid: Option<BTreePageID>)
pub fn get_left_pid(&self) -> Option<BTreePageID>
pub fn get_slots_count(&self) -> usize
pub fn empty_slots_count(&self) -> usize
Sourcepub fn tuples_count(&self) -> usize
pub fn tuples_count(&self) -> usize
Returns the number of tuples currently stored on this page
pub fn calculate_header_size(slot_count: usize) -> usize
Sourcepub fn insert_tuple(&mut self, tuple: &Tuple)
pub fn insert_tuple(&mut self, tuple: &Tuple)
Adds the specified tuple to the page such that all records remain in sorted order; the tuple should be updated to reflect that it is now stored on this page. tuple: The tuple to add.
pub fn get_tuple(&self, slot_index: usize) -> Option<Tuple>
pub fn delete_tuple(&mut self, slot_index: usize)
Sourcepub fn is_slot_used(&self, slot_index: usize) -> bool
pub fn is_slot_used(&self, slot_index: usize) -> bool
Returns true if associated slot on this page is filled.
pub fn mark_slot_status(&mut self, slot_index: usize, used: bool)
pub fn check_integrity( &self, parent_pid: &BTreePageID, lower_bound: Option<IntField>, upper_bound: Option<IntField>, check_occupancy: bool, depth: usize, )
pub fn iter(&self) -> BTreeLeafPageIterator<'_> ⓘ
Source§impl BTreeLeafPage
impl BTreeLeafPage
Sourcepub fn calculate_slots_count(scheme: &Schema) -> usize
pub fn calculate_slots_count(scheme: &Schema) -> usize
Retrieve the maximum number of tuples this page can hold.
Trait Implementations§
Source§impl BTreePage for BTreeLeafPage
impl BTreePage for BTreeLeafPage
Source§fn get_page_data(&self) -> Vec<u8> ⓘ
fn get_page_data(&self) -> Vec<u8> ⓘ
Generates a byte array representing the contents of this page. Used to serialize this page to disk.
The invariant here is that it should be possible to pass the byte array generated by get_page_data to the BTreeLeafPage constructor and have it produce an identical BTreeLeafPage object.
fn new( pid: &BTreePageID, bytes: &[u8], tuple_scheme: &Schema, key_field: usize, ) -> Self
fn get_pid(&self) -> BTreePageID
fn get_parent_pid(&self) -> BTreePageID
fn set_parent_pid(&mut self, pid: &BTreePageID)
fn set_before_image(&mut self)
Source§fn get_before_image(&self) -> Vec<u8> ⓘ
fn get_before_image(&self) -> Vec<u8> ⓘ
Provide a representation of this page before any modifications
were made to it. Used by recovery.
fn peek(&self)
Auto Trait Implementations§
impl Freeze for BTreeLeafPage
impl RefUnwindSafe for BTreeLeafPage
impl Send for BTreeLeafPage
impl Sync for BTreeLeafPage
impl Unpin for BTreeLeafPage
impl UnwindSafe for BTreeLeafPage
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