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

Required Methods§

source

fn get_protocol(&self) -> [u8; 3]

source

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

source

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

source

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

source

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

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

source

fn dispatch_work(&self, work_type: u8)

source

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

source

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

source

fn self_node_id(&self) -> H512

Implementors§