use std::fmt::Debug;
use std::fmt::Display;
use openraft_macros::since;
use quorum_set::QuorumIntersection;
use quorum_set::QuorumSet;
use crate::Node;
use crate::NodeId;
use crate::base::OptionalFeatures;
use crate::base::OptionalSend;
use crate::base::OptionalSerde;
use crate::base::OptionalSync;
use crate::membership::NodeRef;
#[since(
version = "0.10.0",
change = "returns owned quorum rules and replaces new with joint_with"
)]
#[since(version = "0.10.0")]
pub trait RaftMembership
where Self: OptionalFeatures + Clone + Default + Eq + Debug + Display + Sized + 'static
{
type NodeId: NodeId;
type Node: Node;
#[since(version = "0.10.0", change = "no longer requires QuorumBridge")]
type QuorumSet: QuorumSet<Id = Self::NodeId>
+ QuorumIntersection<Self::QuorumSet>
+ Clone
+ Debug
+ OptionalSend
+ OptionalSync
+ OptionalSerde
+ 'static;
#[since(version = "0.10.0", change = "returns an owned quorum set")]
fn read_quorum_set(&self) -> Self::QuorumSet;
#[since(version = "0.10.0", change = "returns an owned quorum set")]
fn write_quorum_set(&self) -> Self::QuorumSet;
#[since(version = "0.10.0")]
fn read_write_quorums_intersect(&self) -> Option<bool> {
let read = self.read_quorum_set();
let write = self.write_quorum_set();
read.intersects_with(&write)
}
#[since(version = "0.10.0")]
fn supports_direct_transition_to(&self, other: &Self) -> bool;
fn get_node(&self, node_id: &Self::NodeId) -> Option<NodeRef<'_, Self::Node>>;
type Iter: Iterator<Item = Self::NodeId>;
fn node_ids(&self) -> Self::Iter;
#[since(version = "0.10.0")]
fn joint_with(&self, goal: &Self) -> Self;
}