pub struct MembershipState {
pub members: Vec<Member>,
pub reachability: Reachability,
}Fields§
§members: Vec<Member>§reachability: ReachabilityImplementations§
Source§impl MembershipState
impl MembershipState
pub fn new() -> Self
pub fn add_or_update(&mut self, m: Member)
pub fn remove(&mut self, addr: &Address)
pub fn up_members(&self) -> Vec<&Member>
pub fn unreachable_addresses(&self) -> BTreeSet<String>
pub fn member_count(&self) -> usize
Sourcepub fn apply_leader_actions(&mut self) -> Vec<ClusterEvent>
pub fn apply_leader_actions(&mut self) -> Vec<ClusterEvent>
Run the leader’s per-tick transition logic against the current
state. Returns the ClusterEvents the daemon should publish
(membership status flips, removals).
Phase 6.C of docs/full-port-plan.md. Pure function — keeps
the daemon actor itself trivial: collect events, then publish
onto crate::events::ClusterEventBus.
Sourcepub fn join(&mut self, m: Member) -> ClusterEvent
pub fn join(&mut self, m: Member) -> ClusterEvent
Insert m as a Joining member and emit the MemberJoined
event for the daemon to publish.
Sourcepub fn leave(&mut self, addr: &Address) -> Option<ClusterEvent>
pub fn leave(&mut self, addr: &Address) -> Option<ClusterEvent>
Mark addr as leaving. Returns the published event if the
transition was valid, None if no such member exists.
Sourcepub fn down(&mut self, addr: &Address) -> Option<ClusterEvent>
pub fn down(&mut self, addr: &Address) -> Option<ClusterEvent>
Force addr to Down. Unlike Self::leave, this is the
operator-initiated terminal-down path: it accepts members in
Up, WeaklyUp, or Leaving status. The next leader-action
tick promotes Down → Removed.
Returns the ClusterEvent::MemberDowned if a transition
occurred, or None if the member is unknown or already in a
terminal status (Down, Exiting, Removed, Joining).
Trait Implementations§
Source§impl Clone for MembershipState
impl Clone for MembershipState
Source§fn clone(&self) -> MembershipState
fn clone(&self) -> MembershipState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more