Struct rustdb::sortedfile::SortedFile
source · pub struct SortedFile {
pub dirty_pages: RefCell<FxHashMap<u64, PagePtr>>,
pub rec_size: usize,
pub key_size: usize,
pub root_page: Cell<u64>,
pub ok: Cell<bool>,
}
Expand description
Sorted Record storage.
SortedFile is a tree of pages.
Each page is either a parent page with links to child pages, or a leaf page.
Fields§
§dirty_pages: RefCell<FxHashMap<u64, PagePtr>>
Map of pages that have not been saved..
rec_size: usize
Size of a record.
key_size: usize
Size of a key.
root_page: Cell<u64>
The root page.
ok: Cell<bool>
Status
Implementations§
source§impl SortedFile
impl SortedFile
sourcepub fn new(rec_size: usize, key_size: usize, root_page: u64) -> Self
pub fn new(rec_size: usize, key_size: usize, root_page: u64) -> Self
Create File with specified record size, key size, root page.
sourcepub fn free_pages(&self, db: &DB, r: &dyn Record)
pub fn free_pages(&self, db: &DB, r: &dyn Record)
Free the underlying storage. File is not useable after this.
sourcepub fn insert(&self, db: &DB, r: &dyn Record)
pub fn insert(&self, db: &DB, r: &dyn Record)
Insert a Record. Panics if the key is a duplicate.
sourcepub fn get(&self, db: &DB, r: &dyn Record) -> Option<(PagePtr, usize)>
pub fn get(&self, db: &DB, r: &dyn Record) -> Option<(PagePtr, usize)>
Locate a record with matching key. Result is PagePtr and offset of data.
sourcepub fn asc(self: &Rc<Self>, db: &DB, start: Box<dyn Record>) -> Asc ⓘ
pub fn asc(self: &Rc<Self>, db: &DB, start: Box<dyn Record>) -> Asc ⓘ
For iteration in ascending order from start.
sourcepub fn dsc(self: &Rc<Self>, db: &DB, start: Box<dyn Record>) -> Dsc ⓘ
pub fn dsc(self: &Rc<Self>, db: &DB, start: Box<dyn Record>) -> Dsc ⓘ
For iteration in descending order from start.
Auto Trait Implementations§
impl !Freeze for SortedFile
impl !RefUnwindSafe for SortedFile
impl !Send for SortedFile
impl !Sync for SortedFile
impl Unpin for SortedFile
impl !UnwindSafe for SortedFile
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