pub struct NodeFactsCache { /* private fields */ }Expand description
Verified node facts with TTL.
Implementations§
Source§impl NodeFactsCache
impl NodeFactsCache
Sourcepub fn insert(
&self,
signed: SignedNodeFacts,
trust_tier: TrustTier,
now: u64,
) -> Result<InsertOutcome, CacheError>
pub fn insert( &self, signed: SignedNodeFacts, trust_tier: TrustTier, now: u64, ) -> Result<InsertOutcome, CacheError>
Verify and cache a signed facts block with a receiver-assigned tier.
Sourcepub fn insert_remote(
&self,
signed: SignedNodeFacts,
mesh_tier: TrustTier,
max_provenance: Provenance,
origin: u64,
now: u64,
) -> Result<InsertOutcome, CacheError>
pub fn insert_remote( &self, signed: SignedNodeFacts, mesh_tier: TrustTier, max_provenance: Provenance, origin: u64, now: u64, ) -> Result<InsertOutcome, CacheError>
Self::insert for facts a peer sent. Every capability’s
provenance is capped at max_provenance in the cached copy: the
receiver did not probe or measure remote data, so a peer’s
measured claim is never held as measured. The signed envelope is
kept as received.
mesh_tier is derived from the connection that sent the facts and is
re-derived on every frame; a tier the operator set is kept. origin
names the connection (see Self::discovered_from). When the cache
is full, the oldest mesh-derived Discovered entry makes room before
the insert is refused, so Paired and Pinned entries are never
pushed out by Discovered ones.
Sourcepub fn discovered_from(&self, origin: u64, now: u64) -> usize
pub fn discovered_from(&self, origin: u64, now: u64) -> usize
Fresh mesh-derived Discovered entries that connection origin supplied.
Sourcepub fn demote_mesh_tier(&self, node_id: &str) -> bool
pub fn demote_mesh_tier(&self, node_id: &str) -> bool
Lower a mesh-derived tier to Discovered (the node’s admission was
revoked or its verified connection is gone). An operator-set tier is
left alone. True if the tier changed.
Sourcepub fn apply_delta(
&self,
signed: &SignedFactsDelta,
now: u64,
) -> Result<(), CacheError>
pub fn apply_delta( &self, signed: &SignedFactsDelta, now: u64, ) -> Result<(), CacheError>
Verify a signed delta and apply it to the cached base.
Sourcepub fn set_trust_tier(&self, node_id: &str, trust_tier: TrustTier) -> bool
pub fn set_trust_tier(&self, node_id: &str, trust_tier: TrustTier) -> bool
Re-assign the receiver-side trust tier of a held node (an operator changed it; the signed facts are unchanged). False if not held.
Sourcepub fn get(&self, node_id: &str, now: u64) -> Option<CachedNodeFacts>
pub fn get(&self, node_id: &str, now: u64) -> Option<CachedNodeFacts>
Fresh facts for one node.
Sourcepub fn list(&self, now: u64) -> Vec<CachedNodeFacts>
pub fn list(&self, now: u64) -> Vec<CachedNodeFacts>
All fresh facts, sorted by node id.
Sourcepub fn evict_expired(&self, now: u64) -> usize
pub fn evict_expired(&self, now: u64) -> usize
Drop expired entries; returns how many were removed.
Trait Implementations§
Source§impl Debug for NodeFactsCache
impl Debug for NodeFactsCache
Auto Trait Implementations§
impl !RefUnwindSafe for NodeFactsCache
impl Freeze for NodeFactsCache
impl Send for NodeFactsCache
impl Sync for NodeFactsCache
impl Unpin for NodeFactsCache
impl UnsafeUnpin for NodeFactsCache
impl UnwindSafe for NodeFactsCache
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