Raxol.Swarm.CRDT.ORSet
(Raxol v2.3.0)
View Source
Observed-Remove Set CRDT.
Add-wins semantics: concurrent add and remove of the same element results in the element being present. Each add generates a unique dot (node + counter). Remove records all observed dots for that element. An element is present if it has any dot not in the remove set.
Summary
Functions
Adds an element to the set, generating a unique dot.
Returns true if the element is in the set.
Merges two OR-Sets. For each element, union the dots. Union the removed sets. An element survives if it has any dot not in the merged removed set.
Creates an empty OR-Set.
Removes an element from the set by recording all its current dots as removed. Only dots observed at this point are removed -- concurrent adds with new dots will survive.
Returns the number of elements in the set.
Returns all elements currently in the set.
Types
@type dot() :: {node(), pos_integer()}
Functions
Adds an element to the set, generating a unique dot.
Returns true if the element is in the set.
Merges two OR-Sets. For each element, union the dots. Union the removed sets. An element survives if it has any dot not in the merged removed set.
@spec new() :: t()
Creates an empty OR-Set.
Removes an element from the set by recording all its current dots as removed. Only dots observed at this point are removed -- concurrent adds with new dots will survive.
@spec size(t()) :: non_neg_integer()
Returns the number of elements in the set.
Returns all elements currently in the set.