Trait NetworkContext

Source
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§