use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum SyncPhase {
FullSyncStart,
FullSyncEnd,
SnapshotProgress,
SnapshotHandoff,
CatchUpProgress,
}
impl SyncPhase {
pub fn as_str(&self) -> &str {
match self {
SyncPhase::FullSyncStart => "full_sync_start",
SyncPhase::FullSyncEnd => "full_sync_end",
SyncPhase::SnapshotProgress => "snapshot_progress",
SyncPhase::SnapshotHandoff => "snapshot_handoff",
SyncPhase::CatchUpProgress => "catch_up_progress",
}
}
}
impl std::fmt::Display for SyncPhase {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.write_str(self.as_str())
}
}