import type { DeployCallbacks } from "../../types/callbacks.js"; import type { ECSCompleteEvent } from "../../types/events.js"; import type { DeployServices } from "../serviceFactory.js"; import type { StackLevelEvent } from "../../aws/utils/stackOperationOutcome.js"; import { type RestoreServices, type RolledEcsService, type RolledEntityRead, type RolledLambdaFunction } from "./rollbackRestore.js"; import { type HoldFacts, type RestoreProgress } from "./rollbackHoldMessages.js"; import type { RollbackHoldContext } from "./rollbackHold.js"; export type RestoreTarget = { readonly kind: "ecs"; readonly service: RolledEcsService; } | { readonly kind: "lambda"; readonly fn: RolledLambdaFunction; /** The revision the read before the write saw. */ readonly revisionId: string; }; /** * An ECS deployment a restore leaves behind it: `unended` when it started one * whose end ECS's own verdict did not read, `unknown` when a cancel cut its * update short and ECS may still have accepted it. */ export type DeploymentLeft = "unended" | "unknown"; /** `reason` is pre-masked at construction. */ export type RestoreOutcome = { readonly kind: "restored"; readonly deploymentLeft?: "unended"; } | { readonly kind: "not-restored"; readonly reason: string; readonly deploymentLeft?: "unended"; } | { readonly kind: "cancelled"; readonly deploymentLeft?: DeploymentLeft; }; /** * Put one moved entity back on what the lane applied. A service is rolled to * the lane's revision and judged as the lane judges its own roll; a failure * names ECS's verdict and the service as it reads afterwards, and the outcome * names any deployment the restore leaves in ECS. A function is updated to * the lane's digest, held to the revision read before the write, and * restored only once a read after it shows the digest applied. A cancel * before a write sends nothing. */ export declare function restoreOne(services: RestoreServices, target: RestoreTarget, callbacks: DeployCallbacks, abortSignal: AbortSignal | undefined): Promise; /** * Where the restores got to. `restored` names each one that landed, * `findings` each entity they could not hold, and `stopped` why they ended * short of the rest. `restoreFailures` are the restores' own failed ECS * completions, the strongest of which the deploy's failure is classified * from. */ export type RestoreRun = { readonly kind: "done"; readonly restored: readonly string[]; readonly findings: readonly string[]; readonly stopped?: string; readonly restoreFailures: readonly ECSCompleteEvent[]; } | { readonly kind: "cancelled"; readonly progress: RestoreProgress; }; /** * Put each moved entity back, one at a time: services in the lane's order, * then functions. Before each write, the caller's cancel, the lease, the * stack (its newest event is still the update's `end`) and the entity (still * where it was read) are checked again. The lease or the stack failing stops * the restores; an entity that changed is passed over. A failed read or write * the caller's cancel explains is a cancel, which names each ECS deployment a * restore started and did not see end, and an update it cut short. */ export declare function restoreMoved(services: DeployServices, facts: HoldFacts, end: StackLevelEvent, toRestore: readonly RolledEntityRead[], context: RollbackHoldContext): Promise;