My approach to the 'Build Your Own Redis' challenge.
- Basic Commands:
GETSET(with TTL)PINGECHO
- Concurrency: Supports multiple concurrent clients
- Persistence: Loads RDB files and serves the content
- Replication:
- Performs replication handshake
- Propagates commands to replicas
- Supports the
WAITcommand
- Streams:
- Create streams
- Support
XREADandXRANGEcommands - Support blocking reads (
XREAD block) - Support different type of queries (with
+,-,$, partially/fully create IDs)
- Transactions:
INCRcommandMULTIandEXECcommands- Multiple concurrent transactions with failures within transactions
- Build:
go build -o redis app/*.go
- Basic execution:
./redis --port 5678
- Parse RDB:
./redis --dir ./redis-data/ --dbfilename dump.rdb --port 5678
- Run as replica:
./redis --port 1234 --replicaof "localhost 6379"
After the server is running, you can connect to it via any Redis client, Including redis-cli;
Ex: redis-cli xread block 10000 streams orange 0-110.
NOTE: The current version fully supports RESP V2.