Struct kademlia_dht::Node [−][src]
pub struct Node { /* fields omitted */ }
A node in the Kademlia DHT.
Methods
impl Node
[src]
impl Node
pub fn new(ip: &str, port: &str, bootstrap: Option<NodeData>) -> Self
[src]
pub fn new(ip: &str, port: &str, bootstrap: Option<NodeData>) -> Self
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]
pub fn insert(&mut self, key: Key, value: &str)
Inserts a key-value pair into the DHT.
pub fn get(&mut self, key: &Key) -> Option<String>
[src]
pub fn get(&mut self, key: &Key) -> Option<String>
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]
pub fn node_data(&self) -> NodeData
Returns the NodeData
associated with the node.
pub fn kill(&self)
[src]
pub fn kill(&self)
Kills the current node and all active threads.