LWWMap

Specialized ORMap with LWWRegister values.

LWWRegister relies on synchronized clocks and should only be used when the choice of value is not important for concurrent updates occurring within the clock skew.

Instead of using timestamps based on System.currentTimeMillis() time it is possible to use a timestamp value based on something else, for example an increasing version number from a database record that is used for optimistic concurrency control.

The defaultClock is using max value of System.currentTimeMillis() and currentTimestamp + 1. This means that the timestamp is increased for changes on the same node that occurs within the same millisecond. It also means that it is safe to use the LWWMap without synchronized clocks when there is only one active writer, e.g. a Cluster Singleton. Such a single writer should then first read current value with ReadMajority (or more) before changing and writing the value with WriteMajority (or more).

For first-write-wins semantics you can use the LWWRegister#reverseClock instead of the LWWRegister#defaultClock

This class is immutable, i.e. "modifying" methods return a new instance.

Companion:
object
Source:
LWWMap.scala
trait Serializable
class Object
trait Matchable
class Any

Type members

Types

type D = DeltaOp
type T = LWWMap[A, B]

Value members

Concrete methods

def :+(entry: (A, B))(implicit node: SelfUniqueAddress): LWWMap[A, B]

Adds an entry to the map

Adds an entry to the map

Source:
LWWMap.scala
def contains(key: A): Boolean
override def delta: Option[D]
Definition Classes
Source:
LWWMap.scala
def entries: Map[A, B]

Scala API: All entries of the map.

Scala API: All entries of the map.

Source:
LWWMap.scala
override def equals(o: Any): Boolean
Definition Classes
Any
Source:
LWWMap.scala
def get(key: A): Option[B]
def getEntries(): Map[A, B]

Java API: All entries of the map.

Java API: All entries of the map.

Source:
LWWMap.scala
override def hashCode: Int
Definition Classes
Any
Source:
LWWMap.scala
override def merge(that: LWWMap[A, B]): LWWMap[A, B]
Definition Classes
Source:
LWWMap.scala
override def mergeDelta(thatDelta: D): LWWMap[A, B]
Definition Classes
Source:
LWWMap.scala
Definition Classes
Source:
LWWMap.scala
override def needPruningFrom(removedNode: UniqueAddress): Boolean
Definition Classes
Source:
LWWMap.scala
override def prune(removedNode: UniqueAddress, collapseInto: UniqueAddress): LWWMap[A, B]
Definition Classes
Source:
LWWMap.scala
override def pruningCleanup(removedNode: UniqueAddress): LWWMap[A, B]
Definition Classes
Source:
LWWMap.scala
def put(node: SelfUniqueAddress, key: A, value: B): LWWMap[A, B]

Adds an entry to the map

Adds an entry to the map

Source:
LWWMap.scala
def put(node: SelfUniqueAddress, key: A, value: B, clock: Clock[B]): LWWMap[A, B]

Adds an entry to the map.

Adds an entry to the map.

You can provide your clock implementation instead of using timestamps based on System.currentTimeMillis() time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.

Source:
LWWMap.scala
def remove(node: SelfUniqueAddress, key: A): LWWMap[A, B]

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.

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.

Source:
LWWMap.scala
override def resetDelta: LWWMap[A, B]
Definition Classes
Source:
LWWMap.scala
def size: Int
override def toString: String
Definition Classes
Any
Source:
LWWMap.scala

Deprecated methods

@deprecated("Use `:+` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
def +(entry: (A, B))(implicit node: Cluster): LWWMap[A, B]
Deprecated
[Since version 2.5.20]
Source:
LWWMap.scala
@deprecated("Use `remove` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
def -(key: A)(implicit node: Cluster): LWWMap[A, B]

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.

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.

Deprecated
[Since version 2.5.20]
Source:
LWWMap.scala
@deprecated("Use `put` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
def put(node: Cluster, key: A, value: B): LWWMap[A, B]
Deprecated
[Since version 2.5.20]
Source:
LWWMap.scala
@deprecated("Use `put` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
def put(node: Cluster, key: A, value: B, clock: Clock[B]): LWWMap[A, B]
Deprecated
[Since version 2.5.20]
Source:
LWWMap.scala
@deprecated("Use `put` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
def put(key: A, value: B)(implicit node: Cluster, clock: Clock[B]): LWWMap[A, B]

Adds an entry to the map.

Adds an entry to the map.

You can provide your clock implementation instead of using timestamps based on System.currentTimeMillis() time. The timestamp can for example be an increasing version number from a database record that is used for optimistic concurrency control.

Deprecated
[Since version 2.5.20]
Source:
LWWMap.scala
@deprecated("Use `remove` that takes a `SelfUniqueAddress` parameter instead.", since = "2.5.20")
def remove(node: Cluster, key: A): LWWMap[A, B]
Deprecated
[Since version 2.5.20]
Source:
LWWMap.scala