/** A resolved hold: how long to wait, and whether it was carried over from before a restart. */ export interface UpdateHold { holdMs: number; resumed: boolean; } /** * A persisted deadline this far in the past is stale and redrawn rather than * honoured. Such a record means the node stopped polling for a day (auto-update * disabled, or the node was down). Applying at once would let a fleet that comes * back together restart together, so the node draws a fresh hold instead. */ export declare const MAX_HOLDOFF_OVERDUE_MS: number; /** The per-node rollout deadline for one detected target (git commit or npm version). */ export interface UpdateHoldoffRecord { target: string; deadlineEpochMs: number; } /** * Where the persisted policy keeps the {@link UpdateHoldoffRecord} across * restarts. `read` returns null when there is no record and throws when one * exists but cannot be read or parsed; the policy then draws a fresh hold. */ export interface UpdateHoldoffStore { read(): Promise; write(record: UpdateHoldoffRecord): Promise; clear(): Promise; } /** Every transition of a node's rollout deadline. */ export interface UpdateHoldoffDeadline { /** The hold before applying `target`. */ begin(target: string): Promise; /** Record `target` as already due (a newer target found by the re-check). */ markDue(target: string): Promise; /** Forget the deadline (nothing to apply, or an apply finished). */ clear(): Promise; } export interface PersistedHoldoffDeadlineOptions { store: UpdateHoldoffStore; /** Resolved jitter window in ms (from `resolveUpdateJitterMs`); 0 disables. */ jitterMs: number; /** Reports store failures, which are never thrown (see createPersistedHoldoffDeadline). */ log: (msg: string) => void; /** Injectable for deterministic tests. */ rng?: () => number; now?: () => number; } /** * The daemon's policy. `begin` resumes a persisted deadline for the same target * (0 once it has passed) and otherwise draws and persists a new one. It redraws * when the target changed, the record is unreadable, or the deadline lies * outside [now - MAX_HOLDOFF_OVERDUE_MS, now + jitterMs] (stale, the window was * lowered, or the clock went back). With jitter off it holds 0 and writes nothing. * * The store only carries the deadline across restarts. Within one process the * latest transition is also kept in memory and is authoritative: the store is * read only until this process has made a transition. So a failed write does * not make the next poll redraw, and a failed clear does not bring a stale * deadline back. Store failures are logged, never thrown. */ export declare function createPersistedHoldoffDeadline(opts: PersistedHoldoffDeadlineOptions): UpdateHoldoffDeadline; /** A policy that draws a fresh hold every time and keeps nothing across restarts. */ export declare function createVolatileHoldoffDeadline(opts: { jitterMs: number; rng?: () => number; }): UpdateHoldoffDeadline; //# sourceMappingURL=auto-update-holdoff-deadline.d.ts.map