Architecture

Architecture #

How the binary is put together, layer by layer, as it exists in this tree — not as it was once planned.

PageLayer
OverviewStartup sequence, request path, what runs where
ProtocolRESP server, pipelining, reply mapping, cluster redirects
NetworkRaft transport, peer discovery, the P2P drivers
Storageledis data model, per-type keyspaces, TTLs, snapshots
CodecHow five data types become KV operations
RESP client ──► uhaha/redcon ──► Raft log ──► handlers ──► ledis ──► driver.IDB
                   │              (leader)      (110 cmds)   (types)   (8 drivers)
                   └── AUTH / PING / QUIT / RAFT / CLUSTER / MACHINE / BARRIER

Two boundaries are worth holding in mind while reading the rest of this site:

  • The Raft layer owns ordering, not semantics. It decides when a write applies; the handler decides what it means. Everything that must be identical on every replica (randomness, time) is injected by the Raft layer and consumed by handlers through m.Now() and m.Rand().
  • The storage driver owns durability, not structure. It stores opaque key/value pairs. Every structure — a hash, a list, a score index — is encoded by ledis above the driver, which is why the same data model works on LevelDB and on IPFS.