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§
Required Methods§
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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 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
Sourcefn 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,
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