Struct dht::KNodeTable [] [src]

pub struct KNodeTable {
    // some 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

impl KNodeTable
[src]

fn new(this_id: BigUint) -> KNodeTable

Create a new node table.

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

Trait Implementations

impl GenericNodeTable for KNodeTable
[src]

fn random_id(&self) -> BigUint

Generate suitable random ID.

fn update(&mut self, node: &Node) -> bool

Store or update node in the table.

fn find(&self, id: &BigUint, count: usize) -> Vec<Node>

Find given number of node, closest to given ID.

fn pop_oldest(&mut self) -> Vec<Node>

Pop expired or the oldest nodes from table for inspection.