Skip to content

Graphorin API reference v0.7.0


Graphorin API reference / @graphorin/workflow / checkpoint-store-memory / InMemoryCheckpointStore

Class: InMemoryCheckpointStore

Defined in: packages/workflow/src/checkpoint-store-memory.ts:36

Pure in-memory CheckpointStore implementation. Thread-safe within a single Node.js event loop because every mutation is synchronous; concurrent runs that share the same instance will see a consistent view.

Stable

Implements

Constructors

Constructor

ts
new InMemoryCheckpointStore(): InMemoryCheckpointStore;

Returns

InMemoryCheckpointStore

Methods

compactThread()

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

Defined in: packages/workflow/src/checkpoint-store-memory.ts:230

W-009 compaction - keep the keepLast newest checkpoints of one pair.

Parameters

ParameterType
threadIdstring
namespacestring
keepLastnumber

Returns

Promise&lt;number&gt;

Implementation of

CheckpointStoreExt.compactThread


deleteThread()

ts
deleteThread(threadId): Promise<void>;

Defined in: packages/workflow/src/checkpoint-store-memory.ts:156

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;

Implementation of

CheckpointStoreExt.deleteThread


getTuple()

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

Defined in: packages/workflow/src/checkpoint-store-memory.ts:96

Parameters

ParameterType
threadIdstring
namespacestring
checkpointId?string

Returns

Promise< | CheckpointTuple | null>

Implementation of

CheckpointStoreExt.getTuple


list()

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

Defined in: packages/workflow/src/checkpoint-store-memory.ts:120

Parameters

ParameterType
threadIdstring
namespacestring
opts?ListOptions

Returns

AsyncIterable&lt;CheckpointTuple&gt;

Implementation of

CheckpointStoreExt.list


listSuspended()

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

Defined in: packages/workflow/src/checkpoint-store-memory.ts:173

W-032: enumerate threads whose LATEST checkpoint in namespace is suspended with a due wakeAt - parity with the SQLite adapter.

Parameters

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

Returns

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

Implementation of

CheckpointStoreExt.listSuspended


pruneThreads()

ts
pruneThreads(opts): Promise<number>;

Defined in: packages/workflow/src/checkpoint-store-memory.ts:201

W-009 retention sweep - parity with the SQLite implementation: namespace-SCOPED (entries key as threadId::namespace), latest checkpoint decides age + status, suspended pairs survive unless onlyTerminal: false.

Parameters

ParameterType
optsPruneThreadsOptions

Returns

Promise&lt;number&gt;

Implementation of

CheckpointStoreExt.pruneThreads


put()

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

Defined in: packages/workflow/src/checkpoint-store-memory.ts:40

Parameters

ParameterType
threadIdstring
namespacestring
checkpointCheckpoint
metadataCheckpointMetadata
opts?CheckpointPutOptions

Returns

Promise&lt;string&gt;

Implementation of

CheckpointStoreExt.put


putWrites()

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

Defined in: packages/workflow/src/checkpoint-store-memory.ts:74

Parameters

ParameterType
threadIdstring
namespacestring
checkpointIdstring
writesreadonly PendingWrite[]
taskIdstring

Returns

Promise&lt;void&gt;

Implementation of

CheckpointStoreExt.putWrites


size()

ts
size(): number;

Defined in: packages/workflow/src/checkpoint-store-memory.ts:254

Test-only helper that exposes the raw count of stored checkpoints

  • handy for assertions like "the runtime wrote exactly N checkpoints across the run".

Returns

number