Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/core / / CheckpointStoreExt

Interface: CheckpointStoreExt

Defined in: packages/core/src/contracts/checkpoint-store.ts:235

Retention extension over CheckpointStore (W-009). The engine intentionally never deletes finished threads itself - a completed thread is still needed for inspection and duplicate-resume refusal; how long to keep it is an operator decision. These primitives are what an operator (or a host scheduler) drives.

Additive: third-party CheckpointStore implementations compile unchanged; hosts feature-detect with 'pruneThreads' in store.

Stable

Extends

Methods

compactThread()

ts
compactThread(
   threadId, 
   namespace, 
keepLast): Promise<number>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:255

Keep only the keepLast most recent checkpoints (by stepNumber) of one (threadId, namespace) pair, deleting older ones together with their pending writes. keepLast >= 1; resume works from the latest tuple, so compaction never breaks resumability - it does remove time-travel/fork targets. Returns the number of checkpoints deleted.

Parameters

ParameterType
threadIdstring
namespacestring
keepLastnumber

Returns

Promise&lt;number&gt;


deleteThread()

ts
deleteThread(threadId): Promise<void>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:184

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

ParameterType
threadIdstring

Returns

Promise&lt;void&gt;

Inherited from

CheckpointStore.deleteThread


getTuple()

ts
getTuple(
   threadId, 
   namespace, 
   checkpointId?): Promise<
  | CheckpointTuple
| null>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:170

Parameters

ParameterType
threadIdstring
namespacestring
checkpointId?string

Returns

Promise< | CheckpointTuple | null>

Inherited from

CheckpointStore.getTuple


list()

ts
list(
   threadId, 
   namespace, 
opts?): AsyncIterable<CheckpointTuple>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:176

Parameters

ParameterType
threadIdstring
namespacestring
opts?ListOptions

Returns

AsyncIterable&lt;CheckpointTuple&gt;

Inherited from

CheckpointStore.list


listSuspended()?

ts
optional listSuspended(namespace, opts?): Promise<readonly {
  threadId: string;
  wakeAt: number;
}[]>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:195

W-032: enumerate threads whose LATEST checkpoint in namespace is suspended with a due wakeAt (<= opts.dueBefore, default: any stamped wakeAt). This is what a durable-timer driver polls - without it an operator would have to keep an external registry of sleeping threadIds. OPTIONAL so third-party stores compile unchanged; createTimerDriver throws a typed error when the store lacks it (deterministic policy, no silent no-op).

Parameters

ParameterType
namespacestring
opts?{ dueBefore?: number; limit?: number; }
opts.dueBefore?number
opts.limit?number

Returns

Promise<readonly { threadId: string; wakeAt: number; }[]>

Inherited from

CheckpointStore.listSuspended


pruneThreads()

ts
pruneThreads(opts): Promise<number>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:245

Namespace-scoped retention sweep: for every (threadId, namespace) pair matching the policy, delete that pair's checkpoints and pending writes - and ONLY that pair's. Never implemented via CheckpointStore.deleteThread (namespace-blind): with a reused threadId, pruning a terminal thread of workflow A must not erase the suspended checkpoints of workflow B. Returns the number of pairs pruned.

Parameters

ParameterType
optsPruneThreadsOptions

Returns

Promise&lt;number&gt;


put()

ts
put(
   threadId, 
   namespace, 
   checkpoint, 
   metadata, 
opts?): Promise<string>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:154

Parameters

ParameterType
threadIdstring
namespacestring
checkpointCheckpoint
metadataCheckpointMetadata
opts?CheckpointPutOptions

Returns

Promise&lt;string&gt;

Inherited from

CheckpointStore.put


putWrites()

ts
putWrites(
   threadId, 
   namespace, 
   checkpointId, 
   writes, 
taskId): Promise<void>;

Defined in: packages/core/src/contracts/checkpoint-store.ts:162

Parameters

ParameterType
threadIdstring
namespacestring
checkpointIdstring
writesreadonly PendingWrite[]
taskIdstring

Returns

Promise&lt;void&gt;

Inherited from

CheckpointStore.putWrites