A GCounter (or Grow-only Counter) is a replicated counter that is guaranteed to always converge to a single value, despite concurrent updates. A GCounter only supports incrementing the counter. If you need a counter that can also be decremented, you should use a PNCounter instead.
String
Each replica that modifies the counter is represented by a unique string ID.
GCounter state
zero : GCounter
Constructor that creates a new GCounter with the value zero.
increment : Replica -> GCounter -> GCounter
Increment the GCounter (+1).
value : GCounter -> Basics.Int
Get the current value of the GCounter.
merge : GCounter -> GCounter -> GCounter
Merge two GCounter states.
Operations that will modify the state of the counter. A GCounter only supports a single operation (Increment).
apply : Operation -> GCounter -> GCounter
Apply an operation on a GCounter.
patch : List Operation -> GCounter -> GCounter
Apply a list of operations (a patch) on a GCounter.
encode : GCounter -> Json.Encode.Value
Encode a GCounter as JSON.
decoder : Json.Decode.Decoder GCounter
Decode a GCounter from JSON.