pub struct FaultDetector { /* private fields */ }Expand description
Fault detection and recovery system
Implementations§
Source§impl FaultDetector
impl FaultDetector
Sourcepub fn new(cluster: Arc<ClusterState>, detection_interval: Duration) -> Self
pub fn new(cluster: Arc<ClusterState>, detection_interval: Duration) -> Self
Create new fault detector
Sourcepub fn detect_failures(&self) -> Vec<String>
pub fn detect_failures(&self) -> Vec<String>
Detect failed nodes based on heartbeat timeouts
OPTIMIZATION: Fast path iterates directly over metrics.values_mut() under lock
when all cluster nodes have registered metrics (metrics.len() == node_count).
This eliminates nodes_snapshot() atomic loading overhead and $N$ per-node HashMap
key lookups. If any cluster node lacks a metrics entry, falls back to snapshot-based
inspection to initialize and mark missing nodes as failed.
Sourcepub fn recover_node(&self, node_id: &str)
pub fn recover_node(&self, node_id: &str)
Recover a failed node
Sourcepub fn start_periodic_detection(&self)
pub fn start_periodic_detection(&self)
Start periodic fault detection in background
Trait Implementations§
Source§impl Clone for FaultDetector
impl Clone for FaultDetector
Auto Trait Implementations§
impl Freeze for FaultDetector
impl RefUnwindSafe for FaultDetector
impl Send for FaultDetector
impl Sync for FaultDetector
impl Unpin for FaultDetector
impl UnsafeUnpin for FaultDetector
impl UnwindSafe for FaultDetector
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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 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> ⓘ
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