Trait durs_wot::data::WebOfTrust

source ·
pub trait WebOfTrust: Clone + Debug + Default + DeserializeOwned + Send + Serialize + Sync {
Show 18 methods fn new(max_links: usize) -> Self; fn get_max_link(&self) -> usize; fn set_max_link(&mut self, max_link: usize); fn add_node(&mut self) -> NodeId; fn rem_node(&mut self) -> Option<NodeId>; fn size(&self) -> usize; fn is_enabled(&self, id: NodeId) -> Option<bool>; fn set_enabled(&mut self, id: NodeId, enabled: bool) -> Option<bool>; fn get_enabled(&self) -> Vec<NodeId>; fn get_disabled(&self) -> Vec<NodeId>; fn add_link(&mut self, source: NodeId, target: NodeId) -> NewLinkResult; fn rem_link(&mut self, source: NodeId, target: NodeId) -> RemLinkResult; fn has_link(&self, source: NodeId, target: NodeId) -> HasLinkResult; fn get_links_source(&self, target: NodeId) -> Option<Vec<NodeId>>; fn issued_count(&self, id: NodeId) -> Option<usize>; fn is_sentry(&self, node: NodeId, sentry_requirement: usize) -> Option<bool>; fn get_sentries(&self, sentry_requirement: usize) -> Vec<NodeId>; fn get_non_sentries(&self, sentry_requirement: usize) -> Vec<NodeId>;
}
Expand description

Trait for a Web Of Trust. Allow to provide other implementations of the WoT logic instead of the legacy C++ translated one.

Required Methods

Create a new Web of Trust with the maximum of links a node can issue.

Get the maximum number of links per user.

Set the maximum number of links per user.

Add a new node.

Remove the last node. Returns None if the WoT was empty, otherwise new top node id.

Get the size of the WoT.

Check if given node is enabled. Returns None if this node doesn’t exist.

Set the enabled state of given node. Returns Null if this node doesn’t exist, enabled otherwise.

Get enabled node array.

Get disabled node array.

Try to add a link from the source to the target.

Try to remove a link from the source to the target.

Test if there is a link from the source to the target.

Get the list of links source for this target. Returns None if this node doesn’t exist.

Get the number of issued links by a node. Returns None if this node doesn’t exist.

Test if a node is a sentry.

Get sentries array.

Get non sentries array.

Implementors