pub struct BufferManager { /* private fields */ }Expand description
Buffer manager with split read/write pools.
Pages are loaded from a PageStore into frames. The read pool holds
pages for analytical queries (70% default), the write pool holds pages
for ingestion/WAL staging (30% default).
Eviction uses the clock (second-chance) algorithm per pool.
Implementations§
Source§impl BufferManager
impl BufferManager
Sourcepub fn new(
total_frames: u32,
read_ratio: f64,
store: Box<dyn PageStore>,
) -> Self
pub fn new( total_frames: u32, read_ratio: f64, store: Box<dyn PageStore>, ) -> Self
Create a new buffer manager with the given total frame count and read ratio.
Sourcepub fn pin_read(&self, page_id: PageId) -> KyuResult<PinnedPage<'_>>
pub fn pin_read(&self, page_id: PageId) -> KyuResult<PinnedPage<'_>>
Pin a page for reading. Loads from disk if not already in memory.
Sourcepub fn pin_write(&self, page_id: PageId) -> KyuResult<PinnedPage<'_>>
pub fn pin_write(&self, page_id: PageId) -> KyuResult<PinnedPage<'_>>
Pin a page for writing. Loads from disk if not already in memory.
Sourcepub fn allocate_new_page(
&self,
file_id: FileId,
) -> KyuResult<(PageId, PinnedPage<'_>)>
pub fn allocate_new_page( &self, file_id: FileId, ) -> KyuResult<(PageId, PinnedPage<'_>)>
Allocate a new page in the given file and pin it for writing.
Sourcepub fn total_frames(&self) -> u32
pub fn total_frames(&self) -> u32
Get the total number of frames across both pools.
Sourcepub fn stats(&self) -> BufferManagerStats
pub fn stats(&self) -> BufferManagerStats
Get statistics about the buffer manager.
Auto Trait Implementations§
impl !Freeze for BufferManager
impl !RefUnwindSafe for BufferManager
impl Send for BufferManager
impl Sync for BufferManager
impl Unpin for BufferManager
impl UnsafeUnpin for BufferManager
impl !UnwindSafe for BufferManager
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
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 moreCreates a shared type from an unshared type.