package crdt-ml

  1. Overview
  2. Docs

Module type Immutable_types.DCounterSource

Increment / decrement counter type. Supports merging, incrementing and decrementing.

The elt type (included from IVector must be supplied when including).

include IVector
include Mergeable
Sourcetype t

Type of mergeable elements.

Sourceval make : unit -> t

Create a new mergeable element.

Sourceval merge : t -> t -> t

merge a b will merge the state of a and the one from b to create a new mergeable element.

Sourcetype elt

Type of the contents of an IVector

Sourceval 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.

Sourceval query : t -> elt

query t returns the raw state of t

Sourceval incr : t -> t

incr t increments the position associated with the numsite of t. See I_IntVector for more information on numsites.

Sourceval decr : t -> t

decr t decrements the position associated with the numsite of t. See I_IntVector for more information on numsites.