pub struct MonitorCore { /* private fields */ }Expand description
The monitor’s shareable core: ingest on one side, events + snapshots on
the other. Session wiring lives in Monitor; the core is pure and
deterministically testable.
Implementations§
Source§impl MonitorCore
impl MonitorCore
pub fn new(capacity: usize) -> Arc<MonitorCore> ⓘ
Sourcepub fn bounded(capacity: usize, max_keys: usize) -> Arc<MonitorCore> ⓘ
pub fn bounded(capacity: usize, max_keys: usize) -> Arc<MonitorCore> ⓘ
A core whose statistics table is bounded at max_keys distinct keys.
Sourcepub fn ingest(&self, view: SampleView, sn: Option<u32>)
pub fn ingest(&self, view: SampleView, sn: Option<u32>)
Ingest one sample: stats update + broadcast. Hot path — one lock, no tree work (that happens on the tick).
pub fn node_event(&self, key: String, up: bool)
Sourcepub fn tree(&self) -> Arc<KeyTreeSnapshot> ⓘ
pub fn tree(&self) -> Arc<KeyTreeSnapshot> ⓘ
The latest immutable snapshot (lock-free pull).
Sourcepub fn with_stats<R>(&self, f: impl FnOnce(&StatsTable) -> R) -> R
pub fn with_stats<R>(&self, f: impl FnOnce(&StatsTable) -> R) -> R
Read access to the raw stats (hz/bw commands).
Sourcepub fn with_stats_mut<R>(&self, f: impl FnOnce(&mut StatsTable) -> R) -> R
pub fn with_stats_mut<R>(&self, f: impl FnOnce(&mut StatsTable) -> R) -> R
Mutable access — watch retirement and tests.
Sourcepub fn keys_unwatched(&self) -> u64
pub fn keys_unwatched(&self) -> u64
Keys retired from the table because their watch was released
(RFC 09 §5.1 O6 — see crate::stats::StatsTable::unwatched).
Sourcepub fn keys_evicted(&self) -> u64
pub fn keys_evicted(&self) -> u64
Distinct keys dropped from the statistics table to stay within its bound. Non-zero means the key set on display is partial — report it rather than letting a shrinking tree read as a quieting bus (RFC 09 §5.1).
Sourcepub fn events(self: &Arc<Self>) -> EventStream
pub fn events(self: &Arc<Self>) -> EventStream
Subscribe to the event stream.
Auto Trait Implementations§
impl !Freeze for MonitorCore
impl !RefUnwindSafe for MonitorCore
impl !UnwindSafe for MonitorCore
impl Send for MonitorCore
impl Sync for MonitorCore
impl Unpin for MonitorCore
impl UnsafeUnpin for MonitorCore
Blanket Implementations§
Source§impl<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> 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