quorum_set/quorum/quorum_bridge.rs
1#[cfg(doc)]
2use crate::QuorumIntersection;
3use crate::quorum::QuorumSet;
4
5/// Builds an intermediate quorum set that has [`QuorumIntersection`] with both
6/// the source and the target quorum set.
7pub trait QuorumBridge<Other>
8where
9 Self: QuorumSet,
10 Other: QuorumSet<Id = Self::Id>,
11{
12 /// Build a quorum set `X` so that `self ~ X ~ other`, where `~` is the
13 /// [`QuorumIntersection`] relation.
14 ///
15 /// Then `X` is the intermediate quorum set when changing membership from
16 /// `self` to `other`.
17 ///
18 /// E.g.(`cᵢcⱼ` is a joint of `cᵢ` and `cⱼ`, and no two distinct configs among `c₁`, `c₂`,
19 /// `c₃` have intersecting quorums):
20 /// - `c₁.bridge_to(c₁)` returns `c₁`
21 /// - `c₁.bridge_to(c₂)` returns `c₁c₂`
22 /// - `c₁c₂.bridge_to(c₂)` returns `c₂`
23 /// - `c₁c₂.bridge_to(c₁)` returns `c₁`
24 /// - `c₁c₂.bridge_to(c₃)` returns `c₂c₃`
25 fn bridge_to(&self, other: Other) -> Self;
26}