Trait dht::GenericNodeTable [] [src]

pub trait GenericNodeTable: Send + Sync {
    fn random_id(&self) -> BigUint;
    fn update(&mut self, node: &Node) -> bool;
    fn find(&self, id: &BigUint, count: usize) -> Vec<Node>;
    fn pop_oldest(&mut self) -> Vec<Node>;
}

Trait representing table with known nodes.

Keeps some reasonable subset of known nodes passed to update.

Required Methods

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.

Implementors