pub enum NetworkEvent {
Show 27 variants
NewListenAddr {
local_peer_id: PeerId,
listener_id: ListenerId,
address: Multiaddr,
},
RoutingTableUpdated {
peer_id: PeerId,
},
ConnectionEstablished {
peer_id: PeerId,
connection_id: ConnectionId,
endpoint: ConnectedPoint,
num_established: NonZeroU32,
established_in: Duration,
},
ConnectionClosed {
peer_id: PeerId,
connection_id: ConnectionId,
endpoint: ConnectedPoint,
num_established: u32,
},
ExpiredListenAddr {
listener_id: ListenerId,
address: Multiaddr,
},
ListenerClosed {
listener_id: ListenerId,
addresses: Vec<Multiaddr>,
},
ListenerError {
listener_id: ListenerId,
},
Dialing {
peer_id: Option<PeerId>,
connection_id: ConnectionId,
},
NewExternalAddrCandidate {
address: Multiaddr,
},
ExternalAddrConfirmed {
address: Multiaddr,
},
ExternalAddrExpired {
address: Multiaddr,
},
IncomingConnection {
connection_id: ConnectionId,
local_addr: Multiaddr,
send_back_addr: Multiaddr,
},
IncomingConnectionError {
connection_id: ConnectionId,
local_addr: Multiaddr,
send_back_addr: Multiaddr,
},
OutgoingConnectionError {
connection_id: ConnectionId,
peer_id: Option<PeerId>,
},
OutboundPingSuccess {
peer_id: PeerId,
duration: Duration,
},
OutboundPingError {
peer_id: PeerId,
},
IdentifyInfoReceived {
peer_id: PeerId,
info: IdentifyInfo,
},
KademliaPutRecordSuccess {
key: Vec<u8>,
},
KademliaPutRecordError,
KademliaStartProvidingSuccess {
key: Vec<u8>,
},
KademliaStartProvidingError,
RpcIncomingMessageHandled {
data: RpcData,
},
GossipsubUnsubscribeMessageReceived {
peer_id: PeerId,
topic: String,
},
GossipsubSubscribeMessageReceived {
peer_id: PeerId,
topic: String,
},
ReplicaDataIncoming {
data: StringVector,
network: String,
outgoing_timestamp: Seconds,
incoming_timestamp: Seconds,
message_id: String,
source: PeerId,
},
IncomingForwardedData {
data: StringVector,
source: PeerId,
},
GossipsubIncomingMessageHandled {
source: PeerId,
data: StringVector,
},
}
Expand description
Enum that represents the events generated in the network layer.
Variants§
NewListenAddr
Event that informs the application that we have started listening on a new multiaddr.
§Fields
local_peer_id
: ThePeerId
of the local peer.listener_id
: The ID of the listener.address
: The newMultiaddr
where the local peer is listening.
RoutingTableUpdated
Event that informs the application that a new peer (with its location details) has just been added to the routing table.
§Fields
peer_id
: ThePeerId
of the new peer added to the routing table.
ConnectionEstablished
Event that informs the application about a newly established connection to a peer.
§Fields
peer_id
: ThePeerId
of the connected peer.connection_id
: The ID of the connection.endpoint
: TheConnectedPoint
information about the connection’s endpoint.num_established
: The number of established connections with this peer.established_in
: The duration it took to establish the connection.
ConnectionClosed
Event that informs the application about a closed connection to a peer.
§Fields
peer_id
: ThePeerId
of the peer.connection_id
: The ID of the connection.endpoint
: TheConnectedPoint
information about the connection’s endpoint.num_established
: The number of remaining established connections with this peer.
ExpiredListenAddr
Event that announces an expired listen address.
§Fields
listener_id
: The ID of the listener.address
: The expiredMultiaddr
.
ListenerClosed
Event that announces a closed listener.
§Fields
listener_id
: The ID of the listener.addresses
: The list ofMultiaddr
where the listener was listening.
ListenerError
Event that announces a listener error.
§Fields
listener_id
: The ID of the listener that encountered the error.
Fields
listener_id: ListenerId
Dialing
Event that announces a dialing attempt.
§Fields
peer_id
: ThePeerId
of the peer being dialed, if known.connection_id
: The ID of the connection attempt.
NewExternalAddrCandidate
Event that announces a new external address candidate.
§Fields
address
: The new external address candidate.
ExternalAddrConfirmed
ExternalAddrExpired
IncomingConnection
Event that announces a new connection arriving on a listener and in the process of protocol negotiation.
§Fields
connection_id
: The ID of the incoming connection.local_addr
: The localMultiaddr
where the connection is received.send_back_addr
: The remoteMultiaddr
of the peer initiating the connection.
IncomingConnectionError
Event that announces an error happening on an inbound connection during its initial handshake.
§Fields
connection_id
: The ID of the incoming connection.local_addr
: The localMultiaddr
where the connection was received.send_back_addr
: The remoteMultiaddr
of the peer initiating the connection.
OutgoingConnectionError
Event that announces an error happening on an outbound connection during its initial handshake.
§Fields
connection_id
: The ID of the outbound connection.peer_id
: ThePeerId
of the peer being connected to, if known.
OutboundPingSuccess
Event that announces the arrival of a pong message from a peer.
§Fields
peer_id
: ThePeerId
of the peer that sent the pong message.duration
: The duration it took for the round trip.
OutboundPingError
Event that announces a Ping
error.
§Fields
peer_id
: ThePeerId
of the peer that encountered the ping error.
IdentifyInfoReceived
Event that announces the arrival of a PeerInfo
via the Identify
protocol.
§Fields
peer_id
: ThePeerId
of the peer that sent the identify info.info
: TheIdentifyInfo
received from the peer.
KademliaPutRecordSuccess
Event that announces the successful write of a record to the DHT.
§Fields
key
: The key of the record that was successfully written.
KademliaPutRecordError
Event that announces the failure of a node to save a record.
KademliaStartProvidingSuccess
Event that announces a node as a provider of a record in the DHT.
§Fields
key
: The key of the record being provided.
KademliaStartProvidingError
Event that announces the failure of a node to become a provider of a record in the DHT.
RpcIncomingMessageHandled
Event that announces the arrival of an RPC message.
§Fields
data
: TheRpcData
of the received message.
GossipsubUnsubscribeMessageReceived
Event that announces that a peer has just left a network.
§Fields
peer_id
: ThePeerId
of the peer that left.topic
: The topic the peer unsubscribed from.
GossipsubSubscribeMessageReceived
Event that announces that a peer has just joined a network.
§Fields
peer_id
: ThePeerId
of the peer that joined.topic
: The topic the peer subscribed to.
ReplicaDataIncoming
Event that announces the arrival of a replicated data content
§Fields
data
: The data contained in the gossip message.outgoing_timestamp
: The time the message left the sourceoutgoing_timestamp
: The time the message was recievedmessage_id
: The unique id of the messagesource
: ThePeerId
of the source peer.
Fields
data: StringVector
Data
IncomingForwardedData
Event that announces the arrival of a forwarded sharded data
§Fields
data
: The data contained in the gossip message.
GossipsubIncomingMessageHandled
Event that announces the arrival of a gossip message.
§Fields
source
: ThePeerId
of the source peer.data
: The data contained in the gossip message.
Trait Implementations§
Source§impl Clone for NetworkEvent
impl Clone for NetworkEvent
Source§fn clone(&self) -> NetworkEvent
fn clone(&self) -> NetworkEvent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for NetworkEvent
impl Debug for NetworkEvent
Source§impl Hash for NetworkEvent
impl Hash for NetworkEvent
Source§impl PartialEq for NetworkEvent
impl PartialEq for NetworkEvent
impl Eq for NetworkEvent
impl StructuralPartialEq for NetworkEvent
Auto Trait Implementations§
impl Freeze for NetworkEvent
impl RefUnwindSafe for NetworkEvent
impl Send for NetworkEvent
impl Sync for NetworkEvent
impl Unpin for NetworkEvent
impl UnwindSafe for NetworkEvent
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more