pub struct ClusterSupervisor { /* private fields */ }Expand description
The cluster supervisor: health scoring + automatic range failover planning.
Holds only the HealthPolicy; all live state is read through
ClusterSignals at scan time, so one supervisor instance serves the whole
cluster lifetime.
Implementations§
Source§impl ClusterSupervisor
impl ClusterSupervisor
Sourcepub fn new(policy: HealthPolicy) -> ClusterSupervisor
pub fn new(policy: HealthPolicy) -> ClusterSupervisor
A supervisor with the given health policy.
pub fn policy(&self) -> &HealthPolicy
Sourcepub fn assess(&self, signals: &MemberSignals) -> HealthScore
pub fn assess(&self, signals: &MemberSignals) -> HealthScore
Score a single member’s health under the policy. The building block of degraded-member detection: an operator surface calls this for every authorized member to render a health view.
Sourcepub fn assess_members(
&self,
membership: &MembershipCatalog,
signals: &impl ClusterSignals,
) -> BTreeMap<NodeIdentity, HealthScore>
pub fn assess_members( &self, membership: &MembershipCatalog, signals: &impl ClusterSignals, ) -> BTreeMap<NodeIdentity, HealthScore>
Score every authorized member of membership, in stable identity order.
Includes healthy, degraded, and failed members alike — the input to a
cluster health dashboard.
Sourcepub fn plan_failovers(
&self,
membership: &MembershipCatalog,
ownership: &ShardOwnershipCatalog,
signals: &impl ClusterSignals,
) -> FailoverPlan
pub fn plan_failovers( &self, membership: &MembershipCatalog, ownership: &ShardOwnershipCatalog, signals: &impl ClusterSignals, ) -> FailoverPlan
Plan automatic failovers across the whole ownership catalog without
mutating it. For each range whose owner is failover-eligible (Failed and
past the grace period), pick the safest caught-up replica candidate and
produce a PlannedPromotion; if no replica is safe, record a
BlockedFailover. Owners that are healthy, merely degraded, or still
inside their grace period produce nothing.
Sourcepub fn run_failovers(
&self,
membership: &MembershipCatalog,
ownership: &mut ShardOwnershipCatalog,
signals: &impl ClusterSignals,
) -> (Vec<Result<TransitionOutcome, TransitionError>>, FailoverPlan)
pub fn run_failovers( &self, membership: &MembershipCatalog, ownership: &mut ShardOwnershipCatalog, signals: &impl ClusterSignals, ) -> (Vec<Result<TransitionOutcome, TransitionError>>, FailoverPlan)
Plan failovers and immediately run the safe promotions through the
ownership transition machine, fencing each failed owner via the epoch
bump. Returns the activated TransitionOutcomes and the surviving
FailoverPlan (whose blocked entries still need attention; its
promotions are the requests that were run).
Each promotion is an independent catalog entry, so running them in
sequence never invalidates another’s CAS. A promotion whose CAS lost a
race (the catalog moved between planning and activation) surfaces as a
TransitionError in the returned vector rather than aborting the rest.
Trait Implementations§
Source§impl Clone for ClusterSupervisor
impl Clone for ClusterSupervisor
Source§fn clone(&self) -> ClusterSupervisor
fn clone(&self) -> ClusterSupervisor
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClusterSupervisor
impl Debug for ClusterSupervisor
Source§impl Default for ClusterSupervisor
impl Default for ClusterSupervisor
Source§fn default() -> ClusterSupervisor
fn default() -> ClusterSupervisor
Auto Trait Implementations§
impl Freeze for ClusterSupervisor
impl RefUnwindSafe for ClusterSupervisor
impl Send for ClusterSupervisor
impl Sync for ClusterSupervisor
impl Unpin for ClusterSupervisor
impl UnsafeUnpin for ClusterSupervisor
impl UnwindSafe for ClusterSupervisor
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request