pub struct HeartbeatSender { /* private fields */ }Expand description
In-memory heartbeat-sender state.
Implementations§
Source§impl HeartbeatSender
impl HeartbeatSender
pub fn new(interval: Duration) -> Arc<Self> ⓘ
pub fn interval(&self) -> Duration
pub fn remove_peer(&self, addr: &Address)
pub fn peer_count(&self) -> usize
Sourcepub fn due_peers(&self, now: Instant) -> Vec<Address>
pub fn due_peers(&self, now: Instant) -> Vec<Address>
Run one tick — return the addresses whose last_tick is older
than interval. The caller emits a heartbeat PDU to each and
then calls Self::record_tick.
Sourcepub fn record_tick(&self, addr: &Address, now: Instant)
pub fn record_tick(&self, addr: &Address, now: Instant)
Bump the per-peer last-tick to now and increment the
counter. No-op if the peer is unknown.
Sourcepub fn ticks_per_peer(&self) -> Vec<(String, u64)>
pub fn ticks_per_peer(&self) -> Vec<(String, u64)>
Snapshot of (peer-address-string, ticks-emitted).
Trait Implementations§
Source§impl Default for HeartbeatSender
impl Default for HeartbeatSender
Source§fn default() -> HeartbeatSender
fn default() -> HeartbeatSender
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for HeartbeatSender
impl !RefUnwindSafe for HeartbeatSender
impl Send for HeartbeatSender
impl Sync for HeartbeatSender
impl Unpin for HeartbeatSender
impl UnsafeUnpin for HeartbeatSender
impl UnwindSafe for HeartbeatSender
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