Skip to main content

MultiPeerBackend

Trait MultiPeerBackend 

Source
pub trait MultiPeerBackend: SocketBackend {
    // Required methods
    fn peer_connected<R, W>(
        self: Arc<Self>,
        peer_id: &PeerIdentity,
        io: FramedIo<R, W>,
        endpoint: Option<Endpoint>,
    ) -> impl Future<Output = ()> + Send
       where R: Stream<Item = Result<Message, CodecError>> + Unpin + Send + 'static,
             W: Sink<Message, Error = CodecError> + Unpin + Send + IntoEngineWriter + 'static,
             W::Writer: Send + 'static;
    fn peer_connected_inproc(
        self: Arc<Self>,
        peer_id: &PeerIdentity,
        peer: InprocPeer,
        endpoint: Option<Endpoint>,
    ) -> impl Future<Output = ZmqResult<()>> + Send;
    fn peer_disconnected(&self, peer_id: &PeerIdentity);

    // Provided method
    fn on_reconnect(&self, _peer_id: &PeerIdentity) { ... }
}
Expand description

Backend trait for sockets that manage multiple peer connections.

Required Methods§

Source

fn peer_connected<R, W>( self: Arc<Self>, peer_id: &PeerIdentity, io: FramedIo<R, W>, endpoint: Option<Endpoint>, ) -> impl Future<Output = ()> + Send
where R: Stream<Item = Result<Message, CodecError>> + Unpin + Send + 'static, W: Sink<Message, Error = CodecError> + Unpin + Send + IntoEngineWriter + 'static, W::Writer: Send + 'static,

Source

fn peer_connected_inproc( self: Arc<Self>, peer_id: &PeerIdentity, peer: InprocPeer, endpoint: Option<Endpoint>, ) -> impl Future<Output = ZmqResult<()>> + Send

Source

fn peer_disconnected(&self, peer_id: &PeerIdentity)

Provided Methods§

Source

fn on_reconnect(&self, _peer_id: &PeerIdentity)

Hook fired by the reconnect task after a successful reconnect. Default no-op. SUB overrides it to deliver hiccup_msg via the inbound channel. Not called on the first connect.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§