pub struct PageCache { /* private fields */ }Expand description
Sharded page cache.
Routes each page_id to one of NUM_SHARDS independent
PageCacheShards by the low bits of the id. Readers and writers
for disjoint pages hit different shards and do not contend on the
shard-internal RwLocks/Mutexes. Each shard runs its own SIEVE
eviction loop over capacity / NUM_SHARDS slots; hot/cold
asymmetry across shards is accepted in exchange for the
contention win.
Implementations§
Source§impl PageCache
impl PageCache
pub fn new(capacity: usize) -> PageCache
pub fn with_default_capacity() -> PageCache
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn capacity(&self) -> usize
pub fn stats(&self) -> CacheStats
pub fn reset_stats(&self)
pub fn get(&self, page_id: u32) -> Option<Page>
pub fn insert(&self, page_id: u32, page: Page) -> Option<Page>
pub fn mark_dirty(&self, page_id: u32)
pub fn mark_clean(&self, page_id: u32)
pub fn pin(&self, page_id: u32) -> bool
pub fn unpin(&self, page_id: u32) -> bool
pub fn remove(&self, page_id: u32) -> Option<Page>
pub fn contains(&self, page_id: u32) -> bool
pub fn flush_dirty(&self) -> Vec<(u32, Page)>
Sourcepub fn flush_dirty_pages(&self, page_ids: &[u32]) -> Vec<(u32, Page)>
pub fn flush_dirty_pages(&self, page_ids: &[u32]) -> Vec<(u32, Page)>
Snapshot only the requested dirty images, bounding payload copies by the caller’s batch size rather than the full cache capacity.
pub fn flush_some_dirty(&self, max: usize) -> Vec<(u32, Page)>
pub fn dirty_count(&self) -> usize
pub fn clear(&self)
pub fn page_ids(&self) -> Vec<u32>
Sourcepub fn dirty_page_ids(&self, max: usize) -> Vec<u32>
pub fn dirty_page_ids(&self, max: usize) -> Vec<u32>
Clean entries must not split a small dirty set into many I/O batches.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PageCache
impl RefUnwindSafe for PageCache
impl Send for PageCache
impl Sync for PageCache
impl Unpin for PageCache
impl UnsafeUnpin for PageCache
impl UnwindSafe for PageCache
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request