Trait nakamoto_net::Service
source · pub trait Service<Id: PeerId = SocketAddr>: StateMachine<Id, Message = [u8]> {
type Command;
fn command_received(&mut self, cmd: Self::Command);
}
Expand description
A network service.
Network protocols must implement this trait to be drivable by the reactor.
Required Associated Types
sourcetype Command
type Command
Commands handled by the service. These commands should originate from an
external “user” thread. They are passed through the reactor via a channel
given to Reactor::run
. The reactor calls Service::command_received
on the service for each command received.
Required Methods
sourcefn command_received(&mut self, cmd: Self::Command)
fn command_received(&mut self, cmd: Self::Command)
An external command has been received.