swarm_nl::core

Enum NetworkEvent

Source
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: The PeerId of the local peer.
  • listener_id: The ID of the listener.
  • address: The new Multiaddr where the local peer is listening.

Fields

§local_peer_id: PeerId
§listener_id: ListenerId
§address: Multiaddr
§

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: The PeerId of the new peer added to the routing table.

Fields

§peer_id: PeerId
§

ConnectionEstablished

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

§Fields

  • peer_id: The PeerId of the connected peer.
  • connection_id: The ID of the connection.
  • endpoint: The ConnectedPoint 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.

Fields

§peer_id: PeerId
§connection_id: ConnectionId
§num_established: NonZeroU32
§established_in: Duration
§

ConnectionClosed

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

§Fields

  • peer_id: The PeerId of the peer.
  • connection_id: The ID of the connection.
  • endpoint: The ConnectedPoint information about the connection’s endpoint.
  • num_established: The number of remaining established connections with this peer.

Fields

§peer_id: PeerId
§connection_id: ConnectionId
§num_established: u32
§

ExpiredListenAddr

Event that announces an expired listen address.

§Fields

  • listener_id: The ID of the listener.
  • address: The expired Multiaddr.

Fields

§listener_id: ListenerId
§address: Multiaddr
§

ListenerClosed

Event that announces a closed listener.

§Fields

  • listener_id: The ID of the listener.
  • addresses: The list of Multiaddr where the listener was listening.

Fields

§listener_id: ListenerId
§addresses: Vec<Multiaddr>
§

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: The PeerId of the peer being dialed, if known.
  • connection_id: The ID of the connection attempt.

Fields

§peer_id: Option<PeerId>
§connection_id: ConnectionId
§

NewExternalAddrCandidate

Event that announces a new external address candidate.

§Fields

  • address: The new external address candidate.

Fields

§address: Multiaddr
§

ExternalAddrConfirmed

Event that announces a confirmed external address.

§Fields

  • address: The confirmed external address.

Fields

§address: Multiaddr
§

ExternalAddrExpired

Event that announces an expired external address.

§Fields

  • address: The expired external address.

Fields

§address: Multiaddr
§

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 local Multiaddr where the connection is received.
  • send_back_addr: The remote Multiaddr of the peer initiating the connection.

Fields

§connection_id: ConnectionId
§local_addr: Multiaddr
§send_back_addr: Multiaddr
§

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 local Multiaddr where the connection was received.
  • send_back_addr: The remote Multiaddr of the peer initiating the connection.

Fields

§connection_id: ConnectionId
§local_addr: Multiaddr
§send_back_addr: Multiaddr
§

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: The PeerId of the peer being connected to, if known.

Fields

§connection_id: ConnectionId
§peer_id: Option<PeerId>
§

OutboundPingSuccess

Event that announces the arrival of a pong message from a peer.

§Fields

  • peer_id: The PeerId of the peer that sent the pong message.
  • duration: The duration it took for the round trip.

Fields

§peer_id: PeerId
§duration: Duration
§

OutboundPingError

Event that announces a Ping error.

§Fields

  • peer_id: The PeerId of the peer that encountered the ping error.

Fields

§peer_id: PeerId
§

IdentifyInfoReceived

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

§Fields

  • peer_id: The PeerId of the peer that sent the identify info.
  • info: The IdentifyInfo received from the peer.

Fields

§peer_id: PeerId
§

KademliaPutRecordSuccess

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

§Fields

  • key: The key of the record that was successfully written.

Fields

§key: Vec<u8>
§

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.

Fields

§key: Vec<u8>
§

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: The RpcData of the received message.

Fields

§data: RpcData
§

GossipsubUnsubscribeMessageReceived

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

§Fields

  • peer_id: The PeerId of the peer that left.
  • topic: The topic the peer unsubscribed from.

Fields

§peer_id: PeerId
§topic: String
§

GossipsubSubscribeMessageReceived

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

§Fields

  • peer_id: The PeerId of the peer that joined.
  • topic: The topic the peer subscribed to.

Fields

§peer_id: PeerId
§topic: String
§

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 source
  • outgoing_timestamp: The time the message was recieved
  • message_id: The unique id of the message
  • source: The PeerId of the source peer.

Fields

§data: StringVector

Data

§network: String

The replica network that owns the data

§outgoing_timestamp: Seconds

Timestamp at which the message left the sending node

§incoming_timestamp: Seconds

Timestamp at which the message arrived

§message_id: String

Message ID to prevent deduplication. It is usually a hash of the incoming message

§source: PeerId

Sender PeerId

§

IncomingForwardedData

Event that announces the arrival of a forwarded sharded data

§Fields

  • data: The data contained in the gossip message.

Fields

§data: StringVector

Data

§source: PeerId

Sender’s PeerId

§

GossipsubIncomingMessageHandled

Event that announces the arrival of a gossip message.

§Fields

  • source: The PeerId of the source peer.
  • data: The data contained in the gossip message.

Fields

§source: PeerId

Trait Implementations§

Source§

impl Clone for NetworkEvent

Source§

fn clone(&self) -> NetworkEvent

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NetworkEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for NetworkEvent

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for NetworkEvent

Source§

fn eq(&self, other: &NetworkEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Eq for NetworkEvent

Source§

impl StructuralPartialEq for NetworkEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T