Skip to main content

EvictionPreview

Struct EvictionPreview 

Source
pub struct EvictionPreview {
    pub size_bytes: Option<u64>,
    pub last_accessed_us_ago: Option<u64>,
    pub pinned: bool,
    pub already_evicted: bool,
    pub served: bool,
    pub origin_kinds: Vec<OriginKind>,
}
Expand description

Read-only snapshot of a hash’s local-cache state, returned by CacheEngine::inspect. Backs decdn node evict --dry-run (issue #379): operators running DMCA takedowns want to confirm the blob’s size, last-access time, pin status, and already-evicted flag before mutating state.

All fields reflect the underlying cache state — size_bytes reads from the iroh-blobs store directly, so a hash that has already been logically evicted (and whose bytes are still on disk pending the follow-up GC sweep in #518) still reports its size here. That keeps dry-run honest about disk reclaim potential rather than hiding it once the operator has flipped the evicted flag. For a complete blob the size is its byte length; for a partial blob it is the validated total (see Self::size_bytes), and CacheEngine::size_snapshot gives the bytes it holds on disk.

Fields§

§size_bytes: Option<u64>

Bytes the iroh-blobs store reports for this hash. None when the blob isn’t in the store; matches BlobStatus::NotFound. A partial blob reports BlobStatus::Partial { size } as is: the whole blob’s size once its last chunk validates, None before. That is the blob’s total, not the bytes it holds on disk — the delivery path signs it as the blob’s total and the probe path advertises it, and CacheEngine::size_snapshot is the on-disk measure.

§last_accessed_us_ago: Option<u64>

Microseconds elapsed since the last recorded access to the blob: a serve, a hit, or a fill. None when the blob has had no access since open — including a blob on disk at open that nothing has touched since (its open-time recency seed is not an access) — or when eviction or quarantine has cleared its entry.

§pinned: bool

Whether the hash is in the operator-pinned set (#276). Pinning protects against LRU eviction but not against an explicit CacheEngine::evict; surfaced here so a dry-run operator can spot the case before running the takedown.

§already_evicted: bool

Whether the hash already lives in <cache_dir>/evicted.log. true means a real CacheEngine::evict would short-circuit at the idempotency guard at the top of evict() — the dry-run is reporting on a no-op.

§served: bool

Whether CacheEngine::has would currently return true for this hash — equivalently, BlobStatus::Complete and not already evicted. Pre-computed inside inspect() so the admin RPC doesn’t need a second has() round-trip to fill the was_present field on its response.

§origin_kinds: Vec<OriginKind>

Ordered list of backend kinds the engine would consult on a post-eviction miss (#439, #284). Empty when no origin is configured (cache-only mode); otherwise one OriginKind per entry of the operator-supplied fallback chain, in order. Operators running takedowns or LRU sweeps use this to estimate the worst-case origin egress cost — re-pulling from a Filesystem origin is a local read; re-pulling from Http or S3 may consume metered bandwidth, and a chain of three S3 origins multiplies the bill on a deep fallback.

Trait Implementations§

Source§

impl Clone for EvictionPreview

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for EvictionPreview

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EvictionPreview

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for EvictionPreview

Source§

impl PartialEq for EvictionPreview

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for EvictionPreview

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more