Crate cask

Source
Expand description

Cask is a key-value store backed by a log-structured hash table which is inspired by bitcask.

Keys are indexed in a HashMap and values are written to an append-only log. To avoid the log from getting filled with stale data (updated/deleted entries) a compaction process runs in the background which rewrites the log by removing dead entries and merging log files.

§Examples

use std::result::Result::Ok;
use cask::{CaskOptions, SyncStrategy};
use cask::errors::Result;

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)?;
    cask.get(key)?;
    cask.delete(key)?;

    Ok(())
}

Modules§

errors

Structs§

Cask
An handle to a Cask database.
CaskOptions
Cask configuration. Provides control over the properties and behavior of the Cask instance.

Enums§

SyncStrategy
Strategy used to synchronize writes to disk.