pub struct Joint<Q> { /* private fields */ }Expand description
A quorum rule that accepts an ID set only when every one of its rules accepts it.
A membership change can move through a joint of the old and the new rule, whose every quorum
is a quorum of both. An empty Joint accepts no set, like an empty Vec<BTreeSet<ID>>.
ids() returns the union of the IDs of every rule, each ID once.
§Examples
use std::collections::BTreeSet;
use std::num::NonZeroU64;
use quorum_set::{Joint, QuorumSet, ThresholdQuorumSet};
let two = NonZeroU64::new(2).unwrap();
let old = ThresholdQuorumSet::new(two, BTreeSet::from([1, 2, 3]));
let new = ThresholdQuorumSet::new(two, BTreeSet::from([2, 3, 4]));
let joint = Joint::new([old, new]);
// {1,2} holds 2 of the old IDs but only 1 of the new IDs.
let accepts_one_two = joint.is_quorum([1, 2].iter());
assert!(!accepts_one_two);
let accepts_one_two_four = joint.is_quorum([1, 2, 4].iter());
assert!(accepts_one_two_four);Implementations§
Trait Implementations§
impl<Q: Eq> Eq for Joint<Q>
Source§impl<Q> QuorumBridge<Joint<Q>> for Joint<Q>
Builds the joint of the source and target rules.
impl<Q> QuorumBridge<Joint<Q>> for Joint<Q>
Builds the joint of the source and target rules.
Source§fn joint_with(&self, other: Joint<Q>) -> Self
fn joint_with(&self, other: Joint<Q>) -> Self
Return the rules of self followed by the rules of other. Return an empty joint when
self or other is empty: an empty joint has no quorum, so a joint with it has no quorum
either.
Source§impl<Q> QuorumIntersection<Joint<Q>> for Joint<Q>
Two joints are treated as having quorum intersection when some rule of one intersects some
rule of the other: every quorum of a joint is also a quorum of each of its rules, so every
quorum of one joint then intersects every quorum of the other. This is sufficient but not
necessary for that property, so this check answers None for some pairs of joints whose
quorums do in fact all intersect.
impl<Q> QuorumIntersection<Joint<Q>> for Joint<Q>
Two joints are treated as having quorum intersection when some rule of one intersects some
rule of the other: every quorum of a joint is also a quorum of each of its rules, so every
quorum of one joint then intersects every quorum of the other. This is sufficient but not
necessary for that property, so this check answers None for some pairs of joints whose
quorums do in fact all intersect.
Source§fn intersects_with(&self, other: &Joint<Q>) -> Option<bool>
fn intersects_with(&self, other: &Joint<Q>) -> Option<bool>
Return the answer of the rule check when each joint holds one rule. For other joints,
return Some(true) when some rule of self intersects some rule of other.
When either joint is empty, return Some(true): an empty joint has no quorum, so no pair
of quorums can be disjoint.
Return None for every other pair: two rules that do not intersect prove nothing about
two joints that contain them.