Trait nakamoto_net::Reactor

source ·
pub trait Reactor<Id: PeerId = SocketAddr> {
    type Waker: Waker;

    fn new(
        shutdown: Receiver<()>,
        listening: Sender<SocketAddr>
    ) -> Result<Self, Error>
    where
        Self: Sized
; fn run<S, E>(
        &mut self,
        listen_addrs: &[SocketAddr],
        service: S,
        publisher: E,
        commands: Receiver<S::Command>
    ) -> Result<(), Error>
    where
        S: Service<Id>,
        S::DisconnectReason: Into<Disconnect<S::DisconnectReason>>,
        E: Publisher<S::Event>
; fn waker(&self) -> Self::Waker; }
Expand description

Any network reactor that can drive the light-client service.

Required Associated Types

The type of waker this reactor uses.

Required Methods

Create a new reactor, initializing it with a publisher for service events, a channel to receive commands, and a channel to shut it down.

Run the given service with the reactor.

Takes:

Return a new waker.

The reactor can provide multiple wakers such that multiple user threads may wake the event loop.

Implementors