A fast key-value store written in Rust. The underlying storage system is a log-structured hash table which is inspired by bitcask.
WARNING:
Use the crates.io repository, add this to your Cargo.toml along with the rest of your dependencies:
[dependencies]
cask = "0.7.0"
Then, use Cask
in your crate:
extern crate cask;
use cask::{CaskOptions, SyncStrategy};
The basic usage of the library is shown below:
extern crate cask;
use std::str;
use cask::{CaskOptions, SyncStrategy};
use cask::errors::Result;
fn main() {
if let Err(e) = example() {
println!("{:?}", e);
}
}
fn example() -> Result<()> {
let cask = CaskOptions::default()
.compaction_check_frequency(1200)
.sync(SyncStrategy::Interval(5000))
.max_file_size(1024 * 1024 * 1024)
.open("cask.db")?;
let key = "hello";
let value = "world";
cask.put(key, value)?;
let v = cask.get(key)?;
println!("key:{},value:{}", key, str::from_utf8(&v.unwrap()).unwrap());
cask.delete(key)?;
Ok(())
}
- Basic error handling
- Merge files during compaction
- Configurable compaction triggers and thresholds
- Documentation
- Tests
- Benchmark
- Handle database corruption
cask is licensed under the MIT license. See LICENSE
for
details.