Loom.AWORMap

An add-wins observed-remove map or CRDTs, based on optimized sets.

Compose any CRDT that implements the Loom.CRDT protocol. This is awkward by itself because of the use of copious key-module pairs.

Summary

delete(set, key, module)

Delete an entry for a key-module pair

get(map, key, module)

Get a value for a key-module pair

has_key?(awormap, key, module)

Checks if a key-module pair exists in the map already for the key

join(awormap, awormap)

Join a map

keys(awormap)

Returns the set of all key-module pairs

new()

Returns a new AWORMap

put(map, actor, key, value)

Insert a value, and merge it with any that exist already

value(awormap)

Returns a map of values for key-module pairs

Types

t

key :: term

actor :: term

crdt :: term

type :: atom | %atom{}

Functions

delete(set, key, module)

Specs:

Delete an entry for a key-module pair

get(map, key, module)

Specs:

Get a value for a key-module pair

has_key?(awormap, key, module)

Specs:

  • has_key?(t | {t, t}, key, module) :: boolean

Checks if a key-module pair exists in the map already for the key.

join(awormap, awormap)

Specs:

  • join(t, t) :: t

Join a map

keys(awormap)

Specs:

Returns the set of all key-module pairs

new()

Specs:

  • new :: t

Returns a new AWORMap

The identity value of an empty AWORMap is nil because of the difficulties of matching against %{}, which is not the equivalent of [].

iex> Loom.AWORMap.new |> Loom.AWORMap.value
nil
put(map, actor, key, value)

Specs:

Insert a value, and merge it with any that exist already

value(awormap)

Specs:

  • value(t) :: [{key, term}] | nil

Returns a map of values for key-module pairs