Skip to main content

Class: SqlEventStore

Defined in: packages/agentos/src/io/channels/meetings/stores/sql.ts:533

Durable per-run event sequences with idempotent event ids and payload fencing.

Implements​

Constructors​

Constructor​

new SqlEventStore(opts): SqlEventStore

Defined in: packages/agentos/src/io/channels/meetings/stores/sql.ts:536

Checks the adapter capabilities and prefix without creating tables.

Parameters​

opts​

SqlStoreOptions

Returns​

SqlEventStore

Methods​

append()​

append(event): Promise<{ inserted: boolean; seq: number; }>

Defined in: packages/agentos/src/io/channels/meetings/stores/sql.ts:548

One transaction: the run's anchor row is locked (so sequence numbers of one run are handed out one at a time and the fence is read under the same lock), a repeated event id answers its existing sequence, the row is written with the run's next number and the counter advances; behind the fence a content event is written without its payload. Ids are unique across runs, and two runs' anchors do not order their appends: an append whose id another run's append writes and commits while this one waits on the index writes nothing and answers that event's sequence, as a repeated id does.

Parameters​

event​

Omit<MeetingEvent, "seq">

Returns​

Promise<{ inserted: boolean; seq: number; }>

Implementation of​

IEventStore.append


fence()​

fence(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/sql.ts:572

Prevents further content payloads from being stored for the run.

Parameters​

runId​

string

Returns​

Promise<void>

Implementation of​

IEventStore.fence


purgePayloads()​

purgePayloads(runId): Promise<void>

Defined in: packages/agentos/src/io/channels/meetings/stores/sql.ts:576

Scrubs content payloads under the anchor, preserving event ids, types, times and sequences.

Parameters​

runId​

string

Returns​

Promise<void>

Implementation of​

IEventStore.purgePayloads


read()​

read(runId, fromSeq, limit?): Promise<MeetingEvent[]>

Defined in: packages/agentos/src/io/channels/meetings/stores/sql.ts:567

Reads events after the cursor in sequence order.

Parameters​

runId​

string

fromSeq​

number

limit?​

number = 500

Returns​

Promise<MeetingEvent[]>

Implementation of​

IEventStore.read