pub struct VerifiedCache { /* private fields */ }Expand description
LRU cache for verified XorName values.
This cache stores XorName values that have been verified to exist on the
autonomi network, avoiding repeated network queries for the same data.
Each entry records which fresh proof verification level inserted it. A paid-list entry must not satisfy a later client-PUT fast-path because paid-list admission does not authorize storing the actual chunk. Stronger entries satisfy weaker lookups.
Implementations§
Source§impl VerifiedCache
impl VerifiedCache
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a new cache with the specified capacity.
If capacity is 0, defaults to 1.
Sourcepub fn contains(&self, xorname: &XorName) -> bool
pub fn contains(&self, xorname: &XorName) -> bool
Check if a XorName is in the cache (verified under any fresh check set).
Returns true if the XorName is cached (verified to exist on autonomi).
Paid-list and client-PUT lookups must use their stricter helpers.
Sourcepub fn contains_paid_list_verified(&self, xorname: &XorName) -> bool
pub fn contains_paid_list_verified(&self, xorname: &XorName) -> bool
Check if a XorName is cached AND its verification ran at least the
paid-list admission check set.
A client-PUT entry returns true here because it passed the stricter
store-admission path at the caller.
Sourcepub fn contains_client_put_verified(&self, xorname: &XorName) -> bool
pub fn contains_client_put_verified(&self, xorname: &XorName) -> bool
Check if a XorName is cached AND its verification ran the full
client-PUT store-admission check set.
Paid-list entries return false here because they did not pass the
client-PUT store-admission path.
Sourcepub fn insert(&self, xorname: XorName)
pub fn insert(&self, xorname: XorName)
Add a XorName verified under the full client-PUT check set.
This should be called after verifying that data exists on the autonomi network. Also upgrades an existing paid-list-verified entry.
Sourcepub fn insert_paid_list_verified(&self, xorname: XorName)
pub fn insert_paid_list_verified(&self, xorname: XorName)
Add a XorName verified under paid-list admission checks.
Never downgrades an existing client-PUT-verified entry.
Sourcepub fn stats(&self) -> CacheStats
pub fn stats(&self) -> CacheStats
Get current cache statistics.
Trait Implementations§
Source§impl Clone for VerifiedCache
impl Clone for VerifiedCache
Source§fn clone(&self) -> VerifiedCache
fn clone(&self) -> VerifiedCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for VerifiedCache
impl !UnwindSafe for VerifiedCache
impl Freeze for VerifiedCache
impl Send for VerifiedCache
impl Sync for VerifiedCache
impl Unpin for VerifiedCache
impl UnsafeUnpin for VerifiedCache
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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