package crdt-ml
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=c9be2ec006cd4f65e6a9bddbcedf024f876134afc1ddf4fb689dd0167de25b73
md5=b8337dcb24a3220a3c35bd5bae5c8f12
doc/crdt_mutable/M_PNCounter/index.html
Module M_PNCounter
Increment / decrement counters.
Contains two separate instances of M_IntVector
, one for incrementing (add_c
) and the other for decrementing (remove_c
).
The only difference between PNCounter
and GCounter
is that Mutable_types.IVector.query
t
in the former returns the difference between the add_c
and the remove_c
vectors.
An Increment / decrement counter is a Mutable_types.IVector
with type elt = int
include Mutable_types.DCounter with type elt = int
include Mutable_types.IVector with type elt = int
include Mutable_types.Mergeable
val make : unit -> t
Create a new mergeable element.
val make_in_range : int -> t
make_in_range n
creates a new IVector
of size ranging from 0
to n
. being n
greater than 0 and smaller than 2^30.
When merging two CRDTs of different sizes, the smaller one grows and pads the remaining space with zeros.
val incr : t -> unit
incr t
increments the position associated with the numsite
of t
. See M_IntVector
for more information on numsites
.
val decr : t -> unit
decr t
decrements the position associated with the numsite
of t
. See M_IntVector
for more information on numsites
.