public class DistributedImmutableMap<K,V>
A distributed map state machine that doesn't 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.
Modifier and Type | Class and Description |
---|---|
static class |
DistributedImmutableMap.Commands |
static class |
DistributedImmutableMap.Companion |
Modifier and Type | Field and Description |
---|---|
static DistributedImmutableMap.Companion |
Companion |
Constructor and Description |
---|
DistributedImmutableMap(org.jetbrains.exposed.sql.Database db,
java.lang.String tableName)
A distributed map state machine that doesn't allow overriding values. The state machine is replicated
across a Copycat Raft cluster.
|
Modifier and Type | Method and Description |
---|---|
V |
get(io.atomix.copycat.server.Commit<net.corda.node.services.transactions.DistributedImmutableMap.Commands.Get> commit)
Gets a value for the given Commands.Get.key
|
org.jetbrains.exposed.sql.Database |
getDb() |
void |
install(io.atomix.copycat.server.storage.snapshot.SnapshotReader reader)
Reads entries from disk and adds them to map.
|
java.util.Map<K,V> |
put(io.atomix.copycat.server.Commit<net.corda.node.services.transactions.DistributedImmutableMap.Commands.PutAll> commit)
Stores the given Commands.PutAll.entries if no entry key already exists.
|
int |
size(io.atomix.copycat.server.Commit<net.corda.node.services.transactions.DistributedImmutableMap.Commands.Size> commit) |
void |
snapshot(io.atomix.copycat.server.storage.snapshot.SnapshotWriter writer)
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.
|
public static DistributedImmutableMap.Companion Companion
public DistributedImmutableMap(org.jetbrains.exposed.sql.Database db, java.lang.String tableName)
A distributed map state machine that doesn't 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.
public V get(io.atomix.copycat.server.Commit<net.corda.node.services.transactions.DistributedImmutableMap.Commands.Get> commit)
Gets a value for the given Commands.Get.key
public java.util.Map<K,V> put(io.atomix.copycat.server.Commit<net.corda.node.services.transactions.DistributedImmutableMap.Commands.PutAll> commit)
Stores the given Commands.PutAll.entries if no entry key already exists.
public int size(io.atomix.copycat.server.Commit<net.corda.node.services.transactions.DistributedImmutableMap.Commands.Size> commit)
public void snapshot(io.atomix.copycat.server.storage.snapshot.SnapshotWriter writer)
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.
public void install(io.atomix.copycat.server.storage.snapshot.SnapshotReader reader)
Reads entries from disk and adds them to map.
public org.jetbrains.exposed.sql.Database getDb()