[][src]Module libp2p_kad::kbucket

A k-buckets table allows one to store a value identified by keys, ordered by their distance to a reference key passed to the constructor.

If the local ID has N bits, then the k-buckets table contains N buckets each containing a constant number of entries. Storing a key in the k-buckets table adds it to the bucket corresponding to its distance with the reference key.

Structs

Bucket

Access to a bucket.

BucketsIter

Iterator giving access to a bucket.

EntryInKbucketConn

Represents an entry in a k-bucket.

EntryInKbucketConnPending

Represents an entry waiting for a slot to be available in its k-bucket.

EntryInKbucketDisc

Represents an entry in a k-bucket.

EntryInKbucketDiscPending

Represents an entry waiting for a slot to be available in its k-bucket.

EntryNotInKbucket

Represents an entry not in any k-bucket.

KBucketsTable

Table of k-buckets.

Enums

Entry

Represents an entry or a potential entry in the k-buckets.

InsertOutcome

Outcome of calling insert.

SetDisconnectedOutcome

Outcome of calling set_disconnected.

Constants

MAX_NODES_PER_BUCKET

Maximum number of nodes in a bucket.

Traits

KBucketsPeerId

Trait that must be implemented on types that can be used as an identifier in a k-bucket.