Package org.apache.pekko.cluster.ddata
Class ORMultiMap<A,B> 
java.lang.Object
org.apache.pekko.cluster.ddata.ORMultiMap<A,B> 
- All Implemented Interfaces:
- Serializable,- DeltaReplicatedData,- RemovedNodePruning,- ReplicatedData,- ReplicatedDataSerialization
public final class ORMultiMap<A,B> 
extends Object
implements DeltaReplicatedData, ReplicatedDataSerialization, RemovedNodePruning
An immutable multi-map implementation. This class wraps an
 
ORMap with an ORSet for the map's value.
 This class is immutable, i.e. "modifying" methods return a new instance.
Note that on concurrent adds and removals for the same key (on the same set), removals can be lost.
- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classINTERNAL APIstatic classINTERNAL API
- 
Method SummaryModifier and TypeMethodDescriptionstatic ORMultiMap<Object,Object> _empty()static ORMultiMap<Object,Object> ORMultiMap<A,B> $colon$plus(scala.Tuple2<A, scala.collection.immutable.Set<B>> entry, SelfUniqueAddress node) Convenience for put.ORMultiMap<A,B> addBinding(SelfUniqueAddress node, A key, B element) Add an element to a set associated with a key.ORMultiMap<A,B> addBindingBy(A key, B element, SelfUniqueAddress node) static ORMultiMap<Object,Object> apply()booleanstatic <A,B> ORMultiMap<A, B> create()Java APIscala.Option<ORMap.DeltaOp>delta()The accumulated delta of mutator operations since previousDeltaReplicatedData.resetDelta().static <A,B> ORMultiMap<A, B> empty()Provides an empty multimap.static <A,B> ORMultiMap<A, B> entries()Scala API: All entries of a multimap where keys are strings and values are sets.booleanscala.Option<scala.collection.immutable.Set<B>>Get the set associated with the key if there is one.Java API: All entries of a multimap where keys are strings and values are sets.scala.collection.immutable.Set<B>Scala API: Get the set associated with the key if there is one, else return the given default.inthashCode()booleanisEmpty()ORMultiMap<A,B> merge(ORMultiMap<A, B> that) ORMultiMap<A,B> 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.ORMultiMap<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.ORMultiMap<A,B> pruningCleanup(UniqueAddress removedNode) Remove data entries from a node that has been removed from the cluster and already been pruned.ORMultiMap<A,B> put(SelfUniqueAddress node, A key, Set<B> value) Java API: Associate an entire set with the key while retaining the history of the previous replicated data set.ORMultiMap<A,B> put(SelfUniqueAddress node, A key, scala.collection.immutable.Set<B> value) Scala API: Associate an entire set with the key while retaining the history of the previous replicated data set.ORMultiMap<A,B> remove(A key, SelfUniqueAddress node) Scala API Remove an entire set associated with the key.ORMultiMap<A,B> remove(SelfUniqueAddress node, A key) Java API Remove an entire set associated with the key.ORMultiMap<A,B> removeBinding(SelfUniqueAddress node, A key, B element) Remove an element of a set associated with a key.ORMultiMap<A,B> removeBindingBy(A key, B element, SelfUniqueAddress node) ORMultiMap<A,B> replaceBinding(SelfUniqueAddress node, A key, B oldElement, B newElement) Replace an element of a set associated with a key with a new one if it is different.ORMultiMap<A,B> replaceBindingBy(A key, B oldElement, B newElement, SelfUniqueAddress node) ORMultiMap<A,B> Reset collection of deltas from mutator operations.intsize()toString()static <A,B extends ReplicatedData> 
 scala.Option<scala.collection.immutable.Map<A,scala.collection.immutable.Set<B>>> Extract theentries()of anORMultiMap.static <A,B> scala.Option<scala.collection.immutable.Map<A, scala.collection.immutable.Set<B>>> unapply(ORMultiMap<A, B> m) Extract theentries().Methods inherited from class java.lang.Objectclone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.pekko.cluster.ddata.DeltaReplicatedDatamergeDeltaMethods inherited from interface org.apache.pekko.cluster.ddata.ReplicatedDatamerge
- 
Method Details- 
_empty
- 
_emptyWithValueDeltas
- 
emptyProvides an empty multimap.
- 
emptyWithValueDeltas
- 
apply
- 
createJava API
- 
unapplypublic static <A,B> scala.Option<scala.collection.immutable.Map<A,scala.collection.immutable.Set<B>>> unapply(ORMultiMap<A, B> m) Extract theentries().
- 
unapplypublic static <A,B extends ReplicatedData> scala.Option<scala.collection.immutable.Map<A,scala.collection.immutable.Set<B>>> unapply(Object value) Extract theentries()of anORMultiMap.
- 
merge
- 
entriesScala API: All entries of a multimap where keys are strings and values are sets.
- 
getEntriesJava API: All entries of a multimap where keys are strings and values are sets.
- 
getGet the set associated with the key if there is one.
- 
getOrElsepublic scala.collection.immutable.Set<B> getOrElse(A key, scala.Function0<scala.collection.immutable.Set<B>> default_) Scala API: Get the set associated with the key if there is one, else return the given default.
- 
contains
- 
isEmptypublic boolean isEmpty()
- 
sizepublic int size()
- 
$colon$pluspublic ORMultiMap<A,B> $colon$plus(scala.Tuple2<A, scala.collection.immutable.Set<B>> entry, SelfUniqueAddress node) Convenience for put. Requires an implicit SelfUniqueAddress.
- 
putScala API: Associate an entire set with the key while retaining the history of the previous replicated data set.
- 
putJava API: Associate an entire set with the key while retaining the history of the previous replicated data set.
- 
removeScala API Remove an entire set associated with the key.
- 
removeJava API Remove an entire set associated with the key.
- 
addBindingAdd an element to a set associated with a key. If there is no existing set then one will be initialised. TODO add implicit after deprecated is EOL.
- 
addBindingBy
- 
removeBindingRemove an element of a set associated with a key. If there are no more elements in the set then the entire set will be removed. TODO add implicit after deprecated is EOL.
- 
removeBindingBy
- 
replaceBindingReplace an element of a set associated with a key with a new one if it is different. This is useful when an element is removed and another one is added within the same Update. The order of addition and removal is important in order to retain history for replicated data.
- 
replaceBindingBy
- 
resetDeltaDescription 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 interface- DeltaReplicatedData
 
- 
deltaDescription 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 interface- DeltaReplicatedData
 
- 
mergeDelta
- 
modifiedByNodesDescription 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 interface- RemovedNodePruning
 
- 
needPruningFromDescription copied from interface:RemovedNodePruningDoes it have any state changes from a specific node, which has been removed from the cluster.- Specified by:
- needPruningFromin interface- RemovedNodePruning
 
- 
pruningCleanupDescription copied from interface:RemovedNodePruningRemove data entries from a node that has been removed from the cluster and already been pruned.- Specified by:
- pruningCleanupin interface- RemovedNodePruning
 
- 
pruneDescription 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 interface- RemovedNodePruning
 
- 
toString
- 
equals
- 
hashCodepublic int hashCode()
 
-