trait ORMap[K, V <: Crdt] extends Crdt with Map[K, V]
An Observed-Removed Map.
An Observed-Removed Map allows both the addition and removal of objects in a map. A removal can only be done if all of the additions that caused the key to be in the map have been seen by this node. This means that, for example, if node 1 adds key A, and node 2 also adds key A, then node 1's addition is replicated to node 3, and node 3 deletes it before node 2's addition is replicated, then the item will still be in the map because node 2's addition had not yet been observed by node 3. However, if both additions had been replicated to node 3, then the key will be removed.
The values of the map are themselves CRDTs, and hence allow concurrent updates that will eventually converge. Values
may only be inserted using the Function) function, using the CrdtFactory
passed in to the creation callback. Invoking Crdt) or any other insertion method will throw
a UnsupportedOperationException.
While removing entries from the map is supported, if the entries are added back again, it is possible that the value of the deleted entry may be merged into the value of the current entry, depending on whether the removal has been replicated to all nodes before the addition is performed.
The map may contain different CRDT types as values, however, for a given key, the type must never change. If two different types for the same key are inserted on different nodes, the CRDT will enter an invalid state that can never be merged, and behavior of the CRDT is undefined.
Care needs to be taken to ensure that the serialized value of keys in the set is stable. For example, if using protobufs, the serialized value of any maps contained in the protobuf is not stable, and can yield a different set of bytes for the same logically equal element. Hence maps should be avoided. Additionally, some changes in protobuf schemas which are backwards compatible from a protobuf perspective, such as changing from sint32 to int32, do result in different serialized bytes, and so must be avoided.
- Alphabetic
- By Inheritance
- ORMap
- Map
- Crdt
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
-
abstract
def
clear(): Unit
- Definition Classes
- Map
-
abstract
def
containsKey(arg0: Any): Boolean
- Definition Classes
- Map
-
abstract
def
containsValue(arg0: Any): Boolean
- Definition Classes
- Map
-
abstract
def
entrySet(): Set[Entry[K, V]]
- Definition Classes
- Map
-
abstract
def
get(arg0: Any): V
- Definition Classes
- Map
-
abstract
def
getOrCreate(key: K, create: Function[CrdtFactory, V]): V
Get or create an entry in the map with the given key.
Get or create an entry in the map with the given key.
- key
The key of the entry.
- create
A callback used to create the value using the given
CrdtFactoryif an entry for the key is not currently in the map.- returns
The existing or newly created value for the given key.
-
abstract
def
isEmpty(): Boolean
- Definition Classes
- Map
-
abstract
def
keySet(): Set[K]
- Definition Classes
- Map
-
abstract
def
putAll(arg0: Map[_ <: K, _ <: V]): Unit
- Definition Classes
- Map
-
abstract
def
remove(arg0: Any): V
- Definition Classes
- Map
-
abstract
def
size(): Int
- Definition Classes
- Map
-
abstract
def
values(): Collection[V]
- Definition Classes
- Map
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()
-
def
compute(arg0: K, arg1: BiFunction[_ >: K, _ >: V, _ <: V]): V
- Definition Classes
- Map
-
def
computeIfAbsent(arg0: K, arg1: Function[_ >: K, _ <: V]): V
- Definition Classes
- Map
-
def
computeIfPresent(arg0: K, arg1: BiFunction[_ >: K, _ >: V, _ <: V]): V
- Definition Classes
- Map
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
def
forEach(arg0: BiConsumer[_ >: K, _ >: V]): Unit
- Definition Classes
- Map
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
getOrDefault(arg0: Any, arg1: V): V
- Definition Classes
- Map
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
merge(arg0: K, arg1: V, arg2: BiFunction[_ >: V, _ >: V, _ <: V]): V
- Definition Classes
- Map
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
put(key: K, value: V): V
Not supported on ORMap.
Not supported on ORMap. Use
Function)instead.- Definition Classes
- ORMap → Map
-
def
putIfAbsent(arg0: K, arg1: V): V
- Definition Classes
- Map
-
def
remove(arg0: Any, arg1: Any): Boolean
- Definition Classes
- Map
-
def
replace(arg0: K, arg1: V): V
- Definition Classes
- Map
-
def
replace(arg0: K, arg1: V, arg2: V): Boolean
- Definition Classes
- Map
-
def
replaceAll(arg0: BiFunction[_ >: K, _ >: V, _ <: V]): Unit
- Definition Classes
- Map
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... ) @native()