pub struct UpgradeManager { /* private fields */ }Expand description
Manager for rolling upgrades
Implementations§
Source§impl UpgradeManager
impl UpgradeManager
Sourcepub fn new(config: UpgradeConfig) -> Self
pub fn new(config: UpgradeConfig) -> Self
Create a new upgrade manager
Sourcepub fn register_node(&self, node_id: &str, version: Version, is_leader: bool)
pub fn register_node(&self, node_id: &str, version: Version, is_leader: bool)
Register a node with its current version
Sourcepub fn unregister_node(&self, node_id: &str)
pub fn unregister_node(&self, node_id: &str)
Remove a node from tracking
Sourcepub fn update_leader_status(&self, node_id: &str, is_leader: bool)
pub fn update_leader_status(&self, node_id: &str, is_leader: bool)
Update a node’s leader status
Sourcepub fn plan_upgrade(&self, target_version: Version) -> Result<UpgradePlan>
pub fn plan_upgrade(&self, target_version: Version) -> Result<UpgradePlan>
Plan an upgrade to a target version
Sourcepub fn start_upgrade(&self) -> Result<()>
pub fn start_upgrade(&self) -> Result<()>
Start executing the upgrade plan
Sourcepub fn pause_upgrade(&self) -> Result<()>
pub fn pause_upgrade(&self) -> Result<()>
Pause the upgrade
Sourcepub fn resume_upgrade(&self) -> Result<()>
pub fn resume_upgrade(&self) -> Result<()>
Resume a paused upgrade
Sourcepub fn start_drain(&self, node_id: &str) -> Result<()>
pub fn start_drain(&self, node_id: &str) -> Result<()>
Start draining a node (no new requests)
Sourcepub fn complete_drain(&self, node_id: &str) -> Result<()>
pub fn complete_drain(&self, node_id: &str) -> Result<()>
Mark node drain complete, start upgrade
Sourcepub fn complete_node_upgrade(
&self,
node_id: &str,
new_version: Version,
) -> Result<()>
pub fn complete_node_upgrade( &self, node_id: &str, new_version: Version, ) -> Result<()>
Mark node upgrade as complete
Sourcepub fn record_health_check(&self, node_id: &str, healthy: bool) -> Result<bool>
pub fn record_health_check(&self, node_id: &str, healthy: bool) -> Result<bool>
Record a successful health check for a node
Sourcepub fn fail_node_upgrade(&self, node_id: &str, error: &str) -> Result<()>
pub fn fail_node_upgrade(&self, node_id: &str, error: &str) -> Result<()>
Mark a node upgrade as failed
Sourcepub fn initiate_rollback(&self) -> Result<()>
pub fn initiate_rollback(&self) -> Result<()>
Initiate rollback of the upgrade
Sourcepub fn complete_rollback(
&self,
node_id: &str,
previous_version: Version,
) -> Result<()>
pub fn complete_rollback( &self, node_id: &str, previous_version: Version, ) -> Result<()>
Mark rollback complete for a node
Sourcepub fn get_plan(&self) -> Option<UpgradePlan>
pub fn get_plan(&self) -> Option<UpgradePlan>
Get the current upgrade plan
Sourcepub fn get_node_status(&self, node_id: &str) -> Option<NodeUpgradeInfo>
pub fn get_node_status(&self, node_id: &str) -> Option<NodeUpgradeInfo>
Get upgrade status for a specific node
Sourcepub fn get_stats(&self) -> UpgradeStats
pub fn get_stats(&self) -> UpgradeStats
Get overall upgrade statistics
Sourcepub fn can_proceed(&self) -> Result<bool>
pub fn can_proceed(&self) -> Result<bool>
Check if it’s safe to proceed with upgrade
Sourcepub fn get_nodes_to_drain(&self) -> Vec<String>
pub fn get_nodes_to_drain(&self) -> Vec<String>
Get nodes that need to start draining
Sourcepub fn get_draining_nodes(&self) -> Vec<String>
pub fn get_draining_nodes(&self) -> Vec<String>
Get nodes currently draining
Sourcepub fn check_drain_timeout(&self, node_id: &str) -> Result<bool>
pub fn check_drain_timeout(&self, node_id: &str) -> Result<bool>
Check drain timeout for a node
Auto Trait Implementations§
impl !Freeze for UpgradeManager
impl !RefUnwindSafe for UpgradeManager
impl Send for UpgradeManager
impl Sync for UpgradeManager
impl Unpin for UpgradeManager
impl UnsafeUnpin for UpgradeManager
impl !UnwindSafe for UpgradeManager
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
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