Struct fbas_analyzer::Fbas [−][src]
pub struct Fbas { /* fields omitted */ }
Expand description
Representation of an FBAS.
Example
use fbas_analyzer::{Fbas, QuorumSet};
let fbas = Fbas::from_json_str(
r#"[
{
"publicKey": "n0",
"quorumSet": { "threshold": 1, "validators": ["n1"] }
},
{
"publicKey": "n1",
"quorumSet": { "threshold": 2, "validators": ["n1", "n2"] }
},
{
"publicKey": "n2",
"quorumSet": { "threshold": 2, "validators": ["n1", "n2"] }
}
]"#,
);
assert_eq!(3, fbas.number_of_nodes());
assert_eq!(Some(0), fbas.get_node_id("n0"));
assert_eq!(
QuorumSet {
validators: vec![1],
inner_quorum_sets: vec![],
threshold: 1
},
fbas.get_quorum_set(0).unwrap()
);
let quorum_set = QuorumSet {
validators: vec![1, 2],
inner_quorum_sets: vec![],
threshold: 2,
};
let mut fbas = fbas;
fbas.swap_quorum_set(0, quorum_set.clone());
assert_eq!(Some(quorum_set), fbas.get_quorum_set(0));
Implementations
Returns all nodes part of a quorum-containing strongly connected component (the only nodes relevant for analysis).
Returns all nodes v for which {v} is a quorum slice (and hence a quorum). These are often nodes that are somehow broken.
Reduces the FBAS to nodes relevant to analysis (nodes part of a quorum-containing strongly connected component) and reorders node IDs so that nodes are sorted by public key.
FBAS of n
nodes with empty quorum sets
Add a node with generic public_key
Trait Implementations
Deserialize this value from the given Serde deserializer. Read more
This method returns an ordering between self
and other
values if one exists. Read more
This method tests less than (for self
and other
) and is used by the <
operator. Read more
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
This method tests greater than (for self
and other
) and is used by the >
operator. Read more
Auto Trait Implementations
impl RefUnwindSafe for Fbas
impl UnwindSafe for Fbas
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.