pub struct FailoverManager { /* private fields */ }Expand description
Manages automatic failover and health monitoring
Implementations§
Source§impl FailoverManager
impl FailoverManager
Sourcepub fn new(replica_set: Arc<RwLock<ReplicaSet>>) -> Self
pub fn new(replica_set: Arc<RwLock<ReplicaSet>>) -> Self
Create a new failover manager
Sourcepub fn with_policy(
replica_set: Arc<RwLock<ReplicaSet>>,
policy: FailoverPolicy,
) -> Self
pub fn with_policy( replica_set: Arc<RwLock<ReplicaSet>>, policy: FailoverPolicy, ) -> Self
Create with custom policy
Sourcepub fn set_policy(&self, policy: FailoverPolicy)
pub fn set_policy(&self, policy: FailoverPolicy)
Set the failover policy
Sourcepub fn policy(&self) -> FailoverPolicy
pub fn policy(&self) -> FailoverPolicy
Get the current policy
Sourcepub async fn start_monitoring(&self)
pub async fn start_monitoring(&self)
Start health monitoring
Sourcepub async fn manual_failover(
&self,
target_replica_id: Option<String>,
) -> Result<()>
pub async fn manual_failover( &self, target_replica_id: Option<String>, ) -> Result<()>
Manually trigger failover
Sourcepub fn health_history(&self) -> Vec<HealthCheck>
pub fn health_history(&self) -> Vec<HealthCheck>
Get health check history
Sourcepub fn recent_health(&self, replica_id: &str, limit: usize) -> Vec<HealthCheck>
pub fn recent_health(&self, replica_id: &str, limit: usize) -> Vec<HealthCheck>
Get recent health status for a replica
Sourcepub fn is_failover_in_progress(&self) -> bool
pub fn is_failover_in_progress(&self) -> bool
Check if failover is currently in progress
Sourcepub fn failure_count(&self, replica_id: &str) -> usize
pub fn failure_count(&self, replica_id: &str) -> usize
Get failure count for a replica
Auto Trait Implementations§
impl Freeze for FailoverManager
impl !RefUnwindSafe for FailoverManager
impl Send for FailoverManager
impl Sync for FailoverManager
impl Unpin for FailoverManager
impl !UnwindSafe for FailoverManager
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