Skip to content

commitTransaction

const commitTransaction: (transactionId, reopen?) => number | Promise<number>

Defined in: .work/repos/olmdb/src/lowlevel.ts:71

Commits the transaction with the given ID.

If the transaction is read-only, returns the commit sequence number immediately. If the transaction has modifications, returns a Promise that resolves to the commit sequence when the commit completes.

number

The ID of the transaction to commit

boolean

If true, the transaction is kept open after committing. For read-only transactions, the read context is unchanged and the commit sequence is returned synchronously. For write transactions, the write and read logs are cleared and the read context is refreshed to a snapshot that includes the committed writes (and any concurrent changes). The transaction can then be used for further reads and writes.

number | Promise<number>

For read-only transactions: the commit sequence number (synchronous) For write transactions: a Promise that resolves to the commit sequence number (0 when the transaction failed due to conflicts)

DatabaseError if the transaction cannot be committed