pub enum KademliaHandlerEvent<TUserData> {
ProtocolConfirmed {
endpoint: ConnectedPoint,
},
FindNodeReq {
key: Vec<u8>,
request_id: KademliaRequestId,
},
FindNodeRes {
closer_peers: Vec<KadPeer>,
user_data: TUserData,
},
GetProvidersReq {
key: Key,
request_id: KademliaRequestId,
},
GetProvidersRes {
closer_peers: Vec<KadPeer>,
provider_peers: Vec<KadPeer>,
user_data: TUserData,
},
QueryError {
error: KademliaHandlerQueryErr,
user_data: TUserData,
},
AddProvider {
key: Key,
provider: KadPeer,
},
GetRecord {
key: Key,
request_id: KademliaRequestId,
},
GetRecordRes {
record: Option<Record>,
closer_peers: Vec<KadPeer>,
user_data: TUserData,
},
PutRecord {
record: Record,
request_id: KademliaRequestId,
},
PutRecordRes {
key: Key,
value: Vec<u8>,
user_data: TUserData,
},
}Expand description
Event produced by the Kademlia handler.
Variants§
ProtocolConfirmed
The configured protocol name has been confirmed by the peer through a successfully negotiated substream.
This event is only emitted once by a handler upon the first successfully negotiated inbound or outbound substream and indicates that the connected peer participates in the Kademlia overlay network identified by the configured protocol name.
Fields
endpoint: ConnectedPointFindNodeReq
Request for the list of nodes whose IDs are the closest to key. The number of nodes
returned is not specified, but should be around 20.
Fields
request_id: KademliaRequestIdIdentifier of the request. Needs to be passed back when answering.
FindNodeRes
Response to an KademliaHandlerIn::FindNodeReq.
Fields
user_data: TUserDataThe user data passed to the FindNodeReq.
GetProvidersReq
Same as FindNodeReq, but should also return the entries of the local providers list for
this key.
Fields
request_id: KademliaRequestIdIdentifier of the request. Needs to be passed back when answering.
GetProvidersRes
Response to an KademliaHandlerIn::GetProvidersReq.
Fields
user_data: TUserDataThe user data passed to the GetProvidersReq.
QueryError
An error happened when performing a query.
Fields
error: KademliaHandlerQueryErrThe error that happened.
user_data: TUserDataThe user data passed to the query.
AddProvider
The peer announced itself as a provider of a key.
Fields
GetRecord
Request to get a value from the dht records
Fields
request_id: KademliaRequestIdIdentifier of the request. Needs to be passed back when answering.
GetRecordRes
Response to a KademliaHandlerIn::GetRecord.
Fields
user_data: TUserDataThe user data passed to the GetValue.
PutRecord
Request to put a value in the dht records
Fields
request_id: KademliaRequestIdIdentifier of the request. Needs to be passed back when answering.
PutRecordRes
Response to a request to store a record.
Trait Implementations§
Auto Trait Implementations§
impl<TUserData> !Freeze for KademliaHandlerEvent<TUserData>
impl<TUserData> !RefUnwindSafe for KademliaHandlerEvent<TUserData>
impl<TUserData> Send for KademliaHandlerEvent<TUserData>where
TUserData: Send,
impl<TUserData> Sync for KademliaHandlerEvent<TUserData>where
TUserData: Sync,
impl<TUserData> Unpin for KademliaHandlerEvent<TUserData>where
TUserData: Unpin,
impl<TUserData> !UnwindSafe for KademliaHandlerEvent<TUserData>
Blanket Implementations§
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> 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