net.corda.node.services.transactions / DistributedImmutableMap

DistributedImmutableMap

class DistributedImmutableMap<K : Any, V : Any>

A distributed map state machine that doesnt allow overriding values. The state machine is replicated across a Copycat Raft cluster.

The map contents are backed by a JDBC table. State re-synchronisation is achieved by periodically persisting snapshots to disk, and sharing them across the cluster. A new node joining the cluster will have to obtain and install a snapshot containing the entire JDBC table contents.





Types

Commands object Commands

Constructors

<init> DistributedImmutableMap(db: <ERROR CLASS>, tableName: String = DEFAULT_TABLE_NAME)

A distributed map state machine that doesnt allow overriding values. The state machine is replicated across a Copycat Raft cluster.

Properties

db val db: <ERROR CLASS>

Functions

get fun get(commit: <ERROR CLASS><Get<K, V>>): V?

Gets a value for the given Commands.Get.key

install fun install(reader: <ERROR CLASS>): Unit

Reads entries from disk and adds them to map.

put fun put(commit: <ERROR CLASS><PutAll<K, V>>): Map<K, V>

Stores the given Commands.PutAll.entries if no entry key already exists.

size fun size(commit: <ERROR CLASS><Size>): Int
snapshot fun snapshot(writer: <ERROR CLASS>): Unit

Writes out all map entries to disk. Note that this operation does not load all entries into memory, as the SnapshotWriter is using a disk-backed buffer internally, and iterating map entries results in only a fixed number of recently accessed entries to ever be kept in memory.