CRDT Demo

The CRDT Demo is a web page showing how our CRDTs work: PNCounter, RGA, LWWMap, LWWRegister, MVRegister CRDTs. You can create multiple replicas, perform updates, and observe how updates are applied, propagated between replicas, and merged.

This web page shows how the Concordant platform works, and demonstrates each of the CRDT types we implement. Open multiple windows (on the same or different browsers, on the same or different devices) to experience how the CRDTs work collaboratively.

In each section, there is a piece of code which you would include in your application.

PNCounter

The PNCounter is a CRDT counter that you can increment and decrement. Increments and decrements are transmitted and merged between replicas. The PNCounter displays the sum of all increments, minus the sum of all decrements, that your replica has observed so far.

RGA

The RGA (or Replicated Growable Array) is a CRDT that implements an ordered sequence of elements. It supports two main methods: insert an element at some position, or remove the element that is at some position.

It can be used to implement a shared shopping list (an ordered list of strings) or a collaborative editor (an ordered sequence of characters and of markups).

LWWRegister

The LWWRegister (or Last Writer Wins Register) is a CRDT that stores a value with a timestamp. The main method is to assign some value to the register; the previous value is lost. As a side-effect, the Concordant system allocates a hidden timestamp (not accessible through the API). When different users concurrently update the register, the update with the highest timestamp prevails, and the others are lost.

LWWMAP

The LWWMap (Last-Writer-Wins Map) is a Map CRDT from key (a string) to a LWW value. The methods are to put a key/value pair, or to delete a key. (Semantically, "delete" is the same as "put the null value"). When a user puts a value to a key, the previous value of the key is lost. When users update different keys, their updates are independent and do not interfere with one another. When different users concurrently update the same key, the update with the highest timestamp prevails, and the others are lost.

MVRegister

The MVRegister (or Multi-Value Register) is a CRDT that supports assigning a value, associated with a hidden (vector) timestamp. When a user assigns the register, the previous value is lost. If multiple users assign the register concurrently, then a later read will return all the concurrent values (in contrast with LWWRegister).

MVMap

The MVMap (Multi-Value Map) is a Map CRDT from key (a string) to a MV value. The methods are to put a key/value pair, or to delete a key. (Semantically, "delete" is the same as "put the null value"). When a user assigns the register, the previous value is lost. When users update different keys, their updates are independent and do not interfere with one another. When different users concurrently update the same key, then a later read will return all the concurrent values.