Trait chain_network::core::server::FragmentService
source · pub trait FragmentService {
type GetFragmentsStream: Stream<Item = Result<Fragment, Error>> + Send + Sync;
type SubscriptionStream: Stream<Item = Result<Fragment, Error>> + Send + Sync;
// Required methods
fn get_fragments<'life0, 'async_trait>(
&'life0 self,
ids: FragmentIds
) -> Pin<Box<dyn Future<Output = Result<Self::GetFragmentsStream, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn fragment_subscription<'life0, 'async_trait>(
&'life0 self,
subscriber: Peer,
stream: PushStream<Fragment>
) -> 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 fragments that make up a future block.
Required Associated Types§
Required Methods§
sourcefn get_fragments<'life0, 'async_trait>(
&'life0 self,
ids: FragmentIds
) -> Pin<Box<dyn Future<Output = Result<Self::GetFragmentsStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_fragments<'life0, 'async_trait>( &'life0 self, ids: FragmentIds ) -> Pin<Box<dyn Future<Output = Result<Self::GetFragmentsStream, Error>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Serves a request to retrieve blocks identified by the list of ids
Resloves to a stream of blocks to send to the remote client peer.
sourcefn fragment_subscription<'life0, 'async_trait>(
&'life0 self,
subscriber: Peer,
stream: PushStream<Fragment>
) -> Pin<Box<dyn Future<Output = Result<Self::SubscriptionStream, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn fragment_subscription<'life0, 'async_trait>( &'life0 self, subscriber: Peer, stream: PushStream<Fragment> ) -> 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.