How fool-mrrice/codecrafters-redis-rust works
This repository is a Rust Redis-compatible in-memory server. The principal workflow is a client sending RESP commands to the server, which dispatches commands to handlers and returns RESP responses backed by shared database state. The documented feature branches include strings, lists, Streams, blocking commands, transactions, expiry, RDB parsing, and replication. The README and excerpts support the main command path; implementation details for server networking and replication are not sampled, so those connections are left out or marked unverified.
Main entry points: main.rs Server entry · blocking.rs Blocking commands · commands.rs Command dispatcher · handle.rs Command handlers
Components 12
Server and protocol
- Server entry
src/main.rs - RESP codec
src/utils/resp.rs
Commands and transactions
- Command dispatcher
src/commands.rs - Command handlers
src/handle.rs - Blocking commands
src/blocking.rs
Data and Streams
- Database state
src/storage/db_storage.rs - Server configuration
src/storage/config.rs - Stream ID logic
src/stream_id.rs
Persistence and replication
- RDB parser
src/rdb/parser.rs
Other components
- Redis client
- Redis master
- Replica clients
Connections 13
- Redis client → Server entry: sends commands
README.md - Server entry → Command dispatcher: routes commands
README.md - Command dispatcher → Command handlers: dispatches
src/commands.rs - Command dispatcher → RESP codec: parses and encodes
src/commands.rs - Command handlers → Database state: accesses state
src/handle.rs - Command handlers → Stream ID logic: uses ID logic
src/handle.rs - Blocking commands → Database state: checks and queues
src/blocking.rs - Blocking commands → RESP codec: encodes replies
src/blocking.rs - Blocking commands → Stream ID logic: compares IDs
src/blocking.rs - Redis master → Server entry: replication handshake
README.md - Server entry → Replica clients: propagates commands
README.md - Redis master → RDB parser: provides RDB data
README.md - RDB parser → Database state: produces values
src/rdb/parser.rs