Trait chain_network::core::server::gossip::GossipService
source · 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§
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,
sourcefn 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,
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.