Map

class Map : DeltaCRDT

A delta-based CRDT map providing multiple conflict resolution policies.

On each key, a MV entry, a LWW entry and a PNCounter entry can all be used independently.

Its JSON serialization respects the following schema:

{
"type": "Map",
"metadata": {
"lwwMap": {
// $key is a string
( "$key": Timestamp.toJson() )*( , "$key": Timestamp.toJson() )?
},
"mvMap": {
"entries": {
// $key is a string
(( "$key": [ ( Timestamp.toJson() )*( , Timestamp.toJson() )? ] )*( , "$key": [ ( Timestamp.toJson() )*( , Timestamp.toJson() )? ] ))?
},
"causalContext": VersionVector.toJson()
},
"cntMap": {
( "$key": PNCounter.toJson() )*( , "$key": PNCounter.toJson() )?
}
}
// $key is a string and $value can be Boolean, double, integer, string or array
( , "$key": "$value" )*
}

Constructors

Map
Link copied to clipboard
common
fun Map()
Default constructor.
Map
Link copied to clipboard
common
fun Map(env: Environment)

Types

Companion
Link copied to clipboard
common
object Companion

Functions

decrement
Link copied to clipboard
common
fun decrement(key: String, dec: Int): Map
Decrement by dec the PNCounter associated with the specified key in the map
deleteLWWBoolean
Link copied to clipboard
common
fun deleteLWWBoolean(key: String): Map
Removes the specified key / Boolean LWW value pair from this map.
deleteLWWDouble
Link copied to clipboard
common
fun deleteLWWDouble(key: String): Map
Removes the specified key / Double LWW value pair from this map.
deleteLWWInt
Link copied to clipboard
common
fun deleteLWWInt(key: String): Map
Removes the specified key / Int LWW value pair from this map.
deleteLWWString
Link copied to clipboard
common
fun deleteLWWString(key: String): Map
Removes the specified key / String LWW value pair from this map.
deleteMVBoolean
Link copied to clipboard
common
fun deleteMVBoolean(key: String): Map
Removes the specified key / Boolean MV value pair from this map.
deleteMVDouble
Link copied to clipboard
common
fun deleteMVDouble(key: String): Map
Removes the specified key / Double MV value pair from this map.
deleteMVInt
Link copied to clipboard
common
fun deleteMVInt(key: String): Map
Removes the specified key / Int MV value pair from this map.
deleteMVString
Link copied to clipboard
common
fun deleteMVString(key: String): Map
Removes the specified key / String MV 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): Map
Return a delta from a given version vector vv to current state.
getCntInt
Link copied to clipboard
common
fun getCntInt(key: String): Int?
Get the PNCounter value corresponding to a given key, or null if such a key is not present in the map.
getLWWBoolean
Link copied to clipboard
common
fun getLWWBoolean(key: String): Boolean?
Get the LWW Boolean value corresponding to a given key , or null if such a key is not present in the map.
getLWWDouble
Link copied to clipboard
common
fun getLWWDouble(key: String): Double?
Get the LWW Double value corresponding to a given key, or null if such a key is not present in the map.
getLWWInt
Link copied to clipboard
common
fun getLWWInt(key: String): Int?
Get the LWW Int value corresponding to a given key, or null if such a key is not present in the map.
getLWWString
Link copied to clipboard
common
fun getLWWString(key: String): String?
Get the LWW String value corresponding to a given key, or null if such a key is not present in the map.
getMVBoolean
Link copied to clipboard
common
fun getMVBoolean(key: String): Set<Boolean?>?
Get the MV Boolean value corresponding to a given key, or null if such a key is not present in the map.
getMVDouble
Link copied to clipboard
common
fun getMVDouble(key: String): Set<Double?>?
Get the MV Double value corresponding to a given key, or null if such a key is not present in the map.
getMVInt
Link copied to clipboard
common
fun getMVInt(key: String): Set<Int?>?
Get the MV Int value corresponding to a given key, or null if such a key is not present in the map.
getMVString
Link copied to clipboard
common
fun getMVString(key: String): Set<String?>?
Get the MV String value corresponding to a given key, or null if such a key is not present in the map.
hashCode
Link copied to clipboard
common
open fun hashCode(): Int
increment
Link copied to clipboard
common
fun increment(key: String, inc: Int): Map
Increment by inc the PNCounter associated with the specified key in the map
iteratorCntInt
Link copied to clipboard
common
fun iteratorCntInt(): Iterator<Pair<String, Int>>
Get an iterator over the PNCounter entries in the map.
iteratorLWWBoolean
Link copied to clipboard
common
fun iteratorLWWBoolean(): Iterator<Pair<String, Boolean>>
Get an iterator over the LWW Boolean entries in the map.
iteratorLWWDouble
Link copied to clipboard
common
fun iteratorLWWDouble(): Iterator<Pair<String, Double>>
Get an iterator over the LWW Double entries in the map.
iteratorLWWInt
Link copied to clipboard
common
fun iteratorLWWInt(): Iterator<Pair<String, Int>>
Get an iterator over the LWW Int entries in the map.
iteratorLWWString
Link copied to clipboard
common
fun iteratorLWWString(): Iterator<Pair<String, String>>
Get an iterator over the LWW String entries in the map.
iteratorMVBoolean
Link copied to clipboard
common
fun iteratorMVBoolean(): Iterator<Pair<String, Set<Boolean?>>>
Get an iterator over the MV Boolean entries in the map.
iteratorMVDouble
Link copied to clipboard
common
fun iteratorMVDouble(): Iterator<Pair<String, Set<Double?>>>
Get an iterator over the MV Double entries in the map.
iteratorMVInt
Link copied to clipboard
common
fun iteratorMVInt(): Iterator<Pair<String, Set<Int?>>>
Get an iterator over the MV Int entries in the map.
iteratorMVString
Link copied to clipboard
common
fun iteratorMVString(): Iterator<Pair<String, Set<String?>>>
Get an iterator over the MV 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.
putLWW
Link copied to clipboard
common
fun putLWW(key: String, value: Boolean?): Map
Put a key / Boolean LWW value pair into the map.
fun putLWW(key: String, value: Double?): Map
Put a key / Double LWW value pair into the map.
fun putLWW(key: String, value: Int?): Map
Put a key / Int LWW value pair into the map.
fun putLWW(key: String, value: String?): Map
Put a key / String LWW value pair into the map.
putMV
Link copied to clipboard
common
fun putMV(key: String, value: Boolean?): Map
Put a key / Boolean MV value pair into the map.
fun putMV(key: String, value: Double?): Map
Put a key / Double MV value pair into the map.
fun putMV(key: String, value: Int?): Map
Put a key / Int MV value pair into the map.
fun putMV(key: String, value: String?): Map
Put a key / String MV value pair into the map.
toJson
Link copied to clipboard
common
open override fun toJson(): String
Serialize this DeltaCRDT to a JSON string.
toString
Link copied to clipboard
common
open fun toString(): String