pub struct ReferenceRing { /* private fields */ }Expand description
Daemon-warm, actor-scoped recently-referenced ring.
Privacy is structural: rings are keyed by (namespace, actor) and a
snapshot for one actor never observes another actor’s entries, even
within the same namespace.
Implementations§
Source§impl ReferenceRing
impl ReferenceRing
pub fn new() -> Self
pub fn with_bounds(capacity: usize, ttl: Duration) -> Self
pub fn with_bounds_and_outer_limit( capacity: usize, ttl: Duration, max_outer_keys: usize, ) -> Self
Sourcepub fn admit(
&self,
namespace: &str,
actor: &str,
id: Uuid,
name: Option<String>,
)
pub fn admit( &self, namespace: &str, actor: &str, id: Uuid, name: Option<String>, )
Admit id into the (namespace, actor) ring, touching it to “now”.
Re-admitting an id already present moves it to the back (most-recent)
instead of duplicating the entry. Eviction is size-or-age, then the
outer map itself is pruned (see prune_outer_map) so it never grows
without bound.
Sourcepub fn snapshot(&self, namespace: &str, actor: &str) -> Vec<RingEntry>
pub fn snapshot(&self, namespace: &str, actor: &str) -> Vec<RingEntry>
Snapshot the live (non-stale) entries for (namespace, actor),
most-recently-touched first. Returns an empty vec for an unknown or
empty key: never an error, since a ring miss is always legitimate
(fresh session, restarted daemon, cross-actor query).
Also runs prune_outer_map over the whole outer map, not just the
queried key: otherwise a daemon that only ever reads (never admits)
would never prune any other actor’s stale key.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ReferenceRing
impl RefUnwindSafe for ReferenceRing
impl Send for ReferenceRing
impl Sync for ReferenceRing
impl Unpin for ReferenceRing
impl UnsafeUnpin for ReferenceRing
impl UnwindSafe for ReferenceRing
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