Skip to main content

Provider

Trait Provider 

Source
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§

Source

type PublicKey: PublicKey

Public key type used to identify peers.

Required Methods§

Source

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.

Source

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.

Implementors§

Source§

impl<C: PublicKey> Provider for commonware_p2p::authenticated::discovery::Oracle<C>

Source§

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

Source§

impl<P: PublicKey> Provider for StaticProvider<P>

Source§

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

Source§

impl<P: PublicKey, E: Clock> Provider for SocketManager<P, E>