pub enum KademliaHandlerEvent<TUserData> {
    FindNodeReq {
        key: PeerId,
        request_id: KademliaRequestId,
    },
    FindNodeRes {
        closer_peers: Vec<KadPeer>,
        user_data: TUserData,
    },
    GetProvidersReq {
        key: Multihash,
        request_id: KademliaRequestId,
    },
    GetProvidersRes {
        closer_peers: Vec<KadPeer>,
        provider_peers: Vec<KadPeer>,
        user_data: TUserData,
    },
    QueryError {
        error: KademliaHandlerQueryErr,
        user_data: TUserData,
    },
    AddProvider {
        key: Multihash,
        provider_peer: KadPeer,
    },
}
Expand description

Event produced by the Kademlia handler.

Variants

FindNodeReq

Fields

key: PeerId

Identifier of the node.

request_id: KademliaRequestId

Identifier of the request. Needs to be passed back when answering.

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

closer_peers: Vec<KadPeer>

Results of the request.

user_data: TUserData

The user data passed to the FindNodeReq.

Response to an KademliaHandlerIn::FindNodeReq.

GetProvidersReq

Fields

key: Multihash

Identifier being searched.

request_id: KademliaRequestId

Identifier of the request. Needs to be passed back when answering.

Same as FindNodeReq, but should also return the entries of the local providers list for this key.

GetProvidersRes

Fields

closer_peers: Vec<KadPeer>

Nodes closest to the key.

provider_peers: Vec<KadPeer>

Known providers for this key.

user_data: TUserData

The user data passed to the GetProvidersReq.

Response to an KademliaHandlerIn::GetProvidersReq.

QueryError

Fields

error: KademliaHandlerQueryErr

The error that happened.

user_data: TUserData

The user data passed to the query.

An error happened when performing a query.

AddProvider

Fields

key: Multihash

Key for which we should add providers.

provider_peer: KadPeer

Known provider for this key.

The remote indicates that this list of providers is known for this key.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

Should always be Self
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.