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§

store

Structs§

AddProviderOk
The successful result of publishing a provider record.
Addresses
A non-empty list of (unique) addresses of a peer in the routing table. Every address must be a fully-qualified /p2p address.
Behaviour
Behaviour is a NetworkBehaviour that implements the libp2p Kademlia protocol.
BootstrapOk
The successful result of Behaviour::bootstrap.
Config
The configuration for the Kademlia behaviour.
EntryView
A cloned, immutable view of an entry that is either present in a bucket or pending insertion.
GetClosestPeersOk
The successful result of Behaviour::get_closest_peers.
KBucketDistance
A distance between two keys in the DHT keyspace.
KBucketKey
A Key in the DHT keyspace with preserved preimage.
KBucketRef
A reference to a bucket.
KadPeer
Information about a peer, as known by the sender.
NoKnownPeers
An operation failed to due no known peers in the routing table.
PeerInfo
Peer Info combines a Peer ID with a set of multiaddrs that the peer is listening on.
PeerRecord
A record either received by the given peer or retrieved from the local record store.
ProgressStep
Information about progress events.
ProviderRecord
A record stored in the DHT whose value is the ID of a peer who can provide the value on-demand.
PutRecordOk
The successful result of Behaviour::put_record.
QueryId
Unique identifier for an active query.
QueryMut
A mutable reference to a running query.
QueryRef
An immutable reference to a running query.
QueryStats
Execution statistics of a query.
Record
A record stored in the DHT.
RecordKey
The (opaque) key of a record.
U256
Little-endian large integer type 256-bit unsigned integer.

Enums§

AddProviderContext
The context of a QueryInfo::AddProvider query.
AddProviderError
The possible errors when publishing a provider record.
AddProviderPhase
The phases of a QueryInfo::AddProvider query.
BootstrapError
The error result of Behaviour::bootstrap.
BucketInserts
The configurable strategies for the insertion of peers and their addresses into the k-buckets of the Kademlia routing table.
Caching
The configuration for Kademlia “write-back” caching after successful lookups via Behaviour::get_record.
ConnectionType
Status of our connection to a node reported by the Kademlia protocol.
Event
The events produced by the Kademlia behaviour.
GetClosestPeersError
The error result of Behaviour::get_closest_peers.
GetProvidersError
The error result of Behaviour::get_providers.
GetProvidersOk
The successful result of Behaviour::get_providers.
GetRecordError
The error result of Behaviour::get_record.
GetRecordOk
The successful result of Behaviour::get_record.
InboundRequest
Information about a received and handled inbound request.
Mode
NodeStatus
The status of a node in a bucket.
PutRecordContext
The context of a QueryInfo::PutRecord query.
PutRecordError
The error result of Behaviour::put_record.
PutRecordPhase
The phases of a QueryInfo::PutRecord query.
QueryInfo
Information about a running query.
QueryResult
The results of Kademlia queries.
Quorum
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.
RoutingUpdate
The possible outcomes of Behaviour::add_address.
StoreInserts
The configurable filtering strategies for the acceptance of incoming records.

Constants§

ALPHA_VALUE
The α parameter of the Kademlia specification.
K_VALUE
The k parameter of the Kademlia specification.
PROTOCOL_NAME

Type Aliases§

AddProviderResult
The result of publishing a provider record.
BootstrapResult
The result of Behaviour::bootstrap.
GetClosestPeersResult
The result of Behaviour::get_closest_peers.
GetProvidersResult
The result of Behaviour::get_providers.
GetRecordResult
The result of Behaviour::get_record.
PutRecordResult
The result of Behaviour::put_record.