pub enum NodeEvent {
Show 15 variants
PeerDiscovered(PeerId),
PeerDisconnected(PeerId),
Message {
source: PeerId,
topic: String,
data: Vec<u8>,
},
Listening(Multiaddr),
TransferRequest {
peer: PeerId,
request: TransferRequest,
channel: ResponseChannel<TransferResponse>,
},
TransferResponse {
peer: PeerId,
request_id: OutboundRequestId,
response: TransferResponse,
},
TransferFailed {
peer: PeerId,
request_id: OutboundRequestId,
error: String,
},
ProvidersFound {
key: String,
providers: Vec<PeerId>,
},
ProvideStarted {
key: String,
},
RecordFound {
key: String,
value: Vec<u8>,
},
RecordStored {
key: String,
},
DhtQueryFailed {
key: String,
error: String,
},
MessageRequest {
peer: PeerId,
request: MessageRequest,
channel: ResponseChannel<MessageResponse>,
},
MessageResponse {
peer: PeerId,
request_id: OutboundRequestId,
response: MessageResponse,
},
MessageFailed {
peer: PeerId,
request_id: OutboundRequestId,
error: String,
},
}Expand description
Events emitted by the node
Variants§
PeerDiscovered(PeerId)
A new peer was discovered
PeerDisconnected(PeerId)
A peer disconnected
Message
Received a message on a topic
Listening(Multiaddr)
Node is listening on an address
TransferRequest
Received a transfer request from a peer (needs response via respond_transfer)
TransferResponse
Received a response to our transfer request
TransferFailed
Transfer request failed
ProvidersFound
DHT: Found providers for a key
ProvideStarted
DHT: Successfully started providing
RecordFound
DHT: Record found in DHT
RecordStored
DHT: Record stored successfully
DhtQueryFailed
DHT: Query failed
MessageRequest
Received a message request from a peer (needs response via respond_message)
MessageResponse
Received a response to our message request
MessageFailed
Message request failed
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeEvent
impl !RefUnwindSafe for NodeEvent
impl Send for NodeEvent
impl Sync for NodeEvent
impl Unpin for NodeEvent
impl !UnwindSafe for NodeEvent
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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>
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 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>
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