Struct k_bucket::KBucket [] [src]

pub struct KBucket {}

Methods

impl KBucket
[src]

[src]

Create a new instance.

[src]

Default arbiter function for contacts with the same id. Uses contact.vectorClock to select which contact to update the k-bucket with. Contact with larger vectorClock field will be selected. If vectorClock is the same, candidat will be selected.

[src]

Default distance function. Finds the XOR distance between firstId and secondId.

[src]

Adds a contact to the k-bucket.

[src]

Get the n closest contacts to the provided node id. "Closest" here means: closest according to the XOR metric of the contact node id.

[src]

Counts the total number of contacts in the tree.

[src]

[src]

Retrieves the contact.

[src]

The metadata method serves as a container that can be used by implementations using k-bucket. One example is storing a timestamp to indicate the last time when a node in the bucket was responding to a ping.

[src]

Removes contact with the provided id.

[src]

Traverses the tree, putting all the contacts into one arraverses the tree, putting all the contacts into one vector.

Trait Implementations

Auto Trait Implementations

impl Send for KBucket

impl Sync for KBucket