tuweni / org.apache.tuweni.kv / SQLKeyValueStore

SQLKeyValueStore

class SQLKeyValueStore : KeyValueStore (source)

A key-value store backed by a relational database.

Parameters

jdbcurl - The JDBC url to connect to the database.

tableName - the name of the table to use for storage.

keyColumn - the key column of the store.

valueColumn - the value column of the store.

dispatcher - The co-routine context for blocking tasks.

Exceptions

IOException - If an I/O error occurs.

Return
A key-value store.

Constructors

<init>

SQLKeyValueStore(jdbcurl: String, tableName: String = "store", keyColumn: String = "key", valueColumn: String = "value", dispatcher: CoroutineDispatcher = Dispatchers.IO)

Open a relational database backed key-value store.

Properties

keyColumn

val keyColumn: String

the key column of the store.

tableName

val tableName: String

the name of the table to use for storage.

valueColumn

val valueColumn: String

the value column of the store.

Functions

close

fun close(): <ERROR CLASS>

Closes the underlying connection pool.

get

suspend fun get(key: Bytes): Bytes?

Retrieves data from the store.

put

suspend fun put(key: Bytes, value: Bytes): <ERROR CLASS>

Puts data into the store.

Inherited Functions

getAsync

open fun getAsync(key: Bytes): AsyncResult<Bytes?>
open fun getAsync(dispatcher: CoroutineDispatcher, key: Bytes): AsyncResult<Bytes?>

Retrieves data from the store.

putAsync

open fun putAsync(key: Bytes, value: Bytes): AsyncCompletion
open fun putAsync(dispatcher: CoroutineDispatcher, key: Bytes, value: Bytes): AsyncCompletion

Puts data into the store.

Companion Object Functions

open

fun open(jdbcUrl: String): SQLKeyValueStore
fun open(jdbcUrl: String, tableName: String, keyColumn: String, valueColumn: String): SQLKeyValueStore

Open a relational database backed key-value store.