pub trait NetworkContext {
    // Required methods
    fn get_protocol(&self) -> ProtocolId;
    fn get_peer_connection_origin(&self, node_id: &NodeId) -> Option<bool>;
    fn send(
        &self,
        node_id: &NodeId,
        msg: Vec<u8>,
        min_protocol_version: ProtocolVersion,
        version_valid_till: ProtocolVersion,
        priority: SendQueuePriority
    ) -> Result<(), Error>;
    fn disconnect_peer(
        &self,
        node_id: &NodeId,
        op: Option<UpdateNodeOperation>,
        reason: &str
    );
    fn register_timer(
        &self,
        token: TimerToken,
        delay: Duration
    ) -> Result<(), Error>;
    fn dispatch_work(&self, work_type: HandlerWorkType);
    fn insert_peer_node_tag(&self, peer: NodeId, key: &str, value: &str);
    fn is_peer_self(&self, _node_id: &NodeId) -> bool;
    fn self_node_id(&self) -> NodeId;
}

Required Methods§

source

fn get_protocol(&self) -> ProtocolId

source

fn get_peer_connection_origin(&self, node_id: &NodeId) -> Option<bool>

source

fn send( &self, node_id: &NodeId, msg: Vec<u8>, min_protocol_version: ProtocolVersion, version_valid_till: ProtocolVersion, priority: SendQueuePriority ) -> Result<(), Error>

source

fn disconnect_peer( &self, node_id: &NodeId, op: Option<UpdateNodeOperation>, reason: &str )

source

fn register_timer( &self, token: TimerToken, delay: Duration ) -> Result<(), Error>

Register a new IO timer. ‘IoHandler::timeout’ will be called with the token.

source

fn dispatch_work(&self, work_type: HandlerWorkType)

source

fn insert_peer_node_tag(&self, peer: NodeId, key: &str, value: &str)

source

fn is_peer_self(&self, _node_id: &NodeId) -> bool

source

fn self_node_id(&self) -> NodeId

Implementors§