Class: SqlCompoundCreditStore
Defined in: packages/agentos/src/safety/runtime/SqlCompoundCreditStore.ts:413
Compound credit over SQL.
Implements
Constructors
Constructor
new SqlCompoundCreditStore(
options):SqlCompoundCreditStore
Defined in: packages/agentos/src/safety/runtime/SqlCompoundCreditStore.ts:421
Parameters
options
Returns
SqlCompoundCreditStore
Throws
When the store is not shareable and requireShared is not false, has no transactions, or the
prefix is refused.
Methods
ensureSchema()
ensureSchema():
Promise<void>
Defined in: packages/agentos/src/safety/runtime/SqlCompoundCreditStore.ts:435
Creates the tables unless the first and the newest of them, accounts and documents, answer a read already;
does nothing with ensureSchema: false. A store made before the documents table gains it; every statement of the
DDL is idempotent.
Returns
Promise<void>
toJSON()
toJSON():
string
Defined in: packages/agentos/src/safety/runtime/SqlCompoundCreditStore.ts:470
Serialises to a marker, never its adapter.
Returns
string
withStorageTransaction()
withStorageTransaction<
T>(transaction,fn):Promise<T>
Defined in: packages/agentos/src/safety/runtime/SqlCompoundCreditStore.ts:460
Uses this store's rows inside the host's existing storage transaction, so host writes and credit rows commit or roll back together. It neither begins, commits, retries nor closes a transaction: the host owns commit, rollback, retry and lock ordering, and an error reaches the host's enclosing transaction. The schema must already exist.
Type Parameters
T
T
Parameters
transaction
StorageAdapter
The host's active adapter transaction on this store's database.
fn
(trx) => Promise<T>
Credit work, plus any host writes that must commit with it.
Returns
Promise<T>
What fn answers.
withTransaction()
withTransaction<
T>(fn):Promise<T>
Defined in: packages/agentos/src/safety/runtime/SqlCompoundCreditStore.ts:464
Runs fn in one transaction: every write of it commits, or none does.
Type Parameters
T
T
Parameters
fn
(trx) => Promise<T>
Returns
Promise<T>