pub struct PageManager { /* private fields */ }Expand description
Page manager for database file
Implementations§
Source§impl PageManager
impl PageManager
Sourcepub fn create<P: AsRef<Path>>(path: P, page_size: u32) -> Result<Self>
pub fn create<P: AsRef<Path>>(path: P, page_size: u32) -> Result<Self>
Create a new database file
Sourcepub fn allocate_page(&self) -> Result<PageId>
pub fn allocate_page(&self) -> Result<PageId>
Allocate a new page - O(1) amortized
First tries to pop from free list, otherwise extends file
Sourcepub fn deallocate_page(&self, page_id: PageId) -> Result<()>
pub fn deallocate_page(&self, page_id: PageId) -> Result<()>
Deallocate a page - O(1)
Adds page to head of free list
Sourcepub fn total_pages(&self) -> u64
pub fn total_pages(&self) -> u64
Get total pages
Sourcepub fn stats(&self) -> Result<PageManagerStats>
pub fn stats(&self) -> Result<PageManagerStats>
Get statistics
Auto Trait Implementations§
impl !Freeze for PageManager
impl !RefUnwindSafe for PageManager
impl Send for PageManager
impl Sync for PageManager
impl Unpin for PageManager
impl UnsafeUnpin for PageManager
impl UnwindSafe for PageManager
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more