Skip to main content

Module peer_availability

Module peer_availability 

Source
Expand description

This guardian’s view of its peers’ availability.

A peer counts as available in a 1-minute slot if it sent us any AlephBFT message in it. Every running peer sends consensus traffic while the federation is active, including a slow one that lags behind and still runs an older session, while an offline or frozen peer, or one whose consensus is stuck, sends nothing. A slot in which we heard from fewer than threshold - 1 peers means the federation was idle, or we were down or cut off ourselves, so it does not count.

PeerActivity counts slots in memory; persist_peer_availability folds them every 10 minutes into exponential moving averages with the time constants in PEER_AVAILABILITY_WINDOWS_SECS, persisted as PeerAvailabilityState.

Structs§

Average 🔒
An f64 stored by its bits, so the averages survive restarts exactly.
ObservedActivity
What PeerActivity observed since it was last taken.
PeerActivity
Slots of consensus traffic per peer since the last PeerActivity::take.
PeerAvailabilityState
Moving averages of each peer’s availability, one per window.

Constants§

SLOT_SECS 🔒

Functions§

persist_peer_availability
Folds the PeerActivity into the persisted PeerAvailabilityState every 10 minutes, or every 10 seconds in tests. A restart loses at most one interval of activity.
to_bps 🔒