pub struct BufferManager { /* private fields */ }Expand description
The buffer manager manages a pool of frames with a Clock eviction policy.
Implementations§
Source§impl BufferManager
impl BufferManager
pub fn new( db_path: PathBuf, memory_manager: Arc<MemoryManager>, config: BufferManagerConfig, ) -> Self
pub fn stats(&self) -> &BufferManagerStats
pub fn page_size(&self) -> usize
pub fn num_frames(&self) -> usize
Sourcepub fn is_file_registered(&self, name: &str) -> bool
pub fn is_file_registered(&self, name: &str) -> bool
Check if a file is already registered with the buffer manager.
Sourcepub fn register_file(&mut self, name: &str, path: PathBuf)
pub fn register_file(&mut self, name: &str, path: PathBuf)
Register a database file with the buffer manager.
Sourcepub fn pin(&mut self, file_name: &str, page_num: PageNum) -> Result<Frame>
pub fn pin(&mut self, file_name: &str, page_num: PageNum) -> Result<Frame>
Pin a page: bring it into the buffer pool if not already present.
Sourcepub fn pin_mut(
&mut self,
file_name: &str,
page_num: PageNum,
) -> Result<&mut Frame>
pub fn pin_mut( &mut self, file_name: &str, page_num: PageNum, ) -> Result<&mut Frame>
Pin a page and get mutable access.
Sourcepub fn unpin(&mut self, file_name: &str, page_num: PageNum)
pub fn unpin(&mut self, file_name: &str, page_num: PageNum)
Unpin a page (requires file_name for composite key lookup).
Sourcepub fn flush(&mut self, file_name: &str, page_num: PageNum) -> Result<()>
pub fn flush(&mut self, file_name: &str, page_num: PageNum) -> Result<()>
Flush a dirty page to disk.
Sourcepub fn dirty_page_nums_for_file(&self, file_name: &str) -> Vec<PageNum> ⓘ
pub fn dirty_page_nums_for_file(&self, file_name: &str) -> Vec<PageNum> ⓘ
Return all dirty page numbers belonging to a specific file.
Sourcepub fn drop_file(&mut self, file_name: &str)
pub fn drop_file(&mut self, file_name: &str)
Drop all state for a file: cached frames, registration, mmap region, and sequential-access tracking. Used when a file is deleted or rebuilt from scratch (e.g. a full persistence-mirror rewrite) so stale frames are not re-read under the same file name.
Trait Implementations§
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§
impl<T> Allocation for T
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