pub struct DockSnapshotCache {
inner: Mutex<HashMap<String, HashMap<String, DockNodeSnapshot>>>,
}Fields§
§inner: Mutex<HashMap<String, HashMap<String, DockNodeSnapshot>>>Implementations§
Source§impl DockSnapshotCache
impl DockSnapshotCache
pub fn new() -> Self
Sourcepub fn push_delta(&self, block_id: &str, node: DockNodeSnapshot)
pub fn push_delta(&self, block_id: &str, node: DockNodeSnapshot)
Record (or overwrite) one node’s latest status for block_id.
Sourcepub fn get(&self, block_id: &str, now_ms: i64) -> Vec<DockNodeSnapshot>
pub fn get(&self, block_id: &str, now_ms: i64) -> Vec<DockNodeSnapshot>
All tracked nodes for block_id younger than MAX_NODE_AGE_MS as
of now_ms, or empty if none/unknown block. Lazily evicts anything
older as a side effect — no background sweep needed, and every read
self-heals the cache instead of accumulating stale entries forever.
Sourcepub fn has_node(&self, block_id: &str, node_id: &str) -> bool
pub fn has_node(&self, block_id: &str, node_id: &str) -> bool
Whether node_id is currently tracked for block_id — used to
validate a dock clear request before publishing the clear event,
so muxspect can distinguish “cleared” from “no such node.”
Sourcepub fn remove_node(&self, block_id: &str, node_id: &str)
pub fn remove_node(&self, block_id: &str, node_id: &str)
Drop a node from the cache — called once a dock clear has been
published, so a subsequent dock read doesn’t keep showing a node
that was just cleared (the clearing renderer flips it to
"canceled" locally, but this cache has no way to observe that
without another push; removing it here is simpler and correct
either way — a canceled node isn’t “stuck” and doesn’t need to
keep appearing in diagnosis output).
Sourcepub fn evict_block(&self, block_id: &str)
pub fn evict_block(&self, block_id: &str)
Drop every tracked node for block_id — for wiring into block
deletion, so the cache doesn’t accumulate entries for blocks that
no longer exist (open question §6.3 of the spec). Not wired to a
call site yet — deleting a block is a small footprint (a handful
of node entries) relative to the cache’s overall size, so this is
a nice-to-have bound, not a correctness requirement; wiring it up
is a follow-up once the block-deletion path is touched for other
reasons, same as ScrubOrphanedInProgress’s own standalone command
existing with zero live dispatch call sites today.
Trait Implementations§
Source§impl Default for DockSnapshotCache
impl Default for DockSnapshotCache
Source§fn default() -> DockSnapshotCache
fn default() -> DockSnapshotCache
Auto Trait Implementations§
impl !Freeze for DockSnapshotCache
impl !RefUnwindSafe for DockSnapshotCache
impl Send for DockSnapshotCache
impl Sync for DockSnapshotCache
impl Unpin for DockSnapshotCache
impl UnsafeUnpin for DockSnapshotCache
impl UnwindSafe for DockSnapshotCache
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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