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§

source

type GetFragmentsStream: Stream<Item = Result<Fragment, Error>> + Send + Sync

The type of an asynchronous stream that provides blocks in response to get_fragments method.

source

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

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

Required Methods§

source

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.

source

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.

Implementors§