Struct kademlia_dht::Node
[−]
[src]
pub struct Node { pub node_data: Arc<NodeData>, pub protocol: Arc<Protocol>, // some fields omitted }
A node in the Kademlia DHT.
Fields
node_data: Arc<NodeData>
protocol: Arc<Protocol>
Methods
impl Node
[src]
pub fn new(ip: &str, port: &str, bootstrap: Option<NodeData>) -> Self
[src]
Constructs a new Node
on a specific ip and port, and bootstraps the node with an existing
node if bootstrap
is not None
.
pub fn insert(&mut self, key: Key, value: &str)
[src]
Inserts a key-value pair into the DHT.
pub fn get(&mut self, key: &Key) -> Option<String>
[src]
Gets the value associated with a particular key in the DHT. Returns None
if the key was
not found.
pub fn node_data(&self) -> NodeData
[src]
Returns the NodeData
associated with the node.
pub fn kill(&self)
[src]
Kills the current node and all active threads.