Struct duniter_wotb::legacy::LegacyWebOfTrust
[−]
[src]
pub struct LegacyWebOfTrust { 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 LegacyWebOfTrust
[src]
pub fn new(max_cert: usize) -> LegacyWebOfTrust
[src]
Create a new Web of Trust with the maxium certificications count.
pub fn legacy_from_file(path: &str) -> Option<LegacyWebOfTrust>
[src]
Read WoT
from file.
pub fn legacy_to_file(&self, path: &str) -> bool
[src]
Write WoT
to file.
Trait Implementations
impl Debug for LegacyWebOfTrust
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Clone for LegacyWebOfTrust
[src]
fn clone(&self) -> LegacyWebOfTrust
[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
impl WebOfTrust for LegacyWebOfTrust
[src]
fn get_max_link(&self) -> usize
[src]
Get the maximum number of links per user.
fn set_max_link(&mut self, max_link: usize)
[src]
Set the maximum number of links per user.
fn add_node(&mut self) -> NodeId
[src]
Add a new node.
fn rem_node(&mut self) -> Option<NodeId>
[src]
Remove the last node. Returns None
if the WoT was empty, otherwise new top node id. Read more
fn size(&self) -> usize
[src]
Get the size of the WoT.
fn is_enabled(&self, node: NodeId) -> Option<bool>
[src]
Check if given node is enabled. Returns None
if this node doesn't exist. Read more
fn set_enabled(&mut self, node: NodeId, state: bool) -> Option<bool>
[src]
Set the enabled state of given node. Returns Null
if this node doesn't exist, enabled
otherwise. Read more
fn get_enabled(&self) -> Vec<NodeId>
[src]
Get enabled node array.
fn get_disabled(&self) -> Vec<NodeId>
[src]
Get disabled node array.
fn add_link(&mut self, from: NodeId, to: NodeId) -> NewLinkResult
[src]
Try to add a link from the source to the target.
fn rem_link(&mut self, from: NodeId, to: NodeId) -> RemLinkResult
[src]
Try to remove a link from the source to the target.
fn has_link(&self, from: NodeId, to: NodeId) -> HasLinkResult
[src]
Test if there is a link from the source to the target.
fn get_sentries(&self, sentry_requirement: usize) -> Vec<NodeId>
[src]
Get sentries array.
fn get_non_sentries(&self, sentry_requirement: usize) -> Vec<NodeId>
[src]
Get non sentries array.
fn get_links_source(&self, target: NodeId) -> Option<Vec<NodeId>>
[src]
Get the list of links source for this target. Returns None
if this node doesn't exist. Read more
fn issued_count(&self, id: NodeId) -> Option<usize>
[src]
Get the number of issued links by a node. Returns None
if this node doesn't exist. Read more
fn compute_distance(&self, params: WotDistanceParameters) -> Option<WotDistance>
[src]
Compute distance between a node and the network. Returns None
if this node doesn't exist. Read more
fn is_outdistanced(&self, params: WotDistanceParameters) -> Option<bool>
[src]
Test if a node is outdistanced in the network. Returns Node
if this node doesn't exist. Read more
fn get_paths(&self, from: NodeId, to: NodeId, step_max: u32) -> Vec<Vec<NodeId>>
[src]
Get paths from one node to the other.
fn from_file(&mut self, path: &str) -> Result<Vec<u8>, WotParseError>
[src]
Load WebOfTrust from binary file
fn to_file(&self, path: &str, blockstamp: &[u8]) -> Result<(), WotWriteError>
[src]
Write WebOfTrust to binary file