Enum libp2p_kad::handler::KademliaHandlerIn
source · pub enum KademliaHandlerIn<TUserData> {
FindNodeReq {
key: PeerId,
user_data: TUserData,
},
FindNodeRes {
closer_peers: Vec<KadPeer>,
request_id: KademliaRequestId,
},
GetProvidersReq {
key: Multihash,
user_data: TUserData,
},
GetProvidersRes {
closer_peers: Vec<KadPeer>,
provider_peers: Vec<KadPeer>,
request_id: KademliaRequestId,
},
AddProvider {
key: Multihash,
provider_peer: KadPeer,
},
}Expand description
Event to send to the handler.
Variants
FindNodeReq
Fields
key: PeerIdIdentifier of the node.
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.
FindNodeRes
Fields
request_id: KademliaRequestIdIdentifier of the request that was made by the remote.
It is a logic error to use an id of the handler of a different node.
Response to a FindNodeReq.
GetProvidersReq
Fields
key: MultihashIdentifier being searched.
Same as FindNodeReq, but should also return the entries of the local providers list for
this key.
GetProvidersRes
Fields
request_id: KademliaRequestIdIdentifier of the request that was made by the remote.
It is a logic error to use an id of the handler of a different node.
Response to a GetProvidersReq.
AddProvider
Fields
key: MultihashKey for which we should add providers.
provider_peer: KadPeerKnown provider for this key.
Indicates that this provider is known for this key.
The API of the handler doesn’t expose any event that allows you to know whether this succeeded.