FlowG – Distributed Systems without raft (part 2)
Published on: 2025-07-10 13:52:37
Eventual Consistency
As said in the original article, we chose for FlowG to be eventually consistent. We initially planned to use an “operation log” and Conflict-free Replicated Data Types (CRDTs) to implement the replication part.
This idea was temporarily dismissed. I’ll explain why.
Our storage backend is BadgerDB:
It is an embeddable key/value database with full transaction support. Internally, it uses a Log Structured Merge Tree (LSM) to organize key/value pairs.
Every key/value pair is assigned a “version”, and every mutation on a key updates that version. This enables incremental backups quite easily:
nextSince, err := db.Backup(writer, since)
nextSince, err = db.Backup(writer, nextSince + 1)
// ...
This also means that we don’t actually need an “operation log” to track the mutations done on a database.
As for the CRDT, FlowG has 3 kinds of storages:
auth: stores users, permissions, tokens, roles, …
stores users, permissions, tokens, roles, … config: stores configura
... Read full article.