pub struct Consumer { /* private fields */ }Expand description
Reads one published stats broadcast (a <prefix>/node/<node> announce),
yielding typed frames per track.
Subscribe to the traffic and session tracks you care about with
Self::traffic / Self::sessions; a track that the producer never
created (e.g. a named tier that saw no traffic) fails to subscribe or ends
immediately, so callers typically subscribe the tiers they know exist.
Implementations§
Source§impl Consumer
impl Consumer
Sourcepub fn new(broadcast: Consumer, config: ConsumerConfig) -> Self
pub fn new(broadcast: Consumer, config: ConsumerConfig) -> Self
Wrap a stats broadcast. The broadcast is whatever the announce at a
stats path resolved to; parse the path with crate::parse_node_path.
Sourcepub async fn traffic(&self, tier: &Tier, role: Role) -> Result<TrafficConsumer>
pub async fn traffic(&self, tier: &Tier, role: Role) -> Result<TrafficConsumer>
Subscribe to the traffic track for (tier, role), awaiting the
subscription handshake.
Sourcepub async fn sessions(&self, tier: &Tier) -> Result<SessionsConsumer>
pub async fn sessions(&self, tier: &Tier) -> Result<SessionsConsumer>
Subscribe to the sessions track for tier, awaiting the subscription
handshake.
Auto Trait Implementations§
impl Freeze for Consumer
impl RefUnwindSafe for Consumer
impl Send for Consumer
impl Sync for Consumer
impl Unpin for Consumer
impl UnsafeUnpin for Consumer
impl UnwindSafe for Consumer
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
Mutably borrows from an owned value. Read more