pub trait Provider:
Debug
+ Clone
+ Send
+ 'static {
type PublicKey: PublicKey;
// Required methods
fn peer_set(
&mut self,
id: u64,
) -> impl Future<Output = Option<Set<Self::PublicKey>>> + Send;
fn subscribe(
&mut self,
) -> impl Future<Output = UnboundedReceiver<(u64, Set<Self::PublicKey>, Set<Self::PublicKey>)>> + Send;
}Expand description
Interface for reading peer set information.
Required Associated Types§
Required Methods§
Sourcefn peer_set(
&mut self,
id: u64,
) -> impl Future<Output = Option<Set<Self::PublicKey>>> + Send
fn peer_set( &mut self, id: u64, ) -> impl Future<Output = Option<Set<Self::PublicKey>>> + Send
Fetch the ordered set of peers for a given ID.
Sourcefn subscribe(
&mut self,
) -> impl Future<Output = UnboundedReceiver<(u64, Set<Self::PublicKey>, Set<Self::PublicKey>)>> + Send
fn subscribe( &mut self, ) -> impl Future<Output = UnboundedReceiver<(u64, Set<Self::PublicKey>, Set<Self::PublicKey>)>> + Send
Subscribe to notifications when new peer sets are added.
Returns a receiver that will receive tuples of:
- The peer set ID
- The peers in the new set
- All currently tracked peers (union of recent peer sets)
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.