Skip to main content

P2PEvent

Enum P2PEvent 

Source
pub enum P2PEvent {
Show 18 variants PeerDiscovered { peer_id: String, addresses: Vec<String>, }, PeerConnected { peer_id: String, }, PeerDisconnected { peer_id: String, }, PeerIdentified { peer_id: String, agent_version: String, }, Listening { address: String, }, ShareReceived { from_peer: String, cid: String, }, ShareSent { to_peer: String, cid: String, }, ShareFailed { to_peer: Option<String>, error: String, }, BootstrapComplete, DhtRecordFound { key: String, }, DhtRecordStored { key: String, }, NatStatusChanged { status: String, }, HolePunchSucceeded { peer_id: String, }, InboxReplayIgnored { sender_peer_id: String, seq: u64, last_good_seq: u64, }, InboxForkDetected { sender_peer_id: String, seq: u64, expected_prev: Option<String>, actual_prev: Option<String>, }, ShareSendAttempt { to_peer: String, method: String, }, EnvelopeFetchQueued { cid: String, from_peer: String, }, EnvelopeFetchFailed { cid: String, error: String, },
}
Expand description

Events emitted during P2P networking operations.

Variants§

§

PeerDiscovered

A peer was discovered on the network.

Fields

§peer_id: String

Peer ID of the discovered peer.

§addresses: Vec<String>

Multiaddresses of the peer.

§

PeerConnected

Connected to a peer.

Fields

§peer_id: String

Peer ID of the connected peer.

§

PeerDisconnected

Disconnected from a peer.

Fields

§peer_id: String

Peer ID of the disconnected peer.

§

PeerIdentified

A peer was identified with additional metadata.

Fields

§peer_id: String

Peer ID of the identified peer.

§agent_version: String

Agent version string.

§

Listening

Local node started listening on an address.

Fields

§address: String

Address the node is listening on.

§

ShareReceived

A share was received from a peer.

Fields

§from_peer: String

Peer ID of the sender.

§cid: String

CID of the shared content.

§

ShareSent

A share was sent to a peer.

Fields

§to_peer: String

Peer ID of the recipient.

§cid: String

CID of the shared content.

§

ShareFailed

A share operation failed.

Fields

§to_peer: Option<String>

Peer ID of the intended recipient (if known).

§error: String

Error message.

§

BootstrapComplete

DHT bootstrap completed.

§

DhtRecordFound

DHT record was found.

Fields

§key: String

Key of the record.

§

DhtRecordStored

DHT record was stored.

Fields

§key: String

Key of the record.

§

NatStatusChanged

NAT status changed.

Fields

§status: String

New NAT status.

§

HolePunchSucceeded

Hole punch succeeded.

Fields

§peer_id: String

Peer ID of the remote peer.

§

InboxReplayIgnored

An inbox head was ignored due to replay detection (seq already seen).

Fields

§sender_peer_id: String

Peer ID of the sender.

§seq: u64

The sequence number that was replayed.

§last_good_seq: u64

The last good sequence number seen.

§

InboxForkDetected

A fork was detected in the inbox chain (same seq, different prev).

Fields

§sender_peer_id: String

Peer ID of the sender.

§seq: u64

The sequence number where fork was detected.

§expected_prev: Option<String>

The expected prev CID.

§actual_prev: Option<String>

The actual prev CID received.

§

ShareSendAttempt

A share send was attempted.

Fields

§to_peer: String

Peer ID of the recipient.

§method: String

Delivery method being attempted (direct or mailbox).

§

EnvelopeFetchQueued

An envelope fetch was queued for retrieval.

Fields

§cid: String

CID of the envelope to fetch.

§from_peer: String

Peer ID of the sender.

§

EnvelopeFetchFailed

An envelope fetch failed.

Fields

§cid: String

CID of the envelope that failed to fetch.

§error: String

Error message.

Trait Implementations§

Source§

impl Clone for P2PEvent

Source§

fn clone(&self) -> P2PEvent

Returns a duplicate 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 P2PEvent

Source§

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

Formats the value using the given formatter. Read more

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
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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.
Source§

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

Source§

fn vzip(self) -> V