Interface ICheckpointStore

Persistence contract for checkpoint snapshots.

Implementations may back this with in-memory maps (for testing / ephemeral runs), SQLite / Postgres rows, object storage blobs, or any other durable medium.

All methods are async to accommodate I/O-bound backends without interface changes.

interface ICheckpointStore {
    save(checkpoint): Promise<void>;
    get(checkpointId): Promise<null | Checkpoint>;
    load(runId, nodeId?): Promise<null | Checkpoint>;
    latest(runId): Promise<null | Checkpoint>;
    list(graphId, options?): Promise<CheckpointMetadata[]>;
    delete(checkpointId): Promise<void>;
    fork(checkpointId, patchState?): Promise<string>;
}

Implemented by

Methods

  • Load a checkpoint for the given runId.

    When nodeId is supplied, returns the most recent checkpoint for that specific node within the run. When nodeId is omitted, returns the most recent checkpoint for the run regardless of node (equivalent to latest(runId)).

    Parameters

    • runId: string

      The graph run identifier.

    • Optional nodeId: string

      Optional node filter.

    Returns Promise<null | Checkpoint>

    The matching checkpoint, or null when none exists.

  • List lightweight metadata descriptors for all checkpoints belonging to a graph.

    Parameters

    • graphId: string

      The compiled graph identifier.

    • Optional options: {
          limit?: number;
          runId?: string;
      }
      • Optional limit?: number

        Maximum number of entries to return (most-recent-first).

      • Optional runId?: string

        Optional filter to a single run within the graph.

    Returns Promise<CheckpointMetadata[]>

    Array of CheckpointMetadata, sorted by timestamp descending.

  • Permanently remove a checkpoint from the store.

    Silently succeeds when checkpointId does not exist.

    Parameters

    • checkpointId: string

      The checkpoint to remove.

    Returns Promise<void>

  • Create a new run branching from an existing checkpoint.

    The operation deep-clones the source checkpoint, assigns a fresh runId and checkpoint id, applies any patchState overrides, persists the new checkpoint, and returns the new runId.

    Parameters

    • checkpointId: string

      The checkpoint to fork from.

    • Optional patchState: Partial<GraphState<unknown, unknown, unknown>>

      Optional partial GraphState overrides applied after cloning.

    Returns Promise<string>

    The new runId for the forked run.

    Throws

    When checkpointId does not exist.