public final class ORMap<A extends ReplicatedData> extends java.lang.Object implements ReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
It has similar semantics as an ORSet
, but in case of concurrent updates
the values are merged, and must therefore be ReplicatedData
types themselves.
This class is immutable, i.e. "modifying" methods return a new instance.
Constructor and Description |
---|
ORMap(ORSet<java.lang.String> keys,
scala.collection.immutable.Map<java.lang.String,A> values) |
Modifier and Type | Method and Description |
---|---|
static ORMap<ReplicatedData> |
apply() |
boolean |
contains(java.lang.String key) |
static <A extends ReplicatedData> |
create()
Java API
|
static <A extends ReplicatedData> |
empty() |
scala.collection.immutable.Map<java.lang.String,A> |
entries()
Scala API: All entries of the map.
|
boolean |
equals(java.lang.Object o) |
scala.Option<A> |
get(java.lang.String key) |
java.util.Map<java.lang.String,A> |
getEntries()
Java API: All entries of the map.
|
A |
getOrElse(java.lang.String key,
scala.Function0<A> default_)
Scala API: Get the value associated with the key if there is one,
else return the given default.
|
int |
hashCode() |
boolean |
isEmpty() |
ORSet<java.lang.String> |
keys() |
ORMap<A> |
merge(ORMap<A> that) |
boolean |
needPruningFrom(UniqueAddress removedNode)
Does it have any state changes from a specific node,
which has been removed from the cluster.
|
ORMap<A> |
prune(UniqueAddress removedNode,
UniqueAddress collapseInto)
When the
removed node has been removed from the cluster the state
changes from that node will be pruned by collapsing the data entries
to another node. |
ORMap<A> |
pruningCleanup(UniqueAddress removedNode)
Remove data entries from a node that has been removed from the cluster
and already been pruned.
|
ORMap<A> |
put(Cluster node,
java.lang.String key,
A value)
Adds an entry to the map.
|
ORMap<A> |
put(UniqueAddress node,
java.lang.String key,
A value)
INTERNAL API
|
ORMap<A> |
remove(Cluster node,
java.lang.String key)
Removes an entry from the map.
|
ORMap<A> |
remove(UniqueAddress node,
java.lang.String key)
INTERNAL API
|
int |
size() |
java.lang.String |
toString() |
static <A extends ReplicatedData> |
unapply(ORMap<A> m)
Extract the
entries() . |
ORMap<A> |
updated(Cluster node,
java.lang.String key,
A initial,
java.util.function.Function<A,A> modify)
Java API: Replace a value by applying the
modify function on the existing value. |
ORMap<A> |
updated(Cluster node,
java.lang.String key,
A initial,
scala.Function1<A,A> modify)
Scala API: Replace a value by applying the
modify function on the existing value. |
ORMap<A> |
updated(UniqueAddress node,
java.lang.String key,
A initial,
scala.Function1<A,A> modify)
INTERNAL API
|
scala.collection.immutable.Map<java.lang.String,A> |
values() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
merge
public static <A extends ReplicatedData> ORMap<A> empty()
public static ORMap<ReplicatedData> apply()
public static <A extends ReplicatedData> ORMap<A> create()
public static <A extends ReplicatedData> scala.Option<scala.collection.immutable.Map<java.lang.String,A>> unapply(ORMap<A> m)
entries()
.m
- (undocumented)public ORSet<java.lang.String> keys()
public scala.collection.immutable.Map<java.lang.String,A> values()
public scala.collection.immutable.Map<java.lang.String,A> entries()
public java.util.Map<java.lang.String,A> getEntries()
public scala.Option<A> get(java.lang.String key)
public A getOrElse(java.lang.String key, scala.Function0<A> default_)
key
- (undocumented)default_
- (undocumented)public boolean contains(java.lang.String key)
public boolean isEmpty()
public int size()
public ORMap<A> put(Cluster node, java.lang.String key, A value)
value
will be merged with existing values
on other nodes and the outcome depends on what ReplicatedData
type that is used.
Consider using updated(akka.cluster.Cluster, java.lang.String, A, scala.Function1<A, A>)
instead of put
if you want modify
existing entry.
IllegalArgumentException
is thrown if you try to replace an existing ORSet
value, because important history can be lost when replacing the ORSet
and
undesired effects of merging will occur. Use ORMultiMap
or updated(akka.cluster.Cluster, java.lang.String, A, scala.Function1<A, A>)
instead.
node
- (undocumented)key
- (undocumented)value
- (undocumented)public ORMap<A> put(UniqueAddress node, java.lang.String key, A value)
node
- (undocumented)key
- (undocumented)value
- (undocumented)public ORMap<A> updated(Cluster node, java.lang.String key, A initial, scala.Function1<A,A> modify)
modify
function on the existing value.
If there is no current value for the key
the initial
value will be
passed to the modify
function.
node
- (undocumented)key
- (undocumented)initial
- (undocumented)modify
- (undocumented)public ORMap<A> updated(Cluster node, java.lang.String key, A initial, java.util.function.Function<A,A> modify)
modify
function on the existing value.
If there is no current value for the key
the initial
value will be
passed to the modify
function.
node
- (undocumented)key
- (undocumented)initial
- (undocumented)modify
- (undocumented)public ORMap<A> updated(UniqueAddress node, java.lang.String key, A initial, scala.Function1<A,A> modify)
node
- (undocumented)key
- (undocumented)initial
- (undocumented)modify
- (undocumented)public ORMap<A> remove(Cluster node, java.lang.String key)
node
- (undocumented)key
- (undocumented)public ORMap<A> remove(UniqueAddress node, java.lang.String key)
node
- (undocumented)key
- (undocumented)public boolean needPruningFrom(UniqueAddress removedNode)
RemovedNodePruning
needPruningFrom
in interface RemovedNodePruning
removedNode
- (undocumented)public ORMap<A> prune(UniqueAddress removedNode, UniqueAddress collapseInto)
RemovedNodePruning
removed
node has been removed from the cluster the state
changes from that node will be pruned by collapsing the data entries
to another node.prune
in interface RemovedNodePruning
removedNode
- (undocumented)collapseInto
- (undocumented)public ORMap<A> pruningCleanup(UniqueAddress removedNode)
RemovedNodePruning
pruningCleanup
in interface RemovedNodePruning
removedNode
- (undocumented)public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object