Skip to content

You know, walk the earth, meet people... get into adventures. Like Caine from "Kung Fu."

License

Notifications You must be signed in to change notification settings

Chat-Wane/LSEQArray

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LSEQArray

Keywords: distributed systems, collaborative editing, CRDT, LSEQ allocation strategy, unique identifiers

This project aims to provide an implementation of a CRDT-based array using the allocation strategy LSEQ. Thus, the array structure allows distributed updates without having to manage the difficult task of solving conflict resolution.

Installation

$ npm install lseqarray

Usage

var LSEQArray = require('lseqarray');

// #1 creating the array
// site: our unique site identifier
var lseqArray = new LSEQArray(site);

// #2a inserting an element at the targeted index
// ei: a couple {_e: the element, _i: its unique identifier}
var ei = lseqArray.insert("A",0);

// #2b inserting an element that comes from a remote insert
// re: the element remotely inserted
// ri: the unique identifier of the element
var index = lseqArray.applyInsert(re, ri);

// #3a deleting the element at targeted index
// i: the unique identifier of the element at the index
var i = lseqArray.remove(0);

// #3b deleting the element with its unique identifier "ri"
// ri: the unique identifier of the element to delete
var index = lseqArray.applyRemove(ri);

// #4 accessing the length of the array
var length = lseqArray.length;

Example

SandEdit is a distributed and decentralized collaborative editor using LSEQArray. It has an optionnal web front end. Thus, one can simply trigger the events of a Replica to build its distributed array.

Others

In this implementations, each cell of the javascript array contains an element and its unique and immutable identifier. An alternative is the tree-based structure of the LSEQ-based array accessible at Flood-it.

Learn more about CRDTs: A comprehensive study of Convergent and Commutative Replicated Data Types

Learn more about LSEQ: LSEQ: an Adaptive Structure for Sequences in Distributed Collaborative Editing

About

You know, walk the earth, meet people... get into adventures. Like Caine from "Kung Fu."

Resources

License

Stars

Watchers

Forks

Packages

No packages published