Store

interface Store<K : Any, V : Any, T> : StoreReader<K, V> , StoreWriter<K, V, T> (source)

Combines StoreReader and StoreWriter for a backend that implements both.

Functions

Link copied to clipboard
abstract fun delete(key: K, tx: TxContext<T>): Long

Deletes key and returns the version the store assigned the removal.

Link copied to clipboard
abstract fun load(key: K): Versioned<V>?

abstract fun load(key: K, tx: TxContext<T>): Versioned<V>?

Reads key's current persisted value within tx for read-modify-write, e.g. a locking SELECT … FOR UPDATE on the transaction's connection. Override it to support MutableFlowStore.get within a transaction (the default throws); the read should see the transaction's own uncommitted writes and serialise concurrent writers.

Link copied to clipboard
abstract fun write(key: K, value: V, tx: TxContext<T>): Long

Writes value for key and returns the version the store assigned it.

Link copied to clipboard
open fun writeAll(values: Map<K, V>, tx: TxContext<T>): Map<K, Long>

Writes many entries, returning the version assigned to each.