Skip to main content

QuorumBridge

Trait QuorumBridge 

Source
pub trait QuorumBridge<Other>
where Self: QuorumSet, Other: QuorumSet<Id = Self::Id>,
{ // Required methods fn bridge_to(&self, other: Other) -> Self; fn joint_with(&self, other: Other) -> Self; }
Expand description

Builds an intermediate quorum set that has QuorumIntersection with both the source and the target quorum set.

Required Methods§

Source

fn bridge_to(&self, other: Other) -> Self

Build a quorum set X so that self ~ X ~ other, where ~ is the QuorumIntersection relation.

Then X is the intermediate quorum set when changing membership from self to other.

E.g.(cᵢcⱼ is a joint of cᵢ and cⱼ, and no two distinct configs among c₁, c₂, c₃ have intersecting quorums):

  • c₁.bridge_to(c₁) returns c₁
  • c₁.bridge_to(c₂) returns c₁c₂
  • c₁c₂.bridge_to(c₂) returns c₂
  • c₁c₂.bridge_to(c₁) returns c₁
  • c₁c₂.bridge_to(c₃) returns c₂c₃
Source

fn joint_with(&self, other: Other) -> Self

Build the joint X of self and other: a set is a quorum of X exactly when it is a quorum of both self and other.

A change between two memberships with separate read and write quorum sets builds the joint membership with two calls: one joins the old and the new read quorum sets, and one joins the old and the new write quorum sets. Every joint read quorum is then a read quorum of both the old and the new membership, and every joint write quorum is a write quorum of both.

Let ~ be the QuorumIntersection relation. When read ~ write holds within the old and within the new membership, these hold too:

  • old read ~ joint write and old write ~ joint read
  • joint read ~ new write and joint write ~ new read
  • joint read ~ joint write

E.g. c₁c₂.joint_with(c₃) returns c₁c₂c₃, where cᵢcⱼ is a joint of cᵢ and cⱼ.

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> QuorumBridge<BTreeSet<ID>> for Vec<BTreeSet<ID>>
where ID: Ord + Clone,

Builds an intermediate joint quorum set for a target flat config.

The result is the target alone when QuorumIntersection::intersects_with proves that every quorum of self intersects every quorum of the target, e.g. when the target adds one voter to a uniform self. Otherwise it is the joint of the last config of self and the target.

A Raft-style caller that applies a target-alone result must first commit an entry of the leader’s own term. Otherwise two leaders of different terms can each move from the same committed config to a different target, and the two targets can have disjoint quorums.

Source§

fn joint_with(&self, other: BTreeSet<ID>) -> Self

Return the configs of self followed by other. Return an empty joint when self is empty: an empty joint has no quorum, so a joint with it has no quorum either.

Source§

fn bridge_to(&self, other: BTreeSet<ID>) -> Self

Source§

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

Builds an intermediate joint quorum set for a target joint config.

The result is the target alone when QuorumIntersection::intersects_with proves that every quorum of self intersects every quorum of the target. Otherwise it is the joint of the last config of self and the configs of the target. For a target that holds one config, the result equals the result for that config as a BTreeSet target.

A Raft-style caller that applies a target-alone result must first commit an entry of the leader’s own term. Otherwise two leaders of different terms can each move from the same committed config to a different target, and the two targets can have disjoint quorums.

Source§

fn joint_with(&self, other: Vec<BTreeSet<ID>>) -> Self

Return the configs of self followed by the configs 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§

fn bridge_to(&self, other: Vec<BTreeSet<ID>>) -> Self

Implementors§