Implement CRDTs

commutative, idempotent merges

Challenge 7 of Partitioning & ReplicationAdvanced~60 min

Let two replicas edit the same data offline and merge with no coordination and no conflicts. Build the four canonical state-based CRDTs, a grow-only counter, a PN-counter, a last-writer-wins register, and an add-wins OR-Set, each with a commutative, associative, idempotent merge. The math behind Redis CRDTs, Riak, and collaborative editors.

4 steps

  1. 1Grow-Only Counter (G-Counter)
  2. 2Increment/Decrement Counter (PN-Counter)
  3. 3Last-Writer-Wins Register (LWW-Register)
  4. 4Add-Wins Set (OR-Set)
Start step 1