Trait swarm_nl::core::EventHandler

source ·
pub trait EventHandler {
Show 26 methods // Required methods fn rpc_incoming_message_handled( &mut self, data: Vec<Vec<u8>> ) -> Vec<Vec<u8>>; fn gossipsub_incoming_message_handled( &mut self, _source: PeerId, _data: Vec<String> ); // Provided methods fn new_listen_addr( &mut self, _local_peer_id: PeerId, _listener_id: ListenerId, _addr: Multiaddr ) { ... } fn routing_table_updated(&mut self, _peer_id: PeerId) { ... } fn connection_established( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: NonZeroU32, _established_in: Duration ) { ... } fn connection_closed( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: u32, _cause: Option<ConnectionError> ) { ... } fn expired_listen_addr( &mut self, _listener_id: ListenerId, _address: Multiaddr ) { ... } fn listener_closed( &mut self, _listener_id: ListenerId, _addresses: Vec<Multiaddr> ) { ... } fn listener_error(&mut self, _listener_id: ListenerId) { ... } fn dialing( &mut self, _peer_id: Option<PeerId>, _connection_id: ConnectionId ) { ... } fn new_external_addr_candidate(&mut self, _address: Multiaddr) { ... } fn external_addr_confirmed(&mut self, _address: Multiaddr) { ... } fn external_addr_expired(&mut self, _address: Multiaddr) { ... } fn incoming_connection( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr ) { ... } fn incoming_connection_error( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr ) { ... } fn outgoing_connection_error( &mut self, _connection_id: ConnectionId, _peer_id: Option<PeerId> ) { ... } fn outbound_ping_success(&mut self, _peer_id: PeerId, _duration: Duration) { ... } fn outbound_ping_error(&mut self, _peer_id: PeerId, _err_type: Failure) { ... } fn identify_info_recieved(&mut self, _peer_id: PeerId, _info: Info) { ... } fn kademlia_put_record_success(&mut self, _key: Vec<u8>) { ... } fn kademlia_put_record_error(&mut self) { ... } fn kademlia_start_providing_success(&mut self, _key: Vec<u8>) { ... } fn kademlia_start_providing_error(&mut self) { ... } fn gossipsub_unsubscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String ) { ... } fn gossipsub_subscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String ) { ... } fn gossipsub_incoming_message_filtered( &mut self, _propagation_source: PeerId, _message_id: MessageId, _source: Option<PeerId>, _topic: String, _data: Vec<String> ) -> bool { ... }
}
Expand description

The high level trait that provides an interface for the application layer to respond to network events.

Required Methods§

source

fn rpc_incoming_message_handled(&mut self, data: Vec<Vec<u8>>) -> Vec<Vec<u8>>

Event that announces the arrival of an RPC message.

source

fn gossipsub_incoming_message_handled( &mut self, _source: PeerId, _data: Vec<String> )

Event that announces the arrival of a gossip message.

Provided Methods§

source

fn new_listen_addr( &mut self, _local_peer_id: PeerId, _listener_id: ListenerId, _addr: Multiaddr )

Event that informs the application that we have started listening on a new multiaddr.

source

fn routing_table_updated(&mut self, _peer_id: PeerId)

Event that informs the application that a new peer (with its location details) has just been added to the routing table.

source

fn connection_established( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: NonZeroU32, _established_in: Duration )

Event that informs the application about a newly established connection to a peer.

source

fn connection_closed( &mut self, _peer_id: PeerId, _connection_id: ConnectionId, _endpoint: &ConnectedPoint, _num_established: u32, _cause: Option<ConnectionError> )

Event that informs the application about a closed connection to a peer.

source

fn expired_listen_addr(&mut self, _listener_id: ListenerId, _address: Multiaddr)

Event that announces expired listen address.

source

fn listener_closed( &mut self, _listener_id: ListenerId, _addresses: Vec<Multiaddr> )

Event that announces a closed listener.

source

fn listener_error(&mut self, _listener_id: ListenerId)

Event that announces a listener error.

source

fn dialing(&mut self, _peer_id: Option<PeerId>, _connection_id: ConnectionId)

Event that announces a dialing attempt.

source

fn new_external_addr_candidate(&mut self, _address: Multiaddr)

Event that announces a new external address candidate.

source

fn external_addr_confirmed(&mut self, _address: Multiaddr)

Event that announces a confirmed external address.

source

fn external_addr_expired(&mut self, _address: Multiaddr)

Event that announces an expired external address.

source

fn incoming_connection( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr )

Event that announces new connection arriving on a listener and in the process of protocol negotiation.

source

fn incoming_connection_error( &mut self, _connection_id: ConnectionId, _local_addr: Multiaddr, _send_back_addr: Multiaddr )

Event that announces an error happening on an inbound connection during its initial handshake.

source

fn outgoing_connection_error( &mut self, _connection_id: ConnectionId, _peer_id: Option<PeerId> )

Event that announces an error happening on an outbound connection during its initial handshake.

source

fn outbound_ping_success(&mut self, _peer_id: PeerId, _duration: Duration)

Event that announces the arrival of a pong message from a peer. The duration it took for a round trip is also returned.

source

fn outbound_ping_error(&mut self, _peer_id: PeerId, _err_type: Failure)

Event that announces a Ping error.

source

fn identify_info_recieved(&mut self, _peer_id: PeerId, _info: Info)

Event that announces the arrival of a PeerInfo via the Identify protocol.

source

fn kademlia_put_record_success(&mut self, _key: Vec<u8>)

Event that announces the successful write of a record to the DHT.

source

fn kademlia_put_record_error(&mut self)

Event that announces the failure of a node to save a record.

source

fn kademlia_start_providing_success(&mut self, _key: Vec<u8>)

Event that announces a node as a provider of a record in the DHT.

source

fn kademlia_start_providing_error(&mut self)

Event that announces the failure of a node to become a provider of a record in the DHT.

source

fn gossipsub_unsubscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String )

Event that announces that a peer has just left a network.

source

fn gossipsub_subscribe_message_recieved( &mut self, _peer_id: PeerId, _topic: String )

Event that announces that a peer has just joined a network.

source

fn gossipsub_incoming_message_filtered( &mut self, _propagation_source: PeerId, _message_id: MessageId, _source: Option<PeerId>, _topic: String, _data: Vec<String> ) -> bool

Event that announces the beginning of the filtering and authentication of the incoming gossip message. It returns a boolean to specify whether the massage should be dropped or should reach the application. All incoming messages are allowed in by default.

Implementors§