[][src]Trait dubp_wot::data::WebOfTrust

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

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

Required methods

fn new(max_links: usize) -> Self

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

fn clear(&mut self)

Clear Web of Trust datas

Get the maximum number of links per user.

Set the maximum number of links per user.

fn add_node(&mut self) -> WotId

Add a new node.

fn rem_node(&mut self) -> Option<WotId>

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

fn size(&self) -> usize

Get the size of the WoT.

fn is_enabled(&self, id: WotId) -> Option<bool>

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

fn set_enabled(&mut self, id: WotId, enabled: bool) -> Option<bool>

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

fn get_enabled(&self) -> Vec<WotId>

Get enabled node array.

fn get_disabled(&self) -> Vec<WotId>

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.

fn issued_count(&self, id: WotId) -> Option<usize>

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

fn is_sentry(&self, node: WotId, sentry_requirement: usize) -> Option<bool>

Test if a node is a sentry.

fn get_sentries(&self, sentry_requirement: usize) -> Vec<WotId>

Get sentries array.

fn get_non_sentries(&self, sentry_requirement: usize) -> Vec<WotId>

Get non sentries array.

fn dump<W: Write>(&self, output: &mut W) -> Result<()>

Dump wot

Loading content...

Implementors

impl WebOfTrust for RustyWebOfTrust[src]

Loading content...