This blog post discusses the theoretical background and technical implementation of cola, a text CRDT (Conflict-free Replicated Data Type) for real-time collaborative editing written in Rust. The first part of the post covers how to represent the state of the document and the edits that transform it in a way that guarantees convergence across all replicas. The second part explains the implementation of cola’s data structure, including the use of linked lists and B-trees for efficient representation of the document. Finally, the post discusses the use of G-trees to improve the efficiency of integrating remote edits. The post highlights the use of tombstones for deleted text and the optimization of run-length encoding for consecutive blocks of text.
https://nomad.foo/blog/cola