pub struct Pager {
pub meta: IndexMeta,
/* private fields */
}Fields§
§meta: IndexMetaImplementations§
Source§impl Pager
impl Pager
Sourcepub fn create(path: &Path) -> IsamResult<Self>
pub fn create(path: &Path) -> IsamResult<Self>
Create a brand-new index file. Writes page 0 (metadata) and allocates page 1 as an empty leaf (the initial root).
Sourcepub fn open(path: &Path) -> IsamResult<Self>
pub fn open(path: &Path) -> IsamResult<Self>
Open an existing index file and read its metadata header.
Sourcepub fn read_page(&mut self, id: u32) -> IsamResult<Vec<u8>>
pub fn read_page(&mut self, id: u32) -> IsamResult<Vec<u8>>
Read page id into a fresh PAGE_SIZE-byte buffer.
Sourcepub fn write_page(&mut self, id: u32, data: &[u8]) -> IsamResult<()>
pub fn write_page(&mut self, id: u32, data: &[u8]) -> IsamResult<()>
Write data (must be exactly PAGE_SIZE bytes) to page id.
Sourcepub fn alloc_page(&mut self) -> IsamResult<u32>
pub fn alloc_page(&mut self) -> IsamResult<u32>
Allocate a new blank page at the end of the file and return its id.
Sourcepub fn flush_meta(&mut self) -> IsamResult<()>
pub fn flush_meta(&mut self) -> IsamResult<()>
Write the current self.meta back to page 0.
Sourcepub fn flush(&mut self) -> IsamResult<()>
pub fn flush(&mut self) -> IsamResult<()>
Flush OS write buffers.
Sourcepub fn fsync(&mut self) -> IsamResult<()>
pub fn fsync(&mut self) -> IsamResult<()>
Flush and fsync for durability.
Sourcepub fn empty_leaf_page() -> Vec<u8> ⓘ
pub fn empty_leaf_page() -> Vec<u8> ⓘ
Returns an empty leaf page (all zeros except the page_type byte).
Sourcepub fn empty_internal_page() -> Vec<u8> ⓘ
pub fn empty_internal_page() -> Vec<u8> ⓘ
Returns an empty internal page.
Auto Trait Implementations§
impl Freeze for Pager
impl RefUnwindSafe for Pager
impl Send for Pager
impl Sync for Pager
impl Unpin for Pager
impl UnwindSafe for Pager
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