[][src]Module discv5::kbucket

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 entry::*;

Modules

bucket

The internal API for a single KBucket in a KBucketsTable.

entry

The Entry API for quering and modifying the entries of a KBucketsTable representing the nodes participating in the Kademlia DHT.

key

Structs

BucketIndex

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

ClosestBucketsIter

An iterator over the bucket indices, in the order determined by the Distance of a target from the local_key, such that the entries in the buckets are incrementally further away from the target, starting with the bucket covering the target.

ClosestIter

An iterator over (some projection of) the closest entries in a KBucketsTable w.r.t. some target Key.

KBucketsTable

A KBucketsTable represents a Kademlia routing table.

PredicateKey

A key that can be returned from the closest_keys function, which indicates if the key matches the predicate or not.

Enums

ClosestBucketsIterState

Operating states of a ClosestBucketsIter.

Constants

MAX_NODES_PER_SUBNET_TABLE

Number of permitted nodes in the same /24 subnet

NUM_BUCKETS

Maximum number of k-buckets.