pub struct Pool { /* private fields */ }Expand description
A pool of buffer frames with clock (second-chance FIFO) eviction.
Each pool manages a fixed set of frames. The buffer manager uses two pools: one for reads (70%) and one for writes (30%).
Implementations§
Source§impl Pool
impl Pool
Sourcepub fn num_frames(&self) -> u32
pub fn num_frames(&self) -> u32
Get the number of frames in this pool.
Sourcepub fn find_evictable(&self) -> Option<FrameIdx>
pub fn find_evictable(&self) -> Option<FrameIdx>
Find an evictable frame using the clock (second-chance) algorithm.
Returns the index of an evictable frame, or None if all frames are pinned.
A frame is evictable if it is not pinned. If it has the recently_used flag,
we clear it and skip to the next frame (second chance).
We scan at most 2 * num_frames to ensure we complete a full cycle
with cleared flags before giving up.
Sourcepub fn find_empty(&self) -> Option<FrameIdx>
pub fn find_empty(&self) -> Option<FrameIdx>
Find the first empty (invalid page) frame.
Sourcepub fn dirty_count(&self) -> u32
pub fn dirty_count(&self) -> u32
Count the number of dirty frames.
Sourcepub fn pinned_count(&self) -> u32
pub fn pinned_count(&self) -> u32
Count the number of pinned frames.
Sourcepub fn loaded_count(&self) -> u32
pub fn loaded_count(&self) -> u32
Count the number of frames with valid pages loaded.
Auto Trait Implementations§
impl !Freeze for Pool
impl RefUnwindSafe for Pool
impl Send for Pool
impl Sync for Pool
impl Unpin for Pool
impl UnsafeUnpin for Pool
impl UnwindSafe for Pool
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
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>
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>
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