Package akka.cluster.ddata
Class ORMap<A,B extends ReplicatedData>
- java.lang.Object
-
- akka.cluster.ddata.ORMap<A,B>
-
- All Implemented Interfaces:
DeltaReplicatedData,RemovedNodePruning,ReplicatedData,ReplicatedDataSerialization,java.io.Serializable
public final class ORMap<A,B extends ReplicatedData> extends java.lang.Object implements DeltaReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classORMap.DeltaGroup$static interfaceORMap.DeltaOpstatic classORMap.PutDeltaOp$static classORMap.RemoveDeltaOp$static classORMap.RemoveKeyDeltaOp$static classORMap.UpdateDeltaOp$static classORMap.VanillaORMapTag$static interfaceORMap.ZeroTag
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ORMap<A,B>$colon$plus(scala.Tuple2<A,B> entry, SelfUniqueAddress node)Adds an entry to the mapstatic ORMap<java.lang.Object,ReplicatedData>apply()booleancontains(A key)static <A,B extends ReplicatedData>
ORMap<A,B>create()Java APIscala.Option<ORMap.DeltaOp>delta()The accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta().static <A,B extends ReplicatedData>
ORMap<A,B>empty()scala.collection.immutable.Map<A,B>entries()Scala API: All entries of the map.booleanequals(java.lang.Object o)scala.Option<B>get(A key)java.util.Map<A,B>getEntries()Java API: All entries of the map.BgetOrElse(A key, scala.Function0<B> default_)Scala API: Get the value associated with the key if there is one, else return the given default.inthashCode()booleanisEmpty()ORMap<A,B>merge(ORMap<A,B> that)ORMap<A,B>mergeDelta(ORMap.DeltaOp thatDelta)scala.collection.immutable.Set<UniqueAddress>modifiedByNodes()The nodes that have changed the state for this data and would need pruning when such node is no longer part of the cluster.booleanneedPruningFrom(UniqueAddress removedNode)Does it have any state changes from a specific node, which has been removed from the cluster.ORMap<A,B>prune(UniqueAddress removedNode, UniqueAddress collapseInto)When theremovednode 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,B>pruningCleanup(UniqueAddress removedNode)Remove data entries from a node that has been removed from the cluster and already been pruned.ORMap<A,B>put(SelfUniqueAddress node, A key, B value)Adds an entry to the map.ORMap<A,B>remove(SelfUniqueAddress node, A key)Java API Removes an entry from the map.ORMap<A,B>remove(A key, SelfUniqueAddress node)Scala API Removes an entry from the map.ORMap<A,B>resetDelta()Reset collection of deltas from mutator operations.intsize()java.lang.StringtoString()static <A,B extends ReplicatedData>
scala.Option<scala.collection.immutable.Map<A,B>>unapply(ORMap<A,B> m)Extract theentries().ORMap<A,B>update(SelfUniqueAddress node, A key, B initial, java.util.function.Function<B,B> modify)Java API: Replace a value by applying themodifyfunction on the existing value.ORMap<A,B>updated(Cluster node, A key, B initial, java.util.function.Function<B,B> modify)Deprecated.use update for the Java API as updated is ambiguous with the Scala API.ORMap<A,B>updated(SelfUniqueAddress node, A key, B initial, scala.Function1<B,B> modify)Scala API: Replace a value by applying themodifyfunction on the existing value.-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface akka.cluster.ddata.DeltaReplicatedData
mergeDelta
-
Methods inherited from interface akka.cluster.ddata.ReplicatedData
merge
-
-
-
-
Method Detail
-
empty
public static <A,B extends ReplicatedData> ORMap<A,B> empty()
-
apply
public static ORMap<java.lang.Object,ReplicatedData> apply()
-
create
public static <A,B extends ReplicatedData> ORMap<A,B> create()
Java API
-
unapply
public static <A,B extends ReplicatedData> scala.Option<scala.collection.immutable.Map<A,B>> unapply(ORMap<A,B> m)
Extract theentries().
-
delta
public scala.Option<ORMap.DeltaOp> delta()
Description copied from interface:DeltaReplicatedDataThe accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta(). When theReplicatorinvokes themodifyfunction of theUpdatemessage and the user code is invoking one or more mutator operations the data is collecting the delta of the operations and makes it available for theReplicatorwith theDeltaReplicatedData.delta()accessor. Themodifyfunction shall still return the full state in the same way asReplicatedDatawithout support for deltas.- Specified by:
deltain interfaceDeltaReplicatedData
-
getOrElse
public B getOrElse(A key, scala.Function0<B> default_)
Scala API: Get the value associated with the key if there is one, else return the given default.
-
contains
public boolean contains(A key)
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
$colon$plus
public ORMap<A,B> $colon$plus(scala.Tuple2<A,B> entry, SelfUniqueAddress node)
Adds an entry to the map
-
put
public ORMap<A,B> put(SelfUniqueAddress node, A key, B value)
Adds an entry to the map. Note that the newvaluewill be merged with existing values on other nodes and the outcome depends on whatReplicatedDatatype that is used.Consider using {@link ORMap#updated(node:akka\.cluster\.ddata\.SelfUniqueAddress*} instead of
putif you want modify existing entry.IllegalArgumentExceptionis thrown if you try to replace an existingORSetvalue, because important history can be lost when replacing theORSetand undesired effects of merging will occur. UseORMultiMapor {@link ORMap#updated(node:akka\.cluster\.ddata\.SelfUniqueAddress*} instead.
-
updated
public ORMap<A,B> updated(SelfUniqueAddress node, A key, B initial, scala.Function1<B,B> modify)
Scala API: Replace a value by applying themodifyfunction on the existing value.If there is no current value for the
keytheinitialvalue will be passed to themodifyfunction.
-
updated
public ORMap<A,B> updated(Cluster node, A key, B initial, java.util.function.Function<B,B> modify)
Deprecated.use update for the Java API as updated is ambiguous with the Scala API. Since 2.5.20.Java API: Replace a value by applying themodifyfunction on the existing value.If there is no current value for the
keytheinitialvalue will be passed to themodifyfunction.
-
update
public ORMap<A,B> update(SelfUniqueAddress node, A key, B initial, java.util.function.Function<B,B> modify)
Java API: Replace a value by applying themodifyfunction on the existing value.If there is no current value for the
keytheinitialvalue will be passed to themodifyfunction.
-
remove
public ORMap<A,B> remove(A key, SelfUniqueAddress node)
Scala API Removes an entry from the map. Note that if there is a conflicting update on another node the entry will not be removed after merge.
-
remove
public ORMap<A,B> remove(SelfUniqueAddress node, A key)
Java API Removes an entry from the map. Note that if there is a conflicting update on another node the entry will not be removed after merge.
-
resetDelta
public ORMap<A,B> resetDelta()
Description copied from interface:DeltaReplicatedDataReset collection of deltas from mutator operations. When theReplicatorinvokes themodifyfunction of theUpdatemessage the delta is always "reset" and when the user code is invoking one or more mutator operations the data is collecting the delta of the operations and makes it available for theReplicatorwith theDeltaReplicatedData.delta()accessor. When theReplicatorhas grabbed thedeltait will invoke this method to get a clean data instance without the delta.- Specified by:
resetDeltain interfaceDeltaReplicatedData
-
mergeDelta
public ORMap<A,B> mergeDelta(ORMap.DeltaOp thatDelta)
-
modifiedByNodes
public scala.collection.immutable.Set<UniqueAddress> modifiedByNodes()
Description copied from interface:RemovedNodePruningThe nodes that have changed the state for this data and would need pruning when such node is no longer part of the cluster.- Specified by:
modifiedByNodesin interfaceRemovedNodePruning
-
needPruningFrom
public boolean needPruningFrom(UniqueAddress removedNode)
Description copied from interface:RemovedNodePruningDoes it have any state changes from a specific node, which has been removed from the cluster.- Specified by:
needPruningFromin interfaceRemovedNodePruning
-
prune
public ORMap<A,B> prune(UniqueAddress removedNode, UniqueAddress collapseInto)
Description copied from interface:RemovedNodePruningWhen theremovednode has been removed from the cluster the state changes from that node will be pruned by collapsing the data entries to another node.- Specified by:
prunein interfaceRemovedNodePruning
-
pruningCleanup
public ORMap<A,B> pruningCleanup(UniqueAddress removedNode)
Description copied from interface:RemovedNodePruningRemove data entries from a node that has been removed from the cluster and already been pruned.- Specified by:
pruningCleanupin interfaceRemovedNodePruning
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-