OpenTx

class OpenTx @JvmOverloads constructor(allocator: BufferAllocator, nodeBase: NodeBase, dbStorage: DatabaseStorage, dbState: DatabaseState, val txKey: TransactionKey, val externalSourceToken: ExternalSourceToken?, tracer: Tracer? = null, resolvedTxs: List<ResolvedTx> = emptyList()) : AutoCloseable

The per-transaction write/read handle passed to an external-source writer.

Stage writes per table via table; openQuery / executeSql run SQL against the live index with read-your-writes visibility into those staged writes. TxIndexer owns opening, committing and closing the OpenTx — a writer is handed one, it never constructs its own.

Constructors

Link copied to clipboard
constructor(allocator: BufferAllocator, nodeBase: NodeBase, dbStorage: DatabaseStorage, dbState: DatabaseState, txKey: TransactionKey, externalSourceToken: ExternalSourceToken?, tracer: Tracer? = null, resolvedTxs: List<ResolvedTx> = emptyList())

Types

Link copied to clipboard
object Companion
Link copied to clipboard
data class QueryOpts(val currentTime: Instant? = null, val defaultTz: ZoneId? = null)
Link copied to clipboard
inner class Table : AutoCloseable

Per-table staging area for a tx's writes.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
fun executeSql(sql: String, args: RelationReader? = null, opts: OpenTx.QueryOpts = QueryOpts(), user: String? = null)

Execute a DML/DDL SQL statement against this tx, with visibility into writes made earlier in the same writer call. Positional ? parameters come from args, like openQuery.

Link copied to clipboard
fun openQuery(sql: String, args: RelationReader? = null, opts: OpenTx.QueryOpts = QueryOpts()): ResultCursor

Run SQL against the database's live index, with visibility into writes made earlier in this transaction.

Link copied to clipboard
fun table(schemaName: SchemaName = DEFAULT_SCHEMA, tableName: TableName): OpenTx.Table

The staging area for writes to table in this tx, created on first access.