#22035 Make it possible to use anything as the key in a map

- All Map types are now generic in their key: ORMap, ORMultiMap, LWWMap,
  PNCounterMap
- test for binary compatibility with previous version for serialization
- entries are sorted for deterministic SHA-1 on same value
This commit is contained in:
Jeroen Gordijn 2016-12-22 11:47:27 +01:00
parent 5c79b81e92
commit 8499ff6faf
28 changed files with 2231 additions and 584 deletions

View file

@ -301,7 +301,7 @@ class DistributedDataDocSpec extends AkkaSpec(DistributedDataDocSpec.config) {
def println(o: Any): Unit = ()
//#pncountermap
implicit val node = Cluster(system)
val m0 = PNCounterMap.empty
val m0 = PNCounterMap.empty[String]
val m1 = m0.increment("a", 7)
val m2 = m1.decrement("a", 2)
val m3 = m2.increment("b", 1)
@ -337,7 +337,7 @@ class DistributedDataDocSpec extends AkkaSpec(DistributedDataDocSpec.config) {
def println(o: Any): Unit = ()
//#ormultimap
implicit val node = Cluster(system)
val m0 = ORMultiMap.empty[Int]
val m0 = ORMultiMap.empty[String, Int]
val m1 = m0 + ("a" -> Set(1, 2, 3))
val m2 = m1.addBinding("a", 4)
val m3 = m2.removeBinding("a", 2)

View file

@ -313,7 +313,7 @@ track causality of the operations and resolve concurrent updates.
Maps
----
``ORMap`` (observed-remove map) is a map with ``String`` keys and the values are ``ReplicatedData``
``ORMap`` (observed-remove map) is a map with keys of ``Any`` type and the values are ``ReplicatedData``
types themselves. It supports add, remove and delete any number of times for a map entry.
If an entry is concurrently added and removed, the add will win. You cannot remove an entry that
@ -329,8 +329,8 @@ such as the following specialized maps.
``ORMultiMap`` (observed-remove multi-map) is a multi-map implementation that wraps an
``ORMap`` with an ``ORSet`` for the map's value.
``PNCounterMap`` (positive negative counter map) is a map of named counters. It is a specialized
``ORMap`` with ``PNCounter`` values.
``PNCounterMap`` (positive negative counter map) is a map of named counters (where the name can be of any type).
It is a specialized ``ORMap`` with ``PNCounter`` values.
``LWWMap`` (last writer wins map) is a specialized ``ORMap`` with ``LWWRegister`` (last writer wins register)
values.