Struct libp2p_kad::Kademlia

source ·
pub struct Kademlia<TSubstream> { /* private fields */ }
Expand description

Network behaviour that handles Kademlia.

Implementations

Creates a Kademlia.

Creates a Kademlia.

Contrary to new, doesn’t perform the initialization queries that store our local ID into the DHT.

Starts an iterative FIND_NODE request.

This will eventually produce an event containing the nodes of the DHT closest to the requested PeerId.

Starts an iterative GET_PROVIDERS request.

Register the local node as the provider for the given key.

This will periodically send ADD_PROVIDER messages to the nodes closest to the key. When someone performs a GET_PROVIDERS iterative request on the DHT, our local node will be returned as part of the results.

The actual meaning of providing the value of a key is not defined, and is specific to the value whose key is the hash.

Cancels a registration done with add_providing.

There doesn’t exist any “remove provider” message to broadcast on the network, therefore we will still be registered as a provider in the DHT for as long as the timeout doesn’t expire.

Trait Implementations

Handler for all the protocols the network supports.
Event generated by the swarm.
Builds a new ProtocolsHandler.
Indicates the behaviour that we connected to the node with the given peer id through the given endpoint. Read more
Indicates the behaviour that we disconnected from the node with the given peer id. The endpoint is the one we used to be connected to. Read more
Indicates the behaviour that the node with the given peer id has generated an event for us. Read more
Polls for things that swarm should do. 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.