kv / org.apache.tuweni.kv / LevelDBKeyValueStore

LevelDBKeyValueStore

class LevelDBKeyValueStore : KeyValueStore (source)

A key-value store backed by LevelDB.

Parameters

dbPath - The path to the levelDB database.

options - Options for the levelDB database.

dispatcher - The co-routine context for blocking tasks.

Exceptions

IOException - If an I/O error occurs.

Return
A key-value store.

Constructors

<init>

LevelDBKeyValueStore(dbPath: Path, options: Options = Options().createIfMissing(true).cacheSize((100 * 1048576).toLong()), dispatcher: CoroutineDispatcher = Dispatchers.IO)

Open a LevelDB-backed key-value store.

Functions

close

fun close(): Unit

Closes the underlying LevelDB instance.

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(dbPath: Path): LevelDBKeyValueStore
fun open(dbPath: Path, options: Options): LevelDBKeyValueStore

Open a LevelDB-backed key-value store.