refactor(replication): move heal queue routing contracts (#4176)

* refactor(replication): move heal queue routing contracts

* fix(replication): satisfy feature clippy
This commit is contained in:
Zhengchao An
2026-07-02 15:15:08 +08:00
committed by GitHub
parent 98a0cca4a2
commit 008b7fcb6f
7 changed files with 298 additions and 154 deletions
+14
View File
@@ -106,6 +106,10 @@ impl ResyncStatusType {
}
}
pub fn should_auto_resume_resync(status: ResyncStatusType) -> bool {
matches!(status, ResyncStatusType::ResyncPending | ResyncStatusType::ResyncStarted)
}
impl fmt::Display for ResyncStatusType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let s = match self {
@@ -543,6 +547,16 @@ mod tests {
assert_eq!(ResyncStatusType::NoResync.to_string(), "");
}
#[test]
fn auto_resume_resync_only_for_inflight_states() {
assert!(should_auto_resume_resync(ResyncStatusType::ResyncPending));
assert!(should_auto_resume_resync(ResyncStatusType::ResyncStarted));
assert!(!should_auto_resume_resync(ResyncStatusType::NoResync));
assert!(!should_auto_resume_resync(ResyncStatusType::ResyncCanceled));
assert!(!should_auto_resume_resync(ResyncStatusType::ResyncCompleted));
assert!(!should_auto_resume_resync(ResyncStatusType::ResyncFailed));
}
#[test]
fn resync_state_accepts_update_only_for_matching_run() {
let current = TargetReplicationResyncStatus {