Skip to content

crwen/ckv-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A LSM based Key/Value stroage engine.

  • MemTable
  • SSTable
  • Log
  • Compaction
  • Bloom Filter
  • Cache
  • Separating keys from values
  • Write batch
  • MVCC
  • GC

Usage

use anyhow::Result;
use ckv::{lsm::Lsm, write_batch::WriteBatch, Options};

fn main() -> Result<()> {
    let opt = Options::default_opt()
        .work_dir("work_dir/lsm")
        .mem_size(1 << 12)
        .kv_separate_threshold(4);

    let lsm = Lsm::open(opt);
    // set a key value
    lsm.put(b"key1", b"val1")?;
    // get value
    lsm.get(b"key1")?;

    // operation by WriteBatch
    let mut wb = WriteBatch::default();
    wb.put(b"key2", b"val2");
    wb.put(b"key3", b"val3");
    wb.delete(b"key1");
    lsm.write_batch(&wb)?;

    lsm.get(b"key1")?;
    Ok(())
}

reference

About

A LSM based Key/Value stroage engine.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages