KandraRuntime

class KandraRuntime(val session: CqlSession, val batchEngine: BatchEngine, val codec: KandraCodec)

Entry point for all Kandra operations. Obtained from application.kandra in Ktor routes.

Tracks inFlightCount for graceful shutdown drain and isShuttingDown to reject new queries after shutdown is signalled.

application.kandra.batch {
userRepo.saveInBatch(user)
walletRepo.saveInBatch(wallet)
}

Constructors

Link copied to clipboard
constructor(session: CqlSession, batchEngine: BatchEngine, codec: KandraCodec)

Properties

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

Delegating to batchEngine so the shutdown hook and execute guards share one AtomicBoolean.

Link copied to clipboard
val session: CqlSession

Functions

Link copied to clipboard
suspend fun batch(block: suspend KandraBatchScope.() -> Unit)

Executes all operations in block as a single LOGGED batch.

Link copied to clipboard

Blocking variant of batch for use in non-suspend contexts.

Link copied to clipboard
suspend fun isHealthy(): Boolean

Returns true when ScyllaDB is reachable. Safe to use in health check endpoints.

Link copied to clipboard
inline fun <T : Any> repository(): KandraRepository<T>

fun <T : Any> repository(entityClass: KClass<T>): KandraRepository<T>

Creates a blocking repository for entityClass. For blocking contexts only — use suspendRepository in Ktor routes.

Link copied to clipboard

Creates a suspend (coroutine-friendly) repository for entityClass. Preferred for Ktor routes.