retain is a key-value store. It is inspired by Redis and hence the client-server interaction is based on RESP over TCP. It implements a subset of commands supported by Redis.
I wrote this as a learning exercise. Redis or any key-value store in general excites me. The kind of things that you can do while implementing such a store are pretty abundant, if not limitless. You can ponder in different layers of this system with questions based on "how". Eg: how do you hold the data in memory? How do you handle concurrent access? What protocols do you use between the client and the server? If you want to persist data, how do you manage the pages to ensure efficient data reads/writes? If you want to make it distributed, what consensus algorithm do you bring in? You probably get the idea.
With that being said, it should be noted that this is not a production grade system and I maintain it at my free will. Don't use it for anything serious.
Below is a list of the supported commands. It takes heavy inspiration from here.
- ECHO message
- PING [message]
- GET key
- SET key value
- DEL key
- MGET key [key ...]
- MSET key value [key value ...]
- SAVE
cmd/
directory contains the client and server programs that can be built and run.protocol
package implements RESP.store
package provides an API for interacting with the underlying map.
$ make build
After this, you can find the binaries under ./bin/
.
PRs and discussions are welcome. It would be better if you open an issue before raising a PR.