Skip to content

Graphorin API reference v0.15.1


Graphorin API reference / @graphorin/store-sqlite / / SqliteConsolidatorStateStore

Class: SqliteConsolidatorStateStore ​

Defined in: packages/store-sqlite/src/consolidator-store.ts:155

Stable

SQLite-backed consolidator state store. Constructed by SqliteMemoryStore; never instantiated directly by application code.

Constructors ​

Constructor ​

ts
new SqliteConsolidatorStateStore(conn): SqliteConsolidatorStateStore;

Defined in: packages/store-sqlite/src/consolidator-store.ts:158

Parameters ​

ParameterType
connSqliteConnection

Returns ​

SqliteConsolidatorStateStore

Methods ​

acquireLock() ​

ts
acquireLock(
   scope, 
   runId, 
   now, 
maxAgeMs): Promise<boolean>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:235

Parameters ​

ParameterType
scopeSessionScope
runIdstring
nownumber
maxAgeMsnumber

Returns ​

Promise&lt;boolean&gt;


claimReadyBatches() ​

ts
claimReadyBatches(
   scope, 
   now, 
limit?): Promise<readonly DlqBatchRow[]>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:394

Despite the name, this is a plain SELECT of due DLQ batches WITHOUT any lease/claim semantics - two concurrent callers see the same rows. Serializing concurrent drains is the CALLER's job via the consolidator scope lock (the runtime always drains under it); the worst case of a bypassed lock is duplicated LLM replay spend, not corruption. The name is kept because the method sits on the stable contract surface - renaming would be a breaking change with no behavioural gain.

Parameters ​

ParameterTypeDefault value
scopeSessionScopeundefined
nownumberundefined
limitnumber50

Returns ​

Promise&lt;readonly DlqBatchRow[]&gt;


enqueueFailedBatch() ​

ts
enqueueFailedBatch(input): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:362

Parameters ​

ParameterType
inputDlqBatchInput

Returns ​

Promise&lt;void&gt;


getState() ​

ts
getState(scope): Promise<
  | ConsolidatorStateRow
| null>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:162

Parameters ​

ParameterType
scopeSessionScope

Returns ​

Promise< | ConsolidatorStateRow | null>


listFailedBatches() ​

ts
listFailedBatches(scope, limit?): Promise<readonly DlqBatchRow[]>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:474

Parameters ​

ParameterTypeDefault value
scopeSessionScopeundefined
limitnumber100

Returns ​

Promise&lt;readonly DlqBatchRow[]&gt;


listRecentRuns() ​

ts
listRecentRuns(scope, limit?): Promise<readonly {
  factsCreated: number;
  factsUpdated: number;
  finishedAt: number | null;
  id: string;
  llmCostUsd: number | null;
  llmTokensUsed: number;
  phase: "light" | "standard" | "deep";
  startedAt: number;
  status: string;
}[]>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:324

Parameters ​

ParameterTypeDefault value
scopeSessionScopeundefined
limitnumber50

Returns ​

Promise<readonly { factsCreated: number; factsUpdated: number; finishedAt: number | null; id: string; llmCostUsd: number | null; llmTokensUsed: number; phase: "light" | "standard" | "deep"; startedAt: number; status: string; }[]>


markBatchExhausted() ​

ts
markBatchExhausted(
   id, 
   errorMessage, 
retryCount?): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:424

Parameters ​

ParameterType
idstring
errorMessagestring
retryCount?number

Returns ​

Promise&lt;void&gt;


markBatchSucceeded() ​

ts
markBatchSucceeded(id): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:411

Parameters ​

ParameterType
idstring

Returns ​

Promise&lt;void&gt;


pruneExhaustedBatches() ​

ts
pruneExhaustedBatches(beforeEpochMs): Promise<number>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:466

Stable

Retention for the dead-letter queue. Deletes only EXHAUSTED batches (next_retry_at IS NULL - parked forever by markBatchExhausted) that failed before the cutoff; batches still awaiting a retry are never touched (they belong to claimReadyBatches). Returns rows deleted.

Parameters ​

ParameterType
beforeEpochMsnumber

Returns ​

Promise&lt;number&gt;


pruneRuns() ​

ts
pruneRuns(beforeEpochMs): Promise<number>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:449

Stable

Retention for the per-tick run log. Deletes terminal runs that started before the cutoff; in-flight rows (status = 'running') always survive. Returns rows deleted.

Parameters ​

ParameterType
beforeEpochMsnumber

Returns ​

Promise&lt;number&gt;


recordRunFinish() ​

ts
recordRunFinish(finish): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:295

Parameters ​

ParameterType
finishConsolidatorRunFinish

Returns ​

Promise&lt;void&gt;


recordRunStart() ​

ts
recordRunStart(input): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:278

Parameters ​

ParameterType
inputConsolidatorRunInput

Returns ​

Promise&lt;void&gt;


releaseLock() ​

ts
releaseLock(scope, runId): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:266

Parameters ​

ParameterType
scopeSessionScope
runIdstring

Returns ​

Promise&lt;void&gt;


rescheduleBatch() ​

ts
rescheduleBatch(
   id, 
   retryCount, 
nextRetryAt): Promise<void>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:415

Parameters ​

ParameterType
idstring
retryCountnumber
nextRetryAtnumber

Returns ​

Promise&lt;void&gt;


upsertState() ​

ts
upsertState(scope, patch): Promise<ConsolidatorStateRow>;

Defined in: packages/store-sqlite/src/consolidator-store.ts:173

Parameters ​

ParameterType
scopeSessionScope
patchConsolidatorStatePatch

Returns ​

Promise&lt;ConsolidatorStateRow&gt;