How toodlejoodles/redis-clone works
This is a Redis-compatible, single-process C++ server. A client sends RESP commands over a socket; the server’s event-loop callbacks parse and dispatch them, then return serialized responses. Dispatch reaches distinct storage, sorted-set, Pub/Sub, transaction, and persistence capabilities. The README documents the broader command and persistence features; several internal links are shown only where excerpts or the source index establish them, so unsampled wiring is omitted or marked unverified.
Main entry points: server.cpp Server coordinator · storage_engine.cpp Key-value and TTL store · event_loop.cpp Event loop · aof.cpp AOF persistence
Components 12
Networking and protocol
- Server entrypoint
src/main.cpp - Event loop
src/event_loop.cpp - Socket compatibility
include/net_compat.hpp - RESP parser and serializer
src/resp_parser.cpp
Command coordination
- Server coordinator
src/server.cpp
Data structures
- Key-value and TTL store
src/storage_engine.cpp - Sorted-set index
src/skip_list.cpp
Messaging and transactions
- Pub/Sub manager
src/pubsub.cpp - Transaction manager
src/transaction.cpp
Persistence
- AOF persistence
src/aof.cpp - RDB snapshots
src/rdb.cpp
Other components
- Redis client
Connections 13
- Redis client → Server coordinator: sends commands
README.md - Server entrypoint → Server coordinator: starts
src/main.cpp - Server coordinator → Event loop: registers callbacks
src/server.cpp - Event loop → Socket compatibility: polls sockets
- Server coordinator → RESP parser and serializer: parses and serializes
src/server.cpp - Server coordinator → Key-value and TTL store: dispatches commands
src/server.cpp - Key-value and TTL store → Sorted-set index: uses skip list
src/storage_engine.cpp - Server coordinator → Pub/Sub manager: manages subscriptions
src/server.cpp - Server coordinator → Transaction manager: executes transactions
src/server.cpp - Server coordinator → RDB snapshots: saves snapshots
src/server.cpp - Server coordinator → AOF persistence: logs mutations
- AOF persistence → Key-value and TTL store: replays commands
- RDB snapshots → Key-value and TTL store: loads and saves