pub struct Sharded<T> { /* private fields */ }Expand description
A sharded mutex wrapper for the page caches. Each key routes to one of N
independent shards (each with its own lock), so concurrent rayon workers
probing different keys rarely contend on the same lock. A try_lock that
fails under contention is counted as a try-lock-miss. (§5.8)
Implementations§
Source§impl Sharded<PageCache>
impl Sharded<PageCache>
pub fn stats(&self) -> CacheStats
pub fn reset_stats(&self)
pub fn flush_to_disk(&self)
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn used_bytes(&self) -> u64
pub fn used_bytes(&self) -> u64
Live bytes across all shards.
Sourcepub fn evict_reclaimable(&self, budget: u64) -> u64
pub fn evict_reclaimable(&self, budget: u64) -> u64
Governor entry point (S1E-003 step 2): evict at least budget bytes
across the shards (spread evenly over the remaining shards), returning
the bytes actually freed.
Source§impl Sharded<DecodedPageCache>
impl Sharded<DecodedPageCache>
pub fn stats(&self) -> CacheStats
pub fn reset_stats(&self)
pub fn len(&self) -> usize
Sourcepub fn used_bytes(&self) -> u64
pub fn used_bytes(&self) -> u64
Live bytes across all shards.
Sourcepub fn evict_reclaimable(&self, budget: u64) -> u64
pub fn evict_reclaimable(&self, budget: u64) -> u64
Governor entry point (S1E-003 step 2): evict at least budget bytes
across the shards, returning the bytes actually freed.
Trait Implementations§
Source§impl Reclaimable for Sharded<PageCache>
impl Reclaimable for Sharded<PageCache>
Source§fn evict_reclaimable(&self, budget: u64) -> u64
fn evict_reclaimable(&self, budget: u64) -> u64
Evict at least
budget bytes of reclaimable entries; returns the bytes
actually freed (fewer when less was reclaimable).Source§fn reclaimable_bytes(&self) -> u64
fn reclaimable_bytes(&self) -> u64
Bytes currently reclaimable.
Source§impl Reclaimable for Sharded<DecodedPageCache>
impl Reclaimable for Sharded<DecodedPageCache>
Source§fn evict_reclaimable(&self, budget: u64) -> u64
fn evict_reclaimable(&self, budget: u64) -> u64
Evict at least
budget bytes of reclaimable entries; returns the bytes
actually freed (fewer when less was reclaimable).Source§fn reclaimable_bytes(&self) -> u64
fn reclaimable_bytes(&self) -> u64
Bytes currently reclaimable.
Auto Trait Implementations§
impl<T> !Freeze for Sharded<T>
impl<T> !RefUnwindSafe for Sharded<T>
impl<T> Send for Sharded<T>where
T: Send,
impl<T> Sync for Sharded<T>where
T: Send,
impl<T> Unpin for Sharded<T>where
T: Unpin,
impl<T> UnsafeUnpin for Sharded<T>
impl<T> UnwindSafe for Sharded<T>where
T: UnwindSafe,
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> 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