Struct dht::KNodeTable [] [src]

pub struct KNodeTable<TId, TAddr> { /* fields omitted */ }

Kademlia node table.

Keeps nodes in a number of k-buckets (equal to bit size of ID in a system, usually 160), where N-th k-bucket contains nodes with distance from 2N to 2N+1 from our node.

methods may panic if distance between two ids is greater than the hash_size.

Methods

impl<TId, TAddr> KNodeTable<TId, TAddr> where
    TId: GenericId,
    TAddr: Clone + Debug
[src]

Create a new node table.

this_id -- ID of the current node (used to calculate metrics).

Trait Implementations

impl<TId, TAddr> GenericNodeTable<TId, TAddr> for KNodeTable<TId, TAddr> where
    TId: GenericId,
    TAddr: Clone + Debug + Sync + Send
[src]

Generate suitable random ID.

Store or update node in the table.

Find given number of node, closest to given ID.

Pop expired or the oldest nodes from table for inspection.