Struct duniter_wotb::WebOfTrust
[−]
[src]
pub struct WebOfTrust { pub max_cert: usize, // some fields omitted }
Store a Web of Trust.
Allow to create/remove nodes and links between them.
It provides methods to find sentries nodes, find all paths between 2 nodes and to compute distances in the web.
Fields
max_cert: usize
Maxiumum amout of certifications a node can provide.
It can be changed afterward, and will be accounted for every future calculations.
In practice it should not change after initialization.
Methods
impl WebOfTrust
[src]
fn new(max_cert: usize) -> WebOfTrust
[src]
Create a new Web of Trust with the maxium certificications count.
fn from_file(path: &str) -> Option<WebOfTrust>
[src]
Read WoT from file.
fn to_file(&self, path: &str) -> bool
[src]
Write WoT to file.
fn add_node(&mut self) -> NodeId
[src]
Add a new node.
fn remove_node(&mut self) -> Option<NodeId>
[src]
Remove given node if it exits.
fn compute_distance(
&self,
member: NodeId,
d_min: u32,
k_max: u32,
x_percent: f64
) -> WotDistance
[src]
&self,
member: NodeId,
d_min: u32,
k_max: u32,
x_percent: f64
) -> WotDistance
Compute distance between a node and the network.
fn get_sentries(&self, d_min: usize) -> Vec<NodeId>
[src]
Get sentries array.
fn get_non_sentries(&self, d_min: usize) -> Vec<NodeId>
[src]
Get non sentries array.
fn get_disabled(&self) -> Vec<NodeId>
[src]
Get disabled array.
fn get_paths(&self, from: NodeId, to: NodeId, k_max: u32) -> Vec<Vec<NodeId>>
[src]
Get paths from one node to the other.
fn size(&self) -> usize
[src]
Number of nodes in the WoT.
fn is_enabled(&self, node: NodeId) -> Option<bool>
[src]
Tells if requested node is enabled (None if doesn't exist).
fn set_enabled(&mut self, node: NodeId, state: bool) -> Option<bool>
[src]
Set if a node is enabled.
fn add_link(&mut self, from: NodeId, to: NodeId) -> NewLinkResult
[src]
Add link from a node to another.
fn remove_link(&mut self, from: NodeId, to: NodeId) -> RemovedLinkResult
[src]
Remove a link from a node to another.
fn exists_link(&self, from: NodeId, to: NodeId) -> bool
[src]
Test if a link exist from a node to another.
fn is_outdistanced(
&self,
node: NodeId,
d_min: u32,
d_max: u32,
x_percent: f64
) -> Option<bool>
[src]
&self,
node: NodeId,
d_min: u32,
d_max: u32,
x_percent: f64
) -> Option<bool>
Test if a node is outdistanced in the network.
Trait Implementations
impl Debug for WebOfTrust
[src]
impl Clone for WebOfTrust
[src]
fn clone(&self) -> WebOfTrust
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more