Package org.apache.pekko.cluster.ddata
Class ORMap<A,B extends ReplicatedData>
java.lang.Object
org.apache.pekko.cluster.ddata.ORMap<A,B>
- All Implemented Interfaces:
Serializable,DeltaReplicatedData,RemovedNodePruning,ReplicatedData,ReplicatedDataSerialization
public final class ORMap<A,B extends ReplicatedData>
extends Object
implements DeltaReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic interfacestatic classstatic classstatic classstatic classstatic classstatic interface -
Method Summary
Modifier and TypeMethodDescription$colon$plus(scala.Tuple2<A, B> entry, SelfUniqueAddress node) Adds an entry to the mapstatic ORMap<Object,ReplicatedData> apply()booleanstatic <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()entries()Scala API: All entries of the map.booleanscala.Option<B>Java API: All entries of the map.Scala API: Get the value associated with the key if there is one, else return the given default.inthashCode()booleanisEmpty()mergeDelta(ORMap.DeltaOp thatDelta) scala.collection.immutable.Set<UniqueAddress>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.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.pruningCleanup(UniqueAddress removedNode) Remove data entries from a node that has been removed from the cluster and already been pruned.put(SelfUniqueAddress node, A key, B value) Adds an entry to the map.remove(A key, SelfUniqueAddress node) Scala API Removes an entry from the map.remove(SelfUniqueAddress node, A key) Java API Removes an entry from the map.Reset collection of deltas from mutator operations.intsize()toString()static <A,B extends ReplicatedData>
scala.Option<scala.collection.immutable.Map<A,B>> Extract theentries().Java API: Replace a value by applying themodifyfunction on the existing value.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, waitMethods inherited from interface org.apache.pekko.cluster.ddata.DeltaReplicatedData
mergeDeltaMethods inherited from interface org.apache.pekko.cluster.ddata.ReplicatedData
merge
-
Method Details
-
empty
-
apply
-
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
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
-
entries
Scala API: All entries of the map. -
getEntries
Java API: All entries of the map. -
get
-
getOrElse
Scala API: Get the value associated with the key if there is one, else return the given default. -
contains
-
isEmpty
public boolean isEmpty() -
size
public int size() -
$colon$plus
Adds an entry to the map -
put
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:org\.apache\.pekko\.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:org\.apache\.pekko\.cluster\.ddata\.SelfUniqueAddress*} instead. -
updated
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. -
update
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
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
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. -
merge
-
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
-
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
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
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
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
-
equals
-
hashCode
public int hashCode()
-