MVMap

class MVMap : DeltaCRDT

A delta-based CRDT map implementing multi-value (MV) policy.

Each entry behaves like a MVRegister: values written concurrently are all kept until a write replaces them; accessors return the set of current values. A write (or delete) replaces every visible (local or merged) value.

On merging, for each key, a value is kept iff either:

  • it is in both replicas/deltas, or

  • it is in one replica and its associated timestamp is not in the causal context of the other replica.

Its JSON serialization respects the following schema:

{
"type": "MVMap",
"metadata": {
"entries": {
// $key is a string
(( "$key": [ ( Timestamp.toJson() )*( , Timestamp.toJson() )? ] )*( , "$key": [ ( Timestamp.toJson() )*( , Timestamp.toJson() )? ] ))?
},
"causalContext": VersionVector.toJson()
}
// $key is a string and $value can be a Boolean, Double, Int or String
( , "$key": [
(( T.toJson(), )*( T.toJson() ))?
] )*
}

Constructors

MVMap
Link copied to clipboard
common
fun MVMap()
Default constructor.
MVMap
Link copied to clipboard
common
fun MVMap(env: Environment)
MVMap
Link copied to clipboard
common
fun MVMap(cc: VersionVector, env: Environment)
Constructor initializing the causal context.

Types

Companion
Link copied to clipboard
common
object Companion

Functions

deleteBoolean
Link copied to clipboard
common
fun deleteBoolean(key: String): MVMap
Removes the specified key / Boolean value pair from this map.
deleteDouble
Link copied to clipboard
common
fun deleteDouble(key: String): MVMap
Removes the specified key / Double value pair from this map.
deleteInt
Link copied to clipboard
common
fun deleteInt(key: String): MVMap
Removes the specified key / Int value pair from this map.
deleteString
Link copied to clipboard
common
fun deleteString(key: String): MVMap
Removes the specified key / String value pair from this map.
equals
Link copied to clipboard
common
open operator fun equals(other: Any?): Boolean
generateDelta
Link copied to clipboard
common
open override fun generateDelta(vv: VersionVector): MVMap
Return a delta from a given version vector vv to current state.
getBoolean
Link copied to clipboard
common
fun getBoolean(key: String): Set<Boolean?>?
Gets the set of Boolean values corresponding to a given key, or null if the key is not present in the map.
getDouble
Link copied to clipboard
common
fun getDouble(key: String): Set<Double?>?
Gets the set of double values corresponding to a given key, or null if the key is not present in the map.
getInt
Link copied to clipboard
common
fun getInt(key: String): Set<Int?>?
Gets the set of integer values corresponding to a given key, or null if the key is not present in the map.
getString
Link copied to clipboard
common
fun getString(key: String): Set<String?>?
Gets the set of string of values corresponding to a given key, or null if the key is not present in the map.
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
iteratorBoolean
Link copied to clipboard
common
fun iteratorBoolean(): Iterator<Pair<String, Set<Boolean?>>>
Returns an iterator over the Boolean entries in the map.
iteratorDouble
Link copied to clipboard
common
fun iteratorDouble(): Iterator<Pair<String, Set<Double?>>>
Returns an iterator over the Double entries in the map.
iteratorInt
Link copied to clipboard
common
fun iteratorInt(): Iterator<Pair<String, Set<Int?>>>
Returns an iterator over the Int entries in the map.
iteratorString
Link copied to clipboard
common
fun iteratorString(): Iterator<Pair<String, Set<String?>>>
Returns an iterator over the String entries in the map.
merge
Link copied to clipboard
common
open override fun merge(delta: DeltaCRDT)
Merge a given delta into this DeltaCRDTThe merge is unidirectional: only the local replica is modified.
put
Link copied to clipboard
common
fun put(key: String, value: Boolean?): MVMap
Puts a key / Boolean value pair into the map.
fun put(key: String, value: Double?): MVMap
Puts a key / Double value pair into the map.
fun put(key: String, value: Int?): MVMap
Puts a key / Int value pair into the map.
fun put(key: String, value: String?): MVMap
Puts a key / String value pair into the map.
toJson
Link copied to clipboard
common
open override fun toJson(): String
Serializes this crdt map to a json string.
toString
Link copied to clipboard
common
open fun toString(): String