Graphorin API reference v0.12.1
Graphorin API reference / @graphorin/store-sqlite / / SqliteConsolidatorStateStore
Class: SqliteConsolidatorStateStore
Defined in: packages/store-sqlite/src/consolidator-store.ts:155
SQLite-backed consolidator state store. Constructed by SqliteMemoryStore; never instantiated directly by application code.
Stable
Constructors
Constructor
new SqliteConsolidatorStateStore(conn): SqliteConsolidatorStateStore;Defined in: packages/store-sqlite/src/consolidator-store.ts:158
Parameters
| Parameter | Type |
|---|---|
conn | SqliteConnection |
Returns
SqliteConsolidatorStateStore
Methods
acquireLock()
acquireLock(
scope,
runId,
now,
maxAgeMs): Promise<boolean>;Defined in: packages/store-sqlite/src/consolidator-store.ts:235
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
runId | string |
now | number |
maxAgeMs | number |
Returns
Promise<boolean>
claimReadyBatches()
claimReadyBatches(
scope,
now,
limit?): Promise<readonly DlqBatchRow[]>;Defined in: packages/store-sqlite/src/consolidator-store.ts:394
W-133: 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 CS-8 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
| Parameter | Type | Default value |
|---|---|---|
scope | SessionScope | undefined |
now | number | undefined |
limit | number | 50 |
Returns
Promise<readonly DlqBatchRow[]>
enqueueFailedBatch()
enqueueFailedBatch(input): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:362
Parameters
| Parameter | Type |
|---|---|
input | DlqBatchInput |
Returns
Promise<void>
getState()
getState(scope): Promise<
| ConsolidatorStateRow
| null>;Defined in: packages/store-sqlite/src/consolidator-store.ts:162
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
Returns
Promise< | ConsolidatorStateRow | null>
listFailedBatches()
listFailedBatches(scope, limit?): Promise<readonly DlqBatchRow[]>;Defined in: packages/store-sqlite/src/consolidator-store.ts:474
Parameters
| Parameter | Type | Default value |
|---|---|---|
scope | SessionScope | undefined |
limit | number | 100 |
Returns
Promise<readonly DlqBatchRow[]>
listRecentRuns()
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
| Parameter | Type | Default value |
|---|---|---|
scope | SessionScope | undefined |
limit | number | 50 |
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()
markBatchExhausted(
id,
errorMessage,
retryCount?): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:424
Parameters
| Parameter | Type |
|---|---|
id | string |
errorMessage | string |
retryCount? | number |
Returns
Promise<void>
markBatchSucceeded()
markBatchSucceeded(id): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:411
Parameters
| Parameter | Type |
|---|---|
id | string |
Returns
Promise<void>
pruneExhaustedBatches()
pruneExhaustedBatches(beforeEpochMs): Promise<number>;Defined in: packages/store-sqlite/src/consolidator-store.ts:466
W-065: 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
| Parameter | Type |
|---|---|
beforeEpochMs | number |
Returns
Promise<number>
Stable
pruneRuns()
pruneRuns(beforeEpochMs): Promise<number>;Defined in: packages/store-sqlite/src/consolidator-store.ts:449
W-065: 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
| Parameter | Type |
|---|---|
beforeEpochMs | number |
Returns
Promise<number>
Stable
recordRunFinish()
recordRunFinish(finish): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:295
Parameters
| Parameter | Type |
|---|---|
finish | ConsolidatorRunFinish |
Returns
Promise<void>
recordRunStart()
recordRunStart(input): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:278
Parameters
| Parameter | Type |
|---|---|
input | ConsolidatorRunInput |
Returns
Promise<void>
releaseLock()
releaseLock(scope, runId): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:266
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
runId | string |
Returns
Promise<void>
rescheduleBatch()
rescheduleBatch(
id,
retryCount,
nextRetryAt): Promise<void>;Defined in: packages/store-sqlite/src/consolidator-store.ts:415
Parameters
| Parameter | Type |
|---|---|
id | string |
retryCount | number |
nextRetryAt | number |
Returns
Promise<void>
upsertState()
upsertState(scope, patch): Promise<ConsolidatorStateRow>;Defined in: packages/store-sqlite/src/consolidator-store.ts:173
Parameters
| Parameter | Type |
|---|---|
scope | SessionScope |
patch | ConsolidatorStatePatch |
Returns
Promise<ConsolidatorStateRow>