Skip to main content

MembershipCatalog

Struct MembershipCatalog 

Source
pub struct MembershipCatalog { /* private fields */ }
Expand description

The authorized-member set for one cluster — the control-plane membership catalog.

Membership is explicit: a node appears here only after a successful join (super::join). Autodetect of health and topology ranges over autodetect_candidates — i.e. these members only — never over arbitrary peers that happen to be reachable on the network.

Implementations§

Source§

impl MembershipCatalog

Source

pub fn new( cluster_id: ClusterId, founders: impl IntoIterator<Item = ClusterMember>, ) -> MembershipCatalog

A catalog for cluster_id seeded with founders. The founding data members are the bootstrap set that later candidates authenticate against; each starts empty.

Source

pub fn cluster_id(&self) -> &ClusterId

Source

pub fn is_authorized(&self, identity: &NodeIdentity) -> bool

Is identity an authorized member of this cluster? This is the gate every control-plane path consults — only an authorized member’s health and topology are autodetected, and only a member may vote or own ranges.

Source

pub fn member(&self, identity: &NodeIdentity) -> Option<&ClusterMember>

Source

pub fn member_mut( &mut self, identity: &NodeIdentity, ) -> Option<&mut ClusterMember>

Source

pub fn admit(&mut self, member: ClusterMember) -> AdmissionOutcome

Admit member as authorized. Idempotent: re-admitting an existing member leaves the catalog (and the member’s range count) untouched, so a reconnecting member never has its ranges reset to zero.

Source

pub fn begin_drain(&mut self, identity: &NodeIdentity) -> Option<bool>

Mark an authorized member draining (planned-removal flow, issue #1000). Returns None if identity is not a member, otherwise whether the state changed (false if it was already draining). A draining member keeps its ranges until drain moves them off, but is no longer a placement target.

Source

pub fn remove(&mut self, identity: &NodeIdentity) -> Option<ClusterMember>

Remove a member from the authorized set, returning the removed ClusterMember (or None if it was not a member). This is the final step of both the planned drain and the force-remove flows; callers gate it on the range-dependency checks in super::drain — the catalog itself does not re-check, so a force remove of a dead member can drop it even while ranges still nominally list it.

Source

pub fn members(&self) -> impl Iterator<Item = &ClusterMember>

Every authorized member, in stable identity order.

Source

pub fn placement_eligible_members(&self) -> impl Iterator<Item = &ClusterMember>

The members eligible to receive new range placements — active data members only, in stable identity order. Draining members and witnesses are excluded, so a rebalancer or a drain’s replica-evacuation never targets a member that is itself on the way out.

Source

pub fn autodetect_candidates(&self) -> impl Iterator<Item = &ClusterMember>

The members autodetect of health/topology is allowed to range over — exactly the authorized members. An arbitrary network peer that has not joined is absent here, so autodetect can never silently adopt it.

Source

pub fn is_autodetect_eligible(&self, identity: &NodeIdentity) -> bool

Whether autodetect may consider identity. True only for authorized members — the rule that “autodetect applies only to authorized members after join, not arbitrary network peers”.

Source

pub fn len(&self) -> usize

Source

pub fn is_empty(&self) -> bool

Source

pub fn data_member_count(&self) -> usize

How many data members the cluster currently has (witnesses excluded). This is the number the resilient baseline is measured in.

Source

pub fn assess_baseline(&self) -> BaselineAssessment

Assess the cluster against the resilient multi-writer baseline of RESILIENT_DATA_MEMBER_BASELINE data members.

Trait Implementations§

Source§

impl Clone for MembershipCatalog

Source§

fn clone(&self) -> MembershipCatalog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MembershipCatalog

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> FromRef<T> for T
where T: Clone,

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more