delta_crdt v0.2.1 DeltaCrdt.AWLWWMap
An add-wins last-write-wins map.
This CRDT is an add-wins last-write-wins map. This means:
- The data structure is of a map. So you can store the following values:
%{key: "value"}
%{"1" => %{another_map: "what!"}}
%{123 => {:a, :tuple}}
Both keys and values are of type
term()
(akaany()
).Add-wins means that if there is a conflict between an add and a remove operation, the add operation will win out. This is in contrast to remove-wins, where the remove operation would win.
Last-write-wins means that if there is a conflict between two write operations, the latest (as marked with a timestamp) will win. Underwater, every delta contains a timestamp which is used to resolve the conflicts.
Link to this section Summary
Functions
Add (or overwrite) a key-value pair to the map
Remove all key-value pairs from the map
Convenience function to create an empty add-wins last-write-wins map
Read the state of the map
Remove a key and it’s corresponding value from the map
Link to this section Types
Link to this section Functions
add(key :: key(), val :: value(), i :: node_id(), crdt_state()) :: crdt_delta()
Add (or overwrite) a key-value pair to the map
Remove all key-value pairs from the map
Convenience function to create an empty add-wins last-write-wins map
Read the state of the map
Note: this operation is expensive, so it’s best not to call this more often than necessary.
remove(key :: key(), i :: node_id(), crdt_state()) :: crdt_delta()
Remove a key and it’s corresponding value from the map