My introductory project that is used for learn database design basics and practice my skills on writing Rust.
Now, I am implementing a KV data storage prototype by using Bitcask.
If possible, I would like to extend the program into
- [Data Structure] Develop the indexer using B+-tree and skip list.
- [Distributed System] Enable multiple nodes accessing the bitcask instance at the same time.
- Use HTTP to enable data sharing.
- Complete MIT 6.824, and bring usefulness of the Raft consensus algorithm into my design
Disclaimer
This project is still under construction. Executing the followings codes will generates data files in a temporary, directory. However, data clean up, after database shutdown (cause by either panic or user's command), and data restoration after a shutdown are all not implemented yet. Therefore, there unexpected behaviour may happens (included but not limited to security issue). The author of this repository holds no responsibility to your loss.
use bytes::Bytes;
use smallDB::bitcask::{db, options::Options};
fn main() {
let opts = Options::default();
let engine = db::Engine::open(opts).expect("failed to open bitcask engine");
let put_res1 = engine.put(
Bytes::from("quote"),
Bytes::from("Shall I compare thee to a summer day."),
);
assert!(put_res1.is_ok());
let get_res1 = engine.get(Bytes::from("quote"));
assert!(get_res1.is_ok());
let val = get_res1.ok().unwrap();
println!("val = {:?}", String::from_utf8(val.to_vec()));
}