Skip to content

A simple TSDB database in rust , written as a learning project.

License

Notifications You must be signed in to change notification settings

3Xpl0it3r/mintkv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

A simple TSDB database in rust , written as a learning project.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published