import type { ApprovalDecision, Checkpoint, RunFilter, WorkflowQueueItem, WorkflowRun, WorkflowStatus } from "../../types.js"; import { type PersistedPendingApproval, type WorkflowBackend, type WorkflowRunObservation, type WorkflowRunStateSnapshot, type WorkflowRunUpdate } from "../types.js"; export type { RedisAdapter } from "../../../platform/adapters/redis/index.js"; export type { RedisBackendConfig } from "./types.js"; import type { RedisBackendConfig } from "./types.js"; /** Implement redis backend. */ export declare class RedisBackend implements WorkflowBackend { /** The run-update scripts merge context and node-state maps by key. */ readonly supportsRunPatchKeyMerge = true; private client; private connectionPromise; private config; private initialized; /** Per-run lock tokens for ownership-checked release/extend (Redlock pattern). */ private lockValues; /** * Stream message IDs this consumer has read but not yet acknowledged, keyed * by runId. Populated in {@link dequeue} and consumed by {@link acknowledge} * so we can XACK the exact PEL entry (a runId may map to more than one * pending message if it was requeued and re-read before acking). */ private pendingMessageIds; private runObservationClosers; constructor(config?: RedisBackendConfig); private storagePrefix; private runKey; private checkpointsKey; private approvalsKey; private runObservationKey; private runObservationApprovalsKey; private statusIndexKey; private workflowIndexKey; /** * Set of every run id. Maintained on create/delete so unfiltered listRuns and * countRuns can enumerate runs via SMEMBERS instead of a keyspace-wide * KEYS scan (which blocks the Redis event loop). */ private allRunsIndexKey; /** Enumerate only runs explicitly indexed in the current storage schema. */ private enumerateAllRunIds; private lockKey; private claimKey; private serializeRun; private serializeRunPatch; private serializeCheckpoint; private serializeApproval; private appendIfStatusAndWorker; private deserializeRun; private ensureClient; private createConnection; initialize(): Promise; createRun(run: WorkflowRun): Promise; getRun(runId: string): Promise; updateRun(runId: string, patch: WorkflowRunUpdate): Promise; updateRunIfStatus(runId: string, expectedStatuses: WorkflowStatus[], patch: WorkflowRunUpdate): Promise; updateRunIfStatusAndWorker(runId: string, expectedStatuses: WorkflowStatus[], expectedWorkerId: string, patch: WorkflowRunUpdate): Promise; /** * Replace context and node-state maps with a snapshot, only while status * and (optionally) worker ownership match. Same atomic script as the * conditional patch, with the replace-maps flag set: checkpoint restore * must drop keys written after the snapshot, which the merge retains. */ restoreRunStateIfStatus(runId: string, expectedStatuses: WorkflowStatus[], snapshot: WorkflowRunStateSnapshot, expectedWorkerId?: string): Promise; private updateRunConditionally; deleteRun(runId: string): Promise; listRuns(filter: RunFilter): Promise; countRuns(filter: RunFilter): Promise; saveCheckpoint(runId: string, checkpoint: Checkpoint): Promise; saveCheckpointIfStatusAndWorker(storageRunId: string, ownershipRunId: string, expectedStatuses: WorkflowStatus[], expectedWorkerId: string, checkpoint: Checkpoint): Promise; getLatestCheckpoint(runId: string): Promise; getCheckpoints(runId: string): Promise; savePendingApproval(runId: string, approval: PersistedPendingApproval): Promise; savePendingApprovalIfAbsent(runId: string, approval: PersistedPendingApproval): Promise; private savePendingApprovalRecord; private approvalListFullError; savePendingApprovalIfStatusAndWorker(runId: string, expectedStatuses: WorkflowStatus[], expectedWorkerId: string, approval: PersistedPendingApproval): Promise; private parseApproval; private getApprovals; getPendingApprovals(runId: string): Promise; getPendingApproval(runId: string, approvalId: string): Promise; updatePendingApproval(runId: string, approvalId: string, patch: Partial): Promise; updateApproval(runId: string, approvalId: string, decision: ApprovalDecision): Promise; listApprovalDecisionClaims(runId?: string): Promise>; reserveApprovalDecisionClaim(runId: string, approvalId: string, recoveryClaimId: string, claimedAt: Date, staleBefore: Date): Promise; releaseApprovalDecisionClaim(runId: string, approvalId: string, recoveryClaimId: string): Promise; finalizeApprovalDecision(runId: string, approvalId: string, recoveryClaimId?: string): Promise; listPendingApprovals(filter?: { workflowId?: string; approver?: string; status?: "pending" | "expired"; }): Promise>; enqueue(job: WorkflowQueueItem): Promise; dequeue(): Promise; acknowledge(runId: string): Promise; nack(runId: string): Promise; acquireLock(runId: string, duration: number): Promise; releaseLock(runId: string, lockId?: string): Promise; extendLock(runId: string, duration: number, lockId?: string): Promise; isLocked(runId: string): Promise; findStalledRuns(stalledThreshold: number): Promise; claimStalledRun(runId: string, workerId: string, stalledThreshold: number): Promise; openRunObservation(runId: string, options?: { signal?: AbortSignal; }): Promise; healthCheck(): Promise; destroy(): Promise; } //# sourceMappingURL=index.d.ts.map