Implemented with write-ahead log, based on the project described here.
The current directory is used for persisting the database.
$ cargo run -- set KEY VALUE
$ cargo run -- get KEY
VALUE
$ cargo run -- rm KEY
$ cargo run -- get KEY
Key not founduse kvs::KvStore;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
let mut store = KvStore::open("/path/to/db");
let key = "KEY";
store.set(key, "VALUE");
println!("The value at {} is {}", key, store.get("VALUE").unwrap());
Ok(())
}