/crdts

Primary LanguageJavaScriptMIT LicenseMIT

CRDTs

npm version CircleCI

A CRDT library for JavaScript.

Work In Progress

This module provides a set of Conflict-Free Replicated Data Types for your JavaScript programs. All CRDTs in this library, except G-Counter, are currently operation-based.

Implemented CRDTs:

Usage

npm install crdts
const GCounter = require('crdts').GCounter
const GSet = require('crdts').GSet
const TwoPSet = require('crdts').TwoPSet
const ORSet = require('crdts').ORSet
const LWWSet = require('crdts').LWWSet

// Or:
const { GSet, ORSet, LWWSet } = require('crdts')

See the source code for each CRDT for the APIs and tests for usage examples.

Inheritance

+------------------------------------------------------------+
|           ||           ||          ||         ||           |
|  OR-Set   ||  LWW-Set  ||  2P-Set  ||  G-Set  || G-Counter |
|           ||           ||          ||         ||           |
+-------------------------|          ||         +------------+
|                        ||          ||         |
|       CmRDT-Set        ||          ||         |
|                        ||          ||         |
+-----------------------------------------------+
|                                               |
|                    G-Set                      |
|                                               |
+-----------------------------------------------+

CRDTs

CRDT research: https://github.com/ipfs/research-CRDT