pub trait CommunicationService: Send + Sync {
    type Message: Clone;

    // Required methods
    fn prepare_block_request(start: u32, end: u32) -> Self::Message;
    fn send<'life0, 'async_trait>(
        &'life0 self,
        peer_ip: SocketAddr,
        message: Self::Message,
    ) -> Pin<Box<dyn Future<Output = Option<Receiver<Result<()>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}

Required Associated Types§

source

type Message: Clone

The message type.

Required Methods§

source

fn prepare_block_request(start: u32, end: u32) -> Self::Message

Prepares a block request to be sent.

source

fn send<'life0, 'async_trait>( &'life0 self, peer_ip: SocketAddr, message: Self::Message, ) -> Pin<Box<dyn Future<Output = Option<Receiver<Result<()>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Sends the given message to specified peer.

This function returns as soon as the message is queued to be sent, without waiting for the actual delivery; instead, the caller is provided with a oneshot::Receiver which can be used to determine when and whether the message has been delivered.

Object Safety§

This trait is not object safe.

Implementors§