Skip to content

Latest commit

 

History

History
58 lines (51 loc) · 1.13 KB

README.md

File metadata and controls

58 lines (51 loc) · 1.13 KB

mintkv

A simple tsdb database in rust is based on btree, written as a learning project. key must be u64, and value can be anything;

File system layout

➜  mintkv git:(master) ✗ tree -L 3 data
data
├── blocks
│   ├── block-0
│   └── metadata.json
├── checkpoint
└── wal
    ├── metadata
    ├── wal-0
    ├── wal-1
    ├── wal-2
    ├── wal-3
    ├── wal-4
    ├── wal-5
    ├── wal-6
    ├── wal-7
    ├── wal-8
    └── wal-9

3 directories, 14 files
➜  mintkv git:(master) ✗

TODO

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

Example

use mintkv::db::MintKv;
const TEST_COUNT: u64 = 1000;
fn main() {
    let mut db = MintKv::new("./data");
    for i in 0..TEST_COUNT {
        let value = format!("value-{}", i);
        db.insert(i, value.as_bytes())
            .unwrap()
    }
    db.commit();

    for i in 0..TEST_COUNT {
        let result = db.get(i);
        println!("Search {:?}, Result: {:?}", i, result);
    }
}