mintkv

Crates.iomintkv
lib.rsmintkv
version0.1.0
sourcesrc
created_at2024-04-18 01:40:27.336469
updated_at2024-04-18 01:40:27.336469
descriptionA simple kv library based on btree
homepage
repository
max_upload_size
id1212014
size89,687
3Xpl0it3r (3Xpl0it3r)

documentation

README

mintkv

A simple KV database in rust is based on btree, written as a learning project.

File system layout

data
|----blocks
|      b_0000001
          data
          meta.json
          index.json
          tombstone
|      b_0000002
          data
          meta.json
          index.json
          tombstone
|-----memtables (mmap)
|         m_0001
             data 
             tombstone

TODO

  • B+tree as engine
  • Memtables
  • LE128 Code
  • Blocks(disk present)
  • Wal
  • tombstone
  • compaction

Example

use mintkv::db::MintKv;
const TEST_COUNT: i32 = 1000;

fn main() {
    let mut db = MintKv::new("./data");
    for i in 0..TEST_COUNT {
        let (key, value) = (format!("key-{}", i), format!("value-{}", i));
        db.insert(&key, &value).unwrap();
    }

    for i in 0..TEST_COUNT {
        let key = format!("key-{}", i);
        let result = db.get(&key);
        println!("Search For: {}, Reesult: {:?}", key, result);
    }
}
Commit count: 0

cargo fmt