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<TrackedPeers<Self::PublicKey>>> + Send;
    fn subscribe(
        &mut self,
    ) -> impl Future<Output = PeerSetSubscription<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<TrackedPeers<Self::PublicKey>>> + Send

Fetch the primary and secondary peers tracked at the given ID.

Source

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

Subscribe to notifications when new peer sets are added.

Returns a receiver of PeerSetUpdate notifications. Each update’s latest reflects how Manager::track stored the set: a peer listed in both roles appears only under latest.primary. The all field aggregates across tracked sets with the same rule (secondary excludes keys present as primary).

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

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, E: Clock> Provider for Manager<P, E>

Source§

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

Source§

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