pub struct BufferPool { /* private fields */ }Expand description
LRU buffer pool for caching pages in memory
Implementations§
Source§impl BufferPool
impl BufferPool
Sourcepub fn new(page_manager: Arc<PageManager>, capacity: usize) -> Self
pub fn new(page_manager: Arc<PageManager>, capacity: usize) -> Self
Create a new buffer pool with the specified capacity
§Arguments
page_manager- Page manager for disk I/Ocapacity- Maximum number of pages to cache (default: 1000 = ~4MB)
Sourcepub fn flush_dirty(&self) -> Result<(), StorageError>
pub fn flush_dirty(&self) -> Result<(), StorageError>
Flush all dirty pages to disk
Sourcepub fn size(&self) -> Result<usize, StorageError>
pub fn size(&self) -> Result<usize, StorageError>
Get the current number of pages in the cache
Sourcepub fn stats(&self) -> &BufferPoolStats
pub fn stats(&self) -> &BufferPoolStats
Get statistics for the buffer pool
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for BufferPool
impl !RefUnwindSafe for BufferPool
impl Send for BufferPool
impl Sync for BufferPool
impl Unpin 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