CRDT module was designed to create collaborative editing applications with CRDT (conflict-free replicated data type) approach. Well suitable for some simple solutions (for example, a scalable eventually consistent key-value storage with CRDT conflict resolutions).
You can add CRDT module to your project by inserting dependency in
In this example, we have two replicas - independent nodes which store different information.
First replica stores:
Second replica stores:
Then we merge replicas with CRDT approach and receive a result:
In the example
LWWSet (Last Write Wins) is utilized. It implements
Set interface and is basically a
Map<E, Timestamp>. Timestamp allows to merge
LWWSets by choosing the most relevant versions in case of conflicts.