Skip to content

jiamingluuu/smallDB

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

smallDB

My introductory project that is used for learn database design basics and practice my skills on writing Rust.

Current progress

Now, I am implementing a KV data storage prototype by using Bitcask.

Objectives

If possible, I would like to extend the program into

  1. [Data Structure] Develop the indexer using B+-tree and skip list.
  2. [Distributed System] Enable multiple nodes accessing the bitcask instance at the same time.

Example

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()));
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages