Skip to main content

QuorumIntersection

Trait QuorumIntersection 

Source
pub trait QuorumIntersection<Other>
where Self: QuorumSet, Other: QuorumSet<Id = Self::Id>,
{ // Required method fn intersects_with(&self, other: &Other) -> Option<bool>; }
Expand description

Relation between quorum sets whose quorums always intersect.

Quorum sets A and B have quorum intersection, written A ~ B, when: ∀ qᵢ ∈ A, ∀ qⱼ ∈ B: qᵢ ∩ qⱼ != ø. In words, every quorum in A intersects every quorum in B. Consensus protocols use this relation to make membership changes without losing overlap between old and new decisions.

The relation is symmetric, and both universal quantifiers are load-bearing: weakening either one to “some quorum” (∃) breaks safety, because a reader or a candidate cannot know which quorum is “the right one” — the overlap must hold for every quorum it may legally assemble. E.g. for write quorums {a,b}, {b,c}, {a,c} and read quorums {b,c}, {x,y}: every write quorum intersects some read quorum, yet a read using {x,y} observes no committed write.

In a Raft-style membership change, quorum intersection is one safety requirement. The protocol also has to prevent an old, smaller candidate from being elected during the transition.

Required Methods§

Source

fn intersects_with(&self, other: &Other) -> Option<bool>

Return whether every quorum of this quorum set intersects every quorum of the other quorum set.

  • Some(true): the check proved that every quorum pair intersects.
  • Some(false): the check proved that some quorum pair is disjoint.
  • None: the check proved neither. An implementation may use a condition that is sufficient but not necessary, so failing that condition tells the caller nothing about the true relation.

Callers can act on Some(true). On Some(false) and on None they must take the unconditionally safe path, e.g. bridge through a joint config built by QuorumBridge. verify_intersection computes the exact relation in exponential time.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<ID> QuorumIntersection<Vec<BTreeSet<ID>>> for Vec<BTreeSet<ID>>
where ID: Ord + Clone,

Two joint configs are treated as having quorum intersection when they share at least one config: every quorum of one then intersects every quorum of the other. Sharing a config is sufficient but not necessary for that property, so this check answers None for a pair of configs whose quorums do in fact all intersect.

Source§

fn intersects_with(&self, other: &Vec<BTreeSet<ID>>) -> Option<bool>

Return Some(true) when two joint quorum sets share a config.

Return Some(false) when either joint is empty: an empty joint accepts the empty set as a quorum, and the empty set intersects nothing.

Return None for every other pair, because the absence of a shared config proves nothing.

Read more about extended membership change in OpenRaft: https://docs.rs/openraft/latest/openraft/docs/data/extended_membership/index.html

Implementors§