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§
Required Methods§
Sourcefn update(
&mut self,
id: u64,
peers: Self::Peers,
) -> impl Future<Output = ()> + Send
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.
Sourcefn peer_set(
&mut self,
id: u64,
) -> impl Future<Output = Option<Ordered<Self::PublicKey>>> + Send
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.
Sourcefn subscribe(
&mut self,
) -> impl Future<Output = UnboundedReceiver<(u64, Ordered<Self::PublicKey>, Ordered<Self::PublicKey>)>> + Send
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.