pub struct BufferPool { /* private fields */ }Expand description
LRU buffer pool for page caching.
Implementations§
Source§impl BufferPool
impl BufferPool
Sourcepub fn new(config: BufferPoolConfig) -> Self
pub fn new(config: BufferPoolConfig) -> Self
Create a new buffer pool with the given configuration.
Sourcepub fn with_capacity(num_pages: usize) -> Self
pub fn with_capacity(num_pages: usize) -> Self
Create a buffer pool with default configuration.
Sourcepub fn fetch_page(&self, page_id: PageId) -> Result<PageHandle>
pub fn fetch_page(&self, page_id: PageId) -> Result<PageHandle>
Fetch a page from the pool, loading it if necessary.
Sourcepub fn new_page(
&self,
page_id: PageId,
page_type: PageType,
) -> Result<PageHandle>
pub fn new_page( &self, page_id: PageId, page_type: PageType, ) -> Result<PageHandle>
Create a new page in the pool.
Sourcepub fn flush_page(&self, page_id: PageId) -> Result<Option<Page>>
pub fn flush_page(&self, page_id: PageId) -> Result<Option<Page>>
Flush a specific page to storage.
Sourcepub fn unpin_page(&self, page_id: PageId)
pub fn unpin_page(&self, page_id: PageId)
Unpin a page, allowing it to be evicted.
Sourcepub fn stats(&self) -> BufferPoolStats
pub fn stats(&self) -> BufferPoolStats
Get buffer pool statistics.
Auto Trait Implementations§
impl !Freeze for BufferPool
impl !RefUnwindSafe for BufferPool
impl Send for BufferPool
impl Sync for BufferPool
impl Unpin for BufferPool
impl UnsafeUnpin for BufferPool
impl !UnwindSafe for BufferPool
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