Crate kad
Available on crate feature
kad
only.Expand description
Implementation of the libp2p-specific Kademlia protocol.
§Important Discrepancies
- Peer Discovery with Identify In other libp2p implementations, the
Identify protocol might be seen as a core protocol. Rust-libp2p
tries to stay as generic as possible, and does not make this assumption.
This means that the Identify protocol must be manually hooked up to Kademlia through calls
to
Behaviour::add_address
. If you choose not to use the Identify protocol, and do not provide an alternative peer discovery mechanism, a Kademlia node will not discover nodes beyond the network’s boot nodes. Without the Identify protocol, existing nodes in the kademlia network cannot obtain the listen addresses of nodes querying them, and thus will not be able to add them to their routing table.
Modules§
Structs§
- The successful result of publishing a provider record.
- A non-empty list of (unique) addresses of a peer in the routing table. Every address must be a fully-qualified /p2p address.
Behaviour
is aNetworkBehaviour
that implements the libp2p Kademlia protocol.- The successful result of
Behaviour::bootstrap
. - The configuration for the
Kademlia
behaviour. - A cloned, immutable view of an entry that is either present in a bucket or pending insertion.
- The successful result of
Behaviour::get_closest_peers
. - A distance between two keys in the DHT keyspace.
- A
Key
in the DHT keyspace with preserved preimage. - A reference to a bucket.
- Information about a peer, as known by the sender.
- An operation failed to due no known peers in the routing table.
- Peer Info combines a Peer ID with a set of multiaddrs that the peer is listening on.
- A record either received by the given peer or retrieved from the local record store.
- Information about progress events.
- A record stored in the DHT whose value is the ID of a peer who can provide the value on-demand.
- The successful result of
Behaviour::put_record
. - Unique identifier for an active query.
- A mutable reference to a running query.
- An immutable reference to a running query.
- Execution statistics of a query.
- A record stored in the DHT.
- The (opaque) key of a record.
- Little-endian large integer type 256-bit unsigned integer.
Enums§
- The context of a
QueryInfo::AddProvider
query. - The possible errors when publishing a provider record.
- The phases of a
QueryInfo::AddProvider
query. - The error result of
Behaviour::bootstrap
. - The configurable strategies for the insertion of peers and their addresses into the k-buckets of the Kademlia routing table.
- The configuration for Kademlia “write-back” caching after successful lookups via
Behaviour::get_record
. - Status of our connection to a node reported by the Kademlia protocol.
- The events produced by the
Kademlia
behaviour. - The error result of
Behaviour::get_closest_peers
. - The error result of
Behaviour::get_providers
. - The successful result of
Behaviour::get_providers
. - The error result of
Behaviour::get_record
. - The successful result of
Behaviour::get_record
. - Information about a received and handled inbound request.
- The status of a node in a bucket.
- The context of a
QueryInfo::PutRecord
query. - The error result of
Behaviour::put_record
. - The phases of a
QueryInfo::PutRecord
query. - Information about a running query.
- The results of Kademlia queries.
- A quorum w.r.t. the configured replication factor specifies the minimum number of distinct nodes that must be successfully contacted in order for a query to succeed.
- The possible outcomes of
Behaviour::add_address
. - The configurable filtering strategies for the acceptance of incoming records.
Constants§
- The
α
parameter of the Kademlia specification. - The
k
parameter of the Kademlia specification.
Type Aliases§
- The result of publishing a provider record.
- The result of
Behaviour::bootstrap
. - The result of
Behaviour::get_closest_peers
. - The result of
Behaviour::get_providers
. - The result of
Behaviour::get_record
. - The result of
Behaviour::put_record
.