import type { IServicePlacement } from './service.js'; export type TServiceMigrationStatus = 'running' | 'completed' | 'failed'; export type TServiceMigrationStepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'skipped'; export type TServiceMigrationStepKey = 'validate' | 'stop-source' | 'snapshot' | 'restore' | 'deploy-target' | 'verify'; export interface IServiceMigrationStep { key: TServiceMigrationStepKey; label: string; status: TServiceMigrationStepStatus; startedAt?: number; finishedAt?: number; message?: string; } /** * A node-to-node service migration orchestrated by Cloudly: * gracefully stop everywhere -> snapshot data on the source -> * restore on the target -> deploy pinned to the target -> verify. * Until the target deployment is confirmed, failure rollback restores the * exact original placement snapshot. Target confirmation is the durable * commit point; after it, rollback must not reactivate the source placement. */ export interface IServiceMigration { id: string; serviceId: string; serviceName: string; sourceNodeName: string; targetNodeName: string; /** Backup archive id used for the data move (migration-). */ backupId?: string; /** * Exact placement captured before the migration mutates desired state. * A non-null value is restored verbatim during pre-commit rollback. `null` * means the service originally had no placement property, so rollback must * remove that property. `undefined` is reserved for legacy records whose * original placement is unknown and must not be interpreted as absent. */ originalPlacement?: IServicePlacement | null; /** * Timestamp at which the target deployment was positively verified and the * migration crossed its durable commit point. While `null` or absent, a * failure is pre-commit and restores `originalPlacement`; once set, failure * handling must keep the target authoritative and must not restore source * placement. */ targetDeploymentConfirmedAt?: number | null; status: TServiceMigrationStatus; steps: IServiceMigrationStep[]; startedAt: number; finishedAt?: number; error?: string; }