Skip to main content

Manager

Trait Manager 

Source
pub trait Manager: Provider {
    // Required method
    fn track<R>(&mut self, id: u64, peers: R) -> impl Future<Output = ()> + Send
       where R: Into<TrackedPeers<Self::PublicKey>> + Send;
}
Expand description

Interface for managing peer set membership (where peer addresses are not known).

Required Methods§

Source

fn track<R>(&mut self, id: u64, peers: R) -> impl Future<Output = ()> + Send
where R: Into<TrackedPeers<Self::PublicKey>> + Send,

Track a primary and secondary peer set with the given ID.

The peer set ID passed to this function should be strictly managed, ideally matching the epoch of the consensus engine. It must be monotonically increasing as new peer sets are tracked.

For good connectivity, all peers must track the same peer sets at the same ID.

Callers may pass either a list of primary peers or a TrackedPeers value containing both primary and secondary peers.

Overlapping keys in TrackedPeers are allowed; they are deduplicated as primary only.

§Active Peers

The most recently registered peer set (highest ID) is considered the active set. Implementations use the active set to decide which peers to maintain connections with and which to disconnect from.

§Primary vs Secondary Peers

In p2p networks, there are often two tiers of peers: ones that help “drive progress” and ones that want to “follow that progress” (but not contribute to it). We call the former “primary” and the latter “secondary”. When both are tracked, mechanisms favor “primary” peers but continue to replicate data to “secondary” peers ( often both gossiping data to them and answering requests from them).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<C: PublicKey> Manager for Oracle<C>

Source§

impl<P: PublicKey, E: Clock> Manager for Manager<P, E>