pub struct MigrationState { /* private fields */ }Expand description
State of an in-progress migration.
Implementations§
Source§impl MigrationState
impl MigrationState
Sourcepub fn new(daemon_origin: u64, source_node: u64, target_node: u64) -> Self
pub fn new(daemon_origin: u64, source_node: u64, target_node: u64) -> Self
Create a new migration.
Sourcepub fn set_snapshot(
&mut self,
snapshot: StateSnapshot,
) -> Result<(), MigrationError>
pub fn set_snapshot( &mut self, snapshot: StateSnapshot, ) -> Result<(), MigrationError>
Set the snapshot and advance to Transfer phase.
Sourcepub fn transfer_complete(&mut self) -> Result<(), MigrationError>
pub fn transfer_complete(&mut self) -> Result<(), MigrationError>
Mark transfer complete, advance to Restore.
Sourcepub fn restore_complete(&mut self) -> Result<(), MigrationError>
pub fn restore_complete(&mut self) -> Result<(), MigrationError>
Mark restore complete, advance to Replay.
Sourcepub fn replay_complete(&mut self) -> Result<(), MigrationError>
pub fn replay_complete(&mut self) -> Result<(), MigrationError>
Mark replay complete, advance to Cutover.
Sourcepub fn cutover_complete(&mut self) -> Result<(), MigrationError>
pub fn cutover_complete(&mut self) -> Result<(), MigrationError>
Mark cutover complete, advance to Complete.
Sourcepub fn is_complete(&self) -> bool
pub fn is_complete(&self) -> bool
Check if migration is finished.
Sourcepub fn elapsed_ms(&self) -> u64
pub fn elapsed_ms(&self) -> u64
Elapsed time in milliseconds since the migration was
constructed. Backed by a monotonic Instant, so a system
clock that jumps backward (NTP step, VM resume) does not
reset this to 0; long-running migrations stay observable
in operator dashboards.
Sourcepub fn age_in_phase_ms(&self) -> u64
pub fn age_in_phase_ms(&self) -> u64
Milliseconds since the current phase was entered. Same
monotonic source as Self::elapsed_ms; resets on
every phase transition.
Sourcepub fn retry_count(&self) -> u32
pub fn retry_count(&self) -> u32
Number of retries this migration has accumulated.
Sourcepub fn bump_retry(&mut self)
pub fn bump_retry(&mut self)
Increment the retry counter. Saturating at u32::MAX
so a stuck retry loop never wraps to 0 and masks the
retry pressure from operator dashboards.
Sourcepub fn snapshot_size_bytes(&self) -> Option<u64>
pub fn snapshot_size_bytes(&self) -> Option<u64>
Payload byte count of the snapshot once set; None
while the snapshot phase is still in progress (or
when the orchestrator advanced past Snapshot via
force_phase without calling set_snapshot).
Sourcepub fn daemon_origin(&self) -> u64
pub fn daemon_origin(&self) -> u64
Get the daemon origin hash.
Sourcepub fn source_node(&self) -> u64
pub fn source_node(&self) -> u64
Get the source node ID.
Sourcepub fn target_node(&self) -> u64
pub fn target_node(&self) -> u64
Get the target node ID.
Sourcepub fn phase(&self) -> MigrationPhase
pub fn phase(&self) -> MigrationPhase
Get the current phase.
Sourcepub fn snapshot(&self) -> Option<&StateSnapshot>
pub fn snapshot(&self) -> Option<&StateSnapshot>
Get the snapshot (if taken).