1 unstable release

0.1.0 May 17, 2023

#2816 in Database interfaces

MIT license

30KB
686 lines

CheetahKV

A key/value store for Rust.


lib.rs:

A simple and efficient thread-safe key/value store.

Store is sharded on chunks. Each chunk has its own lock (RW), so it supports high concurrent access on multi-core CPUs.

Efficient space reuse alghorithm. Every packet has power of 2 size, for inplace rewrite on value update and map of deleted entrys, for reusing space.

let mut store_options = StoreOptions::new();
store_options.directory("dir_name".to_string()).chunks_count(100).chunks_prefix("prefix".to_string());

let store = Store::open(store_options).unwrap();
let key = "key".as_bytes();
let value = "value".as_bytes();

store.set(key, value, 0).unwrap();

let value_by_key = store.get(key).unwrap();

store.delete(key).unwrap();

Dependencies

~475–650KB
~11K SLoC