pub trait GossipService {
    type SubscriptionStream: Stream<Item = Result<Gossip, Error>> + Send + Sync;

    // Required methods
    fn peers<'life0, 'async_trait>(
        &'life0 self,
        limit: u32
    ) -> Pin<Box<dyn Future<Output = Result<Gossip, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn gossip_subscription<'life0, 'async_trait>(
        &'life0 self,
        subscriber: Peer,
        stream: PushStream<Gossip>
    ) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Interface for the blockchain node service implementation responsible for exchanging P2P network gossip.

Required Associated Types§

source

type SubscriptionStream: Stream<Item = Result<Gossip, Error>> + Send + Sync

The type of outbound asynchronous streams returned by the subscription method.

Required Methods§

source

fn peers<'life0, 'async_trait>( &'life0 self, limit: u32 ) -> Pin<Box<dyn Future<Output = Result<Gossip, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

source

fn gossip_subscription<'life0, 'async_trait>( &'life0 self, subscriber: Peer, stream: PushStream<Gossip> ) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Called by the protocol implementation to establish a bidirectional subscription stream. The inbound stream is passed to the asynchronous method, which resolves to the outbound stream.

Implementors§