flâneur — a map of the web's best reading

CRDT: Text Buffer - Made by Evan

madebyevan.com · 965 words · saved by 1 readers

Collaboratively editing strings of text is a common desire in peer-to-peer applications. For example, a note-taking app might represent each document as a single collaboratively-edited string of text. The algorithm presented here is one way to do this. It comes from a family of algorithms called CRDTs, which I will not describe here. It's similar to the approaches taken by popular collaborative text editing libraries such as Yjs and Automerge. Other articles have already been written about these similar approaches (see the references section below), but this article also has a nice interactive visualization of what goes on under the hood. The algorithm: Each character is assigned a unique identifier consisting of site (the identifier of the creator) and clock (a site-specific integer that is incremented after every operation) as well as a (possibly null) parent pointer to a previous character. To insert a character, set its parent pointer to the character immediately before the inserti

CRDT: Text Buffer - Made by Evan ← Back to the algorithm list Published on May 19th, 2024 Collaboratively editing strings of text is a common desire in peer-to-peer applications. For example, a note-taking app might represent each document as a single collaboratively-edited string of text. The algorithm presented here is one way to do this. It comes from a family of algorithms called CRDTs , which I will not describe here. It's similar to the approaches taken by popular collaborative text editing libraries such as Yjs and Automerge . Other articles have already been written about these si

Explore this link on the map →

saved by

related reading