niho/elm-crdt/1.0.0

CRDT.LWWElementSet

An LWWElementSet (or Last-Write-Wins Element Set) is a set where each insert and remove operation is tagged with a timestamp and if an insert and remove occurs concurrently on two separate replicas, the operation with the latest timestamp will take precendence.

LWWElementSet

type LWWElementSet comparable

LWWElementSet state.

empty : LWWElementSet comparable

Constructor that creates a new empty GSet.

comparable
-> Posix
-> LWWElementSet comparable
-> LWWElementSet comparable

Insert a value in the set.

comparable
-> Posix
-> LWWElementSet comparable
-> LWWElementSet comparable

Remove a value from the set.

member : comparable -> LWWElementSet comparable -> Bool

Determine if a value is in the set.

LWWElementSet comparable
-> LWWElementSet comparable
-> LWWElementSet comparable

Merge two LWWElementSet states.

fromList : List comparable -> Posix -> LWWElementSet comparable

Convert a list of values into a LWWElementSet.

toList : LWWElementSet comparable -> List comparable

Convert a LWWElementSet to a list of values.

toSet : LWWElementSet comparable -> Set comparable

Convert a LWWElementSet to a Set.

Operations

type Operation comparable
= Insert comparable Posix
| Remove comparable Posix

Operations that will modify the state of the set.

Operation comparable
-> LWWElementSet comparable
-> LWWElementSet comparable

Apply an operation on a LWWElementSet.

List (Operation comparable)
-> LWWElementSet comparable
-> LWWElementSet comparable

Apply a list of operations (a patch) on a LWWElementSet.

Serialization

encode : LWWElementSet String -> Value

Encode a LWWElementSet as JSON.

decoder : Decoder (LWWElementSet String)

Decode a LWWElementSet from JSON.