Manager

Trait Manager 

Source
pub trait Manager:
    Debug
    + Clone
    + Send
    + 'static {
    type PublicKey: PublicKey;
    type Peers;

    // Required methods
    fn update(
        &mut self,
        id: u64,
        peers: Self::Peers,
    ) -> impl Future<Output = ()> + Send;
    fn peer_set(
        &mut self,
        id: u64,
    ) -> impl Future<Output = Option<Ordered<Self::PublicKey>>> + Send;
    fn subscribe(
        &mut self,
    ) -> impl Future<Output = UnboundedReceiver<(u64, Ordered<Self::PublicKey>, Ordered<Self::PublicKey>)>> + Send;
}
Expand description

Interface for registering new peer sets as well as fetching an ordered list of connected peers, given a set id.

Required Associated Types§

Source

type PublicKey: PublicKey

Public key type used to identify peers.

Source

type Peers

The type for the peer set in registration.

Required Methods§

Source

fn update( &mut self, id: u64, peers: Self::Peers, ) -> impl Future<Output = ()> + Send

Update the peer set.

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 registered.

Source

fn peer_set( &mut self, id: u64, ) -> impl Future<Output = Option<Ordered<Self::PublicKey>>> + Send

Fetch the ordered set of peers for a given ID.

Source

fn subscribe( &mut self, ) -> impl Future<Output = UnboundedReceiver<(u64, Ordered<Self::PublicKey>, Ordered<Self::PublicKey>)>> + Send

Subscribe to notifications when new peer sets are added.

Returns a receiver that will receive the peer set ID whenever a new peer set is registered via update.

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 commonware_p2p::authenticated::discovery::Oracle<C>

Source§

impl<C: PublicKey> Manager for commonware_p2p::authenticated::lookup::Oracle<C>

Source§

impl<P: PublicKey> Manager for commonware_p2p::simulated::Oracle<P>