Struct simple_db_rust::btree::file::BTreeTable [−][src]
pub struct BTreeTable {
pub key_field: usize,
pub tuple_scheme: TupleScheme,
// some fields omitted
}
Fields
key_field: usize
tuple_scheme: TupleScheme
Implementations
Insert a tuple into this BTreeFile, keeping the tuples in sorted order. May cause pages to split if the page where tuple belongs is full.
pub fn split_leaf_page(
&self,
page_rc: Rc<RefCell<BTreeLeafPage>>,
field: IntField
) -> Rc<RefCell<BTreeLeafPage>>
pub fn split_leaf_page(
&self,
page_rc: Rc<RefCell<BTreeLeafPage>>,
field: IntField
) -> Rc<RefCell<BTreeLeafPage>>
Split a leaf page to make room for new tuples and recursively split the parent node as needed to accommodate a new entry. The new entry should have a key matching the key field of the first tuple in the right-hand page (the key is “copied up”), and child pointers pointing to the two leaf pages resulting from the split. Update sibling pointers and parent pointers as needed.
Return the leaf page into which a new tuple with key field “field” should be inserted.
UPDATE: split leaf page based on the split strategy.
Arguments
field
: the key field of the tuple to be inserted after the split is complete. Necessary to know which of the two pages to return.
pub fn find_leaf_page(
&self,
page_id: BTreePageID,
field: Option<IntField>
) -> Rc<RefCell<BTreeLeafPage>>
pub fn find_leaf_page(
&self,
page_id: BTreePageID,
field: Option<IntField>
) -> Rc<RefCell<BTreeLeafPage>>
Recursive function which finds and locks the leaf page in the B+ tree corresponding to the left-most page possibly containing the key field f. It locks all internal nodes along the path to the leaf node with READ_ONLY permission, and locks the leaf node with permission perm.
If f is null, it finds the left-most leaf page – used for the iterator
Arguments
- tid - the transaction id
- pid - the current page being searched
- perm - the permissions with which to lock the leaf page
- f - the field to search for
Return
- the left-most leaf page possibly containing the key field f
Get the root page pid.
The count of pages in this BTreeFile
(BTreeRootPointerPage is not included)