Trait network::NetworkContext
source · 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§
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 )
sourcefn register_timer(
&self,
token: TimerToken,
delay: Duration
) -> Result<(), Error>
fn register_timer( &self, token: TimerToken, delay: Duration ) -> Result<(), Error>
Register a new IO timer. ‘IoHandler::timeout’ will be called with the token.