MCPcopy Index your code
hub / github.com/coast-team/dotted-logootsplit

github.com/coast-team/dotted-logootsplit @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
441 symbols 1,523 edges 50 files 220 documented · 50%

Browse by type

Functions 378 Types & classes 63
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Dotted LogootSplit: A delta block-wise sequence CRDT

travis NPM version

A CRDT is a data structure which can be replicated over multiple devices and thus concurrently edited. Most of the CRDT embeds metadata in order to avoid conflicting edits. The challenge is to keep these metadata as small as possible.

LogootSplit [1] is a sequence CRDT which reduces the metadata of preceding sequence CRDT; to do so it aggregates elements.

LogootSplit is an operation-based CRDT. Hence, it is necessary to use a network layer to deliver exactly-once the operations. It requires also to deliver removals after insertions. In practice, this is difficult to implement.

Delta-based CRDT [2] have less assumptions. Most of delta-based CRDT simply assume a FIFO delivery (deltas from a same replica, are merged in-order). They also enable to merge two states. This is particularly interesting for intensive collaborative sessions with long periods of disconnection.

Dotted LogootSplit offers a delta-based version of LogootSplit with smaller metadata. We provide both op-based and delta-based synchronizations.

Publication

Coming soon...

References

[1] Luc André, Stéphane Martin, Gérald Oster, Claudia-Lavinia Ignat. Supporting Adaptable Granularity of Changes for Massive-scale Collaborative Editing. In Proceedings of the international conference on collaborative computing: networking, applications and worksharing - CollaborateCom 2013. IEEE Computer Society, october 2013, pages 50–59. hal-00903813

[2] Paulo Sérgio Almeida,, Ali Shoker, Carlos Baquero. Delta State Replicated Data Types, Journal of Parallel and Distributed Computing, Volume 111, January 2018, Pages 162-173. arXiv:1603.01529

Usage

npm install dotted-logootsplit

The following example craetes two replicas and uses delta-based synchornozations.

import { avl, SimpleDotBlockFactory } from "dotted-logootsplit"

const seed = "dotted-logootsplit" // for reproducibility

const replicaA = 0
const strategyA = SimpleBlockFactory.from(replicaA, seed)
const stateA = avl.deltaEditableList(strategyA, "")

const replicaB = 1
const strategyB = SimpleBlockFactory.from(replicaB, seed)
const stateB = avl.deltaEditableList(strategyB, "")

const deltaA1 = stateA.insertAt(0, "Helo  ")
const deltaA2 = stateA.insertAt(6, "world!")
console.log(stateA.concatenated(""))
// A: "Helo  world!"

// delta sync
stateB.applyDelta(deltaA1)
console.log(stateB.concatenated(""))
// B: "Helo  "

const deltaB1 = stateB.insertAt(2, "l")
console.log(stateB.concatenated(""))
// B: "Hello  "

stateB.applyDelta(deltaA2)
console.log(stateB.concatenated(""))
// B: "Hello  world!"

const deltasB2 = stateB.removeAt(5, 1) // remove a space
console.log(stateB.concatenated(""))
// B: "Hello world!"

stateA.applyDelta(deltaB1)
for (const d of deltasB2) {
    stateA.applyDelta(d)
}
console.log(stateA.concatenated(""))
// A: "Hello world!"

TODO

  • [x] Local editing
  • [x] Op-based sync
  • [x] causal delta-based sync
  • [ ] Out-of-order delta-based sync (WIP)
  • [x] state-based sync (state merging)
  • [ ] Anchors (a participant cursor is an anchor)
  • [ ] LSeq-like positions and generation strategies
  • [ ] Simpler balanced tree implementation

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 234
Function 144
Class 46
Interface 12
Enum 5

Languages

TypeScript100%

Modules by API surface

test/list/macro.ts80 symbols
src/list/avl/avl-list-node.ts51 symbols
src/core/block.ts31 symbols
src/core/delta-replicated-list.ts28 symbols
src/pos/simple/simple-pos.ts21 symbols
src/list/avl/op-avl-list.ts20 symbols
src/list/linked/op-linked-list.ts19 symbols
src/list/linked/linked-list-cell.ts18 symbols
src/dot-pos/simple/simple-dot-pos.ts18 symbols
src/core/u32-range.ts17 symbols
src/pos/simple/simple-block-factory.ts15 symbols
src/dot-pos/simple/simple-dot-block-factory.ts11 symbols

For agents

$ claude mcp add dotted-logootsplit \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page