Network

Trait Network 

Source
pub trait Network:
    Send
    + Sync
    + 'static {
    type ListenStream: Stream<Item = Result<Message, Status>> + Send + 'static;

    // Required methods
    fn listen<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Null>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ListenStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn broadcast<'life0, 'async_trait>(
        &'life0 self,
        request: Request<BroadcastMessage>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Null>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn propagate<'life0, 'async_trait>(
        &'life0 self,
        request: Request<PropagateMessage>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Null>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send<'life0, 'async_trait>(
        &'life0 self,
        request: Request<SendMessage>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Null>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn alive_nodes<'life0, 'async_trait>(
        &'life0 self,
        request: Request<AliveNodesRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<AliveNodesResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with NetworkServer.

Required Associated Types§

Source

type ListenStream: Stream<Item = Result<Message, Status>> + Send + 'static

Server streaming response type for the Listen method.

Required Methods§

Source

fn listen<'life0, 'async_trait>( &'life0 self, request: Request<Null>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ListenStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Receive messages coming from the network

Source

fn broadcast<'life0, 'async_trait>( &'life0 self, request: Request<BroadcastMessage>, ) -> Pin<Box<dyn Future<Output = Result<Response<Null>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Broadcast a message to the network

Source

fn propagate<'life0, 'async_trait>( &'life0 self, request: Request<PropagateMessage>, ) -> Pin<Box<dyn Future<Output = Result<Response<Null>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Propagate a message to the network and notify current receivers

Source

fn send<'life0, 'async_trait>( &'life0 self, request: Request<SendMessage>, ) -> Pin<Box<dyn Future<Output = Result<Response<Null>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Send a message to a specific target in the network

Source

fn alive_nodes<'life0, 'async_trait>( &'life0 self, request: Request<AliveNodesRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<AliveNodesResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Retrieve network nodes considered alive

Implementors§