A toy experiment to implement a persistent key value store with Rust.
Run the current repl with:
cargo run --release -- --repl
Run the server with...
The server will start on localhost:5476
. You can connect to it with nc
cargo run --release
nc localhost 5476
Run through stdin with:
cat commands.txt | cargo run --release -- --stdin
Commands include:
PUT key "value"
: Insert a key-value pair into the databaseGET key
: Retrieve the value for a keyDELETE key
: Delete a key-value pair from the databaseEXIT
: Close the database, ignored in stdin and server modesBEGIN
: Start a transactionCOMMIT
: Commit a transactionROLLBACK
: Rollback a transaction
Very primitive testing and benching is done in a separate repo here
- Implment a hash storage engine for the database
- What performance impacts does this have? Turns out it's fast because I don't call fsync, but if I do, it slows down significantly
- Impelment a server client thingo so I can keep the
database running whilst executing different commands from different connections against it
- Make distinct modes in running the db, repl, stdin etc
- Implement the tcp endpoint
- Implement a in memory WAL for the database
- Make it possible to close the database from the client tcp socket instead of ignoring the EXIT command
- Work on cleanup from signals
- Reimplmenet the legacy appendonly storage engine and modify it contain use the in memory WAL and the hash table as an index
- Clean up the code