Skip to main content

PeerControlSink

Trait PeerControlSink 

Source
pub trait PeerControlSink:
    Send
    + Sync
    + 'static {
    // Required method
    fn on_peer_control(
        &self,
        ctx: &PeerCtx,
        conn: u64,
        payload: &Value,
    ) -> Vec<Value>;
}
Expand description

Receiver of a runtime control topic (one of CONTROL_TOPICS).

The sink decides what to trust: it is handed the connection’s authenticated identity (PeerCtx) and returns payloads to send back to the same peer (for example a re-send request).

Required Methods§

Source

fn on_peer_control( &self, ctx: &PeerCtx, conn: u64, payload: &Value, ) -> Vec<Value>

Handle one control payload from ctx.peer_id; return replies.

conn identifies the connection the frame arrived on (0 when the caller has none): one connection can claim many source ids while unverified, so per-connection limits key on this, not on ctx.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§