quorum_set/quorum/quorum_bridge.rs
1#[cfg(doc)]
2use crate::QuorumIntersection;
3use crate::quorum::QuorumSet;
4
5/// Builds a joint quorum set that requires a quorum of each input.
6pub trait QuorumBridge<Other>
7where
8 Self: QuorumSet,
9 Other: QuorumSet<Id = Self::Id>,
10{
11 /// Build the joint `X` of `self` and `other`: a set is a quorum of `X` exactly when it is a
12 /// quorum of both `self` and `other`.
13 ///
14 /// A change between two memberships with separate read and write quorum sets builds the joint
15 /// membership with two calls: one joins the old and the new read quorum sets, and one joins
16 /// the old and the new write quorum sets. Every joint read quorum is then a read quorum of both
17 /// the old and the new membership, and every joint write quorum is a write quorum of both.
18 ///
19 /// Let `~` be the [`QuorumIntersection`] relation. When `read ~ write` holds within the old
20 /// and within the new membership, these hold too:
21 /// - `old read ~ joint write` and `old write ~ joint read`
22 /// - `joint read ~ new write` and `joint write ~ new read`
23 /// - `joint read ~ joint write`
24 ///
25 /// E.g. `c₁c₂.joint_with(c₃)` returns `c₁c₂c₃`, where `cᵢcⱼ` is a joint of `cᵢ` and `cⱼ`.
26 fn joint_with(&self, other: Other) -> Self;
27}