Module libp2p_kad::kbucket[][src]

Implementation of a Kademlia routing table as used by a single peer participating in a Kademlia DHT.

The entry point for the API of this module is a KBucketsTable.

Pending Insertions

When the bucket associated with the Key of an inserted entry is full but contains disconnected nodes, it accepts a PendingEntry. Pending entries are inserted lazily when their timeout is found to be expired upon querying the KBucketsTable. When that happens, the KBucketsTable records an AppliedPending result which must be consumed by calling take_applied_pending regularly and / or after performing lookup operations like entry and closest.

Re-exports

pub use super::bucket::K_VALUE;

Structs

AbsentEntry

An entry that is not present in any bucket.

AppliedPending

The result of applying a pending node to a bucket, possibly replacing an existing node.

BucketIndex

A (type-safe) index into a KBucketsTable, i.e. a non-negative integer in the interval [0, NUM_BUCKETS).

Distance

A distance between two keys in the DHT keyspace.

EntryRefView

An immutable by-reference view of a bucket entry.

EntryView

A cloned, immutable view of an entry that is either present in a bucket or pending insertion.

KBucketRef

A reference to a bucket in a KBucketsTable.

KBucketsTable

A KBucketsTable represents a Kademlia routing table.

Key

A Key in the DHT keyspace with preserved preimage.

KeyBytes

The raw bytes of a key in the DHT keyspace.

Node

A Node in a bucket, representing a peer participating in the Kademlia DHT together with an associated value (e.g. contact information).

NodeRefView

An immutable by-reference view of a Node.

PendingEntry

An entry waiting for a slot to be available in a bucket.

PendingNode

A PendingNode is a Node that is pending insertion into a KBucket.

Position

The position of a node in a KBucket, i.e. a non-negative integer in the range [0, K_VALUE).

PresentEntry

An entry present in a bucket.

SubBucket

Enums

Entry

A reference into a single entry of a KBucketsTable.

InsertResult

The result of inserting an entry into a bucket.

NodeStatus

The status of a node in a bucket.