GCounters
GCounters, short for G-Counters, are a type of grow-only conflict-free replicated data type (CRDT) used to implement distributed counters that converge without requiring coordination. They are designed for environments with eventual consistency, where multiple replicas may update independently and later synchronize.
In a GCounters implementation, each replica maintains a vector (an array) of counters, with one entry per
Merging states between replicas is done by taking the componentwise maximum of the two vectors. This merge
Limitations include the inability to perform decrements directly. To model decrements or more complex counting semantics,
Example: with three replicas A, B, and C, a state might be [2,0,0] after A increments twice.