Xtdb

interface Xtdb : DataSource, AdbcDatabase, AutoCloseable

Types

Link copied to clipboard
Link copied to clipboard
object Companion
Link copied to clipboard
@Serializable
data class Config(var server: ServerConfig? = ServerConfig(), var flightSql: FlightSqlConfig? = FlightSqlConfig(), var logClusters: Map<RemoteAlias, Remote.Factory<*>> = emptyMap(), var remotes: Map<RemoteAlias, Remote.Factory<*>> = emptyMap(), var log: Log.Factory = Log.inMemoryLog, var storage: Storage.Factory = Storage.inMemory(), val memoryCache: MemoryCache.Factory = MemoryCache.Factory(), var diskCache: DiskCache.Factory? = null, var healthz: HealthzConfig? = null, var defaultTz: ZoneId = ZoneOffset.UTC, val indexer: IndexerConfig = IndexerConfig(), val compactor: CompactorConfig = CompactorConfig(), var authn: Authenticator.Factory = SingleRootUser(), var garbageCollector: GarbageCollectorConfig = GarbageCollectorConfig(), var tracer: TracerConfig = TracerConfig(), var readOnlyDatabases: Boolean = false, var skipDbs: Set<String> = System.getenv("XTDB_SKIP_DBS")?.let(::parseSkipDbsEnv).orEmpty(), var nodeId: String = System.getenv("XTDB_NODE_ID") ?: randomUUID().toString().takeWhile { it != '-' })
Link copied to clipboard
class Connection : AdbcConnection

A connection to one database, dbName.

Link copied to clipboard
interface DeviceAuth
Link copied to clipboard
data class ExecutedTx(val txId: MessageId, val systemTime: Instant, val committed: Boolean, val error: Throwable?)
Link copied to clipboard
interface Statement : AdbcStatement

A statement on a Connection.

Link copied to clipboard
data class SubmittedTx(val txId: MessageId)

Properties

Link copied to clipboard
abstract val allocator: BufferAllocator
Link copied to clipboard
abstract var awaitToken: String
Link copied to clipboard
Link copied to clipboard
abstract val databaseNames: Collection<DatabaseName>

The names of the databases this node currently serves.

Link copied to clipboard
abstract val flightSqlPort: Int
Link copied to clipboard
abstract val healthzPort: Int

The port the healthz server bound to, or -1 if healthz isn't configured on this node.

Link copied to clipboard
open var loginTimeout: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
abstract val serverPort: Int
Link copied to clipboard
abstract val serverReadOnlyPort: Int

Functions

Link copied to clipboard
abstract fun addMeterRegistry(meterRegistry: MeterRegistry)
Link copied to clipboard
abstract fun authenticateTrusted(user: String): Principal

user, taken at its word: neither credentials nor the node's authn rules are checked, so this authenticates any user, superuser included. Where the rules should decide, consult authMethodFor first.

Link copied to clipboard
abstract fun authenticateWithClientCredentials(clientId: String, clientSecret: String): Principal

The client clientId, having verified clientSecret with the node's authenticator (the OAuth client-credentials flow). The principal's user id is the one the authenticator resolves for that client.

Link copied to clipboard
abstract fun authenticateWithPassword(user: String, password: String): Principal

user, having verified password with the node's authenticator. The principal's user id is the one the authenticator resolves — for OIDC, the token's subject.

Link copied to clipboard
abstract fun authMethodFor(user: String?, remoteAddress: String?): Authenticator.Method?

The authentication method the node's configured authn rules ask of a caller claiming user from remoteAddress, or null if no rule matches and the caller is to be rejected.

Link copied to clipboard
abstract fun close()
Link copied to clipboard
abstract override fun connect(): Xtdb.Connection

abstract fun connect(dbName: DatabaseName): Xtdb.Connection

Opens an in-process connection to the named database.

abstract fun connect(dbName: DatabaseName, principal: Principal): Xtdb.Connection

Opens an in-process connection to the named database as principal: the connection's Connection.user is the principal's user id. The node doesn't check principal — obtain one from the authenticate… methods below.

Link copied to clipboard
Link copied to clipboard
abstract fun executeTx(ops: List<TxOp>, opts: TxOpts = TxOpts()): Xtdb.ExecutedTx

The transaction goes to TxOpts.dbName, defaulting to the primary database xtdb, and may only refer to tables within it — see Connection.

Link copied to clipboard
open override fun getConnection(): Connection
open override fun getConnection(username: String?, password: String?): Connection
Link copied to clipboard
open override fun getLoginTimeout(): Int
Link copied to clipboard
open override fun getLogWriter(): PrintWriter?
Link copied to clipboard
open fun <T : Any?> getOption(key: TypedKey<T?>?): T?
Link copied to clipboard
open override fun getParentLogger(): Logger
Link copied to clipboard
abstract fun isWrapperFor(p0: Class<*>?): Boolean
Link copied to clipboard
abstract fun latestCompletedTxs(): Map<DatabaseName, List<TransactionKey?>>

Each database's latest-completed transaction, per partition.

Link copied to clipboard
abstract fun <T : XtdbModule> module(type: Class<T>): T?
Link copied to clipboard
inline fun <T : XtdbModule> Xtdb.module(): T?
Link copied to clipboard
open override fun setLoginTimeout(seconds: Int)
Link copied to clipboard
open override fun setLogWriter(out: PrintWriter?)
Link copied to clipboard
open fun <T : Any?> setOption(key: TypedKey<T?>?, value: T?)
Link copied to clipboard

Starts the OAuth device-authorisation flow for user. Show the caller DeviceAuth.url, then call DeviceAuth.await, which blocks until they approve.

Link copied to clipboard
abstract fun submitTx(ops: List<TxOp>, opts: TxOpts = TxOpts()): Xtdb.SubmittedTx

The transaction goes to TxOpts.dbName, defaulting to the primary database xtdb, and may only refer to tables within it — see Connection.

Link copied to clipboard
abstract fun <T : Any?> unwrap(p0: Class<T?>?): T?