pub struct EvictionCandidates(/* private fields */);Expand description
Snapshot of access times for blobs that are eligible for LRU
eviction — i.e. pinned hashes are already excluded. Returned by
CacheEngine::eviction_candidates.
The one carve-out is a deny-listed hash: it stays a candidate even when pinned (“deny wins over pin”), so the space path reclaims an unservable blob instead of holding it on disk.
The newtype makes “pinned-already-excluded” a type-level property:
any future eviction-policy implementation that takes
EvictionCandidates is guaranteed by the compiler not to evict
pinned hashes. With a raw HashMap<Hash, Instant> return that
guarantee would live only in a doc comment, and a future caller
could substitute CacheEngine::access_times_snapshot (which
includes pinned) by mistake.
Implementations§
Source§impl EvictionCandidates
impl EvictionCandidates
Sourcepub fn contains_key(&self, hash: &Hash) -> bool
pub fn contains_key(&self, hash: &Hash) -> bool
Does hash appear in the candidate set?
Sourcepub fn into_inner(self) -> HashMap<Hash, Instant>
pub fn into_inner(self) -> HashMap<Hash, Instant>
Consume into the underlying HashMap. Eviction policies that
need to sort by access time and pop top-K can call this once at
the start of their loop. The newtype’s invariant
(pinned-already-excluded) is preserved by the time this returns
— the caller just gets a plain map to work with.
Trait Implementations§
Source§impl Debug for EvictionCandidates
impl Debug for EvictionCandidates
Source§impl Default for EvictionCandidates
impl Default for EvictionCandidates
Source§impl<'a> IntoIterator for &'a EvictionCandidates
impl<'a> IntoIterator for &'a EvictionCandidates
Auto Trait Implementations§
impl Freeze for EvictionCandidates
impl RefUnwindSafe for EvictionCandidates
impl Send for EvictionCandidates
impl Sync for EvictionCandidates
impl Unpin for EvictionCandidates
impl UnsafeUnpin for EvictionCandidates
impl UnwindSafe for EvictionCandidates
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