tuweni / org.apache.tuweni.kv / MapKeyValueStore

MapKeyValueStore

class MapKeyValueStore : KeyValueStore (source)

A key-value store backed by an in-memory Map.

Parameters

map - The backing map for this store.

Return
A key-value store.

Constructors

<init>

MapKeyValueStore(map: MutableMap<Bytes, Bytes> = HashMap())

Open an in-memory key-value store.

Functions

close

fun close(): Unit

Has no effect in this KeyValueStore implementation.

get

suspend fun get(key: Bytes): Bytes?

Retrieves data from the store.

put

suspend fun put(key: Bytes, value: Bytes): Unit

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(): MapKeyValueStore
fun open(map: MutableMap<Bytes, Bytes>): MapKeyValueStore

Open an in-memory key-value store.