pub struct NodeStatsTracker { /* private fields */ }Expand description
Helper for tracking and throttling node statistics updates. Automatically sends updates every 10 seconds or 1000 packets.
Implementations§
Source§impl NodeStatsTracker
impl NodeStatsTracker
Sourcepub fn new(node_id: String, stats_tx: Option<Sender<NodeStatsUpdate>>) -> Self
pub fn new(node_id: String, stats_tx: Option<Sender<NodeStatsUpdate>>) -> Self
Create a new stats tracker for a node
Sourcepub const fn received_n(&mut self, count: u64)
pub const fn received_n(&mut self, count: u64)
Record multiple received packets (for batched stats reporting)
Sourcepub fn maybe_send(&mut self)
pub fn maybe_send(&mut self)
Automatically send stats if threshold is met (every 10s or 1000 packets). Call this after processing a batch of packets.
Sourcepub fn force_send(&mut self)
pub fn force_send(&mut self)
Force send stats immediately (useful for final updates)
Auto Trait Implementations§
impl Freeze for NodeStatsTracker
impl RefUnwindSafe for NodeStatsTracker
impl Send for NodeStatsTracker
impl Sync for NodeStatsTracker
impl Unpin for NodeStatsTracker
impl UnwindSafe for NodeStatsTracker
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