Graphorin API reference v0.12.1
Graphorin API reference / @graphorin/store-sqlite / / SqliteCheckpointStore
Class: SqliteCheckpointStore
Defined in: packages/store-sqlite/src/checkpoint-store.ts:23
Default CheckpointStore implementation (including the W-009 CheckpointStoreExt retention primitives). Workflow state is encoded as JSON blobs; per-task pending writes survive partial step failure.
Stable
Implements
Constructors
Constructor
new SqliteCheckpointStore(conn): SqliteCheckpointStore;Defined in: packages/store-sqlite/src/checkpoint-store.ts:25
Parameters
| Parameter | Type |
|---|---|
conn | SqliteConnection |
Returns
SqliteCheckpointStore
Methods
compactThread()
compactThread(
threadId,
namespace,
keepLast): Promise<number>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:260
W-009 compaction: keep only the keepLast newest checkpoints (by step_number) of one (thread_id, namespace) pair. Resume reads the latest tuple, so keepLast >= 1 never breaks resumability; the oldest surviving checkpoint's parent_id may point at a deleted row, which getTuple/list never resolve and the CAS compares only the latest id - safe, but time-travel/fork targets are gone.
Parameters
| Parameter | Type |
|---|---|
threadId | string |
namespace | string |
keepLast | number |
Returns
Promise<number>
Implementation of
CheckpointStoreExt.compactThread
deleteThread()
deleteThread(threadId): Promise<void>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:200
Full erasure primitive: delete every checkpoint and pending write of this thread across ALL namespaces. Namespace-blind by contract - retention sweeps must use CheckpointStoreExt.pruneThreads instead, which is namespace-scoped and protects suspended threads.
Parameters
| Parameter | Type |
|---|---|
threadId | string |
Returns
Promise<void>
Implementation of
CheckpointStoreExt.deleteThread
getTuple()
getTuple(
threadId,
namespace,
checkpointId?): Promise<
| CheckpointTuple
| null>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:109
Parameters
| Parameter | Type |
|---|---|
threadId | string |
namespace | string |
checkpointId? | string |
Returns
Promise< | CheckpointTuple | null>
Implementation of
list()
list(
threadId,
namespace,
opts?): AsyncIterable<CheckpointTuple>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:177
Parameters
| Parameter | Type |
|---|---|
threadId | string |
namespace | string |
opts? | ListOptions |
Returns
AsyncIterable<CheckpointTuple>
Implementation of
listSuspended()
listSuspended(namespace, opts?): Promise<readonly {
threadId: string;
wakeAt: number;
}[]>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:150
W-032: enumerate threads whose LATEST checkpoint in namespace is suspended with a due wake_at. Latest-per-thread is decided by max step_number (the same policy as getTuple), so a thread whose newest checkpoint moved on (resumed / completed) never fires.
Parameters
| Parameter | Type |
|---|---|
namespace | string |
opts? | { dueBefore?: number; limit?: number; } |
opts.dueBefore? | number |
opts.limit? | number |
Returns
Promise<readonly { threadId: string; wakeAt: number; }[]>
Implementation of
CheckpointStoreExt.listSuspended
pruneThreads()
pruneThreads(opts): Promise<number>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:222
W-009 retention sweep. Policy: a (thread_id, namespace) pair qualifies when its LATEST checkpoint (by step_number) is older than the cutoff and - unless onlyTerminal: false - terminal ('completed' / 'failed' / 'aborted'); suspended pairs hold live HITL approvals / awakeables and are protected by default.
CRITICAL: never delegates to deleteThread - that primitive is namespace-blind, and with a reused threadId (e.g. a sessionId used by two workflows) pruning workflow A's terminal thread would erase workflow B's suspended checkpoints, breaking the onlyTerminal guarantee. Each qualifying pair is deleted with namespace-scoped statements in its own transaction so a long sweep never holds the writer lock across the whole table.
Parameters
| Parameter | Type |
|---|---|
opts | PruneThreadsOptions |
Returns
Promise<number>
Implementation of
CheckpointStoreExt.pruneThreads
put()
put(
threadId,
namespace,
checkpoint,
metadata,
opts?): Promise<string>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:29
Parameters
| Parameter | Type |
|---|---|
threadId | string |
namespace | string |
checkpoint | Checkpoint |
metadata | CheckpointMetadata |
opts? | CheckpointPutOptions |
Returns
Promise<string>
Implementation of
putWrites()
putWrites(
threadId,
namespace,
checkpointId,
writes,
taskId): Promise<void>;Defined in: packages/store-sqlite/src/checkpoint-store.ts:88
Parameters
| Parameter | Type |
|---|---|
threadId | string |
namespace | string |
checkpointId | string |
writes | readonly PendingWrite[] |
taskId | string |
Returns
Promise<void>