#[cfg(any(test, feature = "message_scheme"))]
pub trait AckedGroupMembership<ID, OP> {
type State: Clone + std::fmt::Debug + serde::Serialize + for<'a> serde::Deserialize<'a>;
type Error: std::error::Error;
fn create(my_id: ID, initial_members: &[ID]) -> Result<Self::State, Self::Error>;
fn from_welcome(y: Self::State, y_welcome: Self::State) -> Result<Self::State, Self::Error>;
fn add(
y: Self::State,
adder: ID,
added: ID,
operation_id: OP,
) -> Result<Self::State, Self::Error>;
fn remove(
y: Self::State,
remover: ID,
removed: &ID,
operation_id: OP,
) -> Result<Self::State, Self::Error>;
fn ack(y: Self::State, acker: ID, operation_id: OP) -> Result<Self::State, Self::Error>;
fn members_view(
y: &Self::State,
viewer: &ID,
) -> Result<std::collections::HashSet<ID>, Self::Error>;
fn is_add(y: &Self::State, operation_id: OP) -> bool;
fn is_remove(y: &Self::State, operation_id: OP) -> bool;
}
#[cfg(any(test, feature = "data_scheme"))]
pub trait GroupMembership<ID, OP> {
type State: Clone + std::fmt::Debug + serde::Serialize + for<'a> serde::Deserialize<'a>;
type Error: std::error::Error;
fn create(my_id: ID, initial_members: &[ID]) -> Result<Self::State, Self::Error>;
fn from_welcome(my_id: ID, y: Self::State) -> Result<Self::State, Self::Error>;
fn add(
y: Self::State,
adder: ID,
added: ID,
operation_id: OP,
) -> Result<Self::State, Self::Error>;
fn remove(
y: Self::State,
remover: ID,
removed: &ID,
operation_id: OP,
) -> Result<Self::State, Self::Error>;
fn members(y: &Self::State) -> Result<std::collections::HashSet<ID>, Self::Error>;
}