Exploring Conflict-free Replicated Data Types (CRDTs) for Collaborative Applications
Summary of my bookmarked links from Oct 18th, 2023
- An Interactive Intro to CRDTs
This article introduces CRDTs (Conflict-free Replicated Data Types), a type of data structure for collaborative applications. CRDTs allow different peers to update their states without needing to check with each other. The focus here is on state-based CRDTs, which transmit their full state. CRDTs consist of three components: 1. Value (T): The part of the CRDT that's important for the program. 2. State (S): Metadata required for peers to reach a consensus. 3. Merge Function: Responsible for merging the state. CRDTs ensure convergence with three key properties: commutativity, associativity, and idempotence. The article discusses Last Write Wins Register (LWW Register), a simple CRDT that overwrites values using timestamps. It details how LWW Registers work and provides an example of their use. The article also introduces the Last Write Wins Map (LWW Map), a more complex CRDT for handling multiple values. It explains the structure of LWW Map and its merge function, along with various methods like set, get, delete, and has. In summary, CRDTs are valuable for building collaborative apps without a central server. State-based CRDTs, such as LWW Registers and LWW Maps, are powerful tools for achieving conflict-free replication of data.