This project is in constant development and should not be considered stable.
Simple Logoot implementation.
Logoot is a Commutative Replicated Data Type (CmRDT) created to be used by distributed systems that want to achieve Strong Eventual Consistency (SEC).
This is an implementation of Logoot-undo propose by Stéphane Weiss, Pascal Urso and Pascal Molli. It still lacks support for undo operations.
I'm using this for my graduation project, a P2P collaborative editor. Check it out.
Run inside your project directory:
elm package install hugobessaa/elm-logoot
In a Logoot, as in other CmRDTs, all operations commute. That is: any operation available can be executed in any order and the result will be the same. The classic "changing the order of the operands does not change the result".
import Logoot exposing (empty, insert, toList) pid = ([(2, 3)], 0) logoot1 = empty "" |> insert pid "hey!" |> remove pid "hey!" |> toList logoot2 = empty "" |> remove pid "hey!" |> insert pid "hey!" |> toList result = logoot1 == logoot2 -- True
Having commutative operations gives us the freedom of sending operations to other replicas without caring if they are being transmitted through a unreliable and poor connection. We can also run the same operations in a local replica and have instant updates!
P2P networks can be pretty unreliable, specially when users have a poor connection (e.g. bad cellular networks).
Apps like Google Docs tend to provide a poor experience for users with bad connections and not even work offline at all.
With a data structure like Logoot you can build your app with the confidence that it will work well and be always consistent. ~~Magic~~ Math!
Visit the API documentation page and take a look at everything this library offers.
This project is in constant development and should not be considered stable. I already have some major bumps planned as I experiment with the API, so beware.
encodeBatch, …) and types (
Operation, …) to make it easier to users to send their changes to another replicas
Logootvalue type agnostic
List, I want to be able to store any value type inside a
Logoot. The type would be something along
Logoot a. Right now it only knows how to hold
Pidtype, making it impossible to generate invalid pids
([(-1, -1)], -1)and
(, 0)are invalid pids.
Positionsis really a
Intbetween 0 and 32000 (exclusive).
There are a lot of missing pieces here, help us sending PRs to the GitHub repository!