Giter Site home page Giter Site logo

cask's Introduction

Cask

A fast key-value store written in Rust. The underlying storage system is a log-structured hash table which is inspired by bitcask.

Build Status Crates.io License

API Documentation


WARNING: ⚠️ Please do not trust any valuable data to this yet. ⚠️

Installation

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

Usage

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

TODO

  • Basic error handling
  • Merge files during compaction
  • Configurable compaction triggers and thresholds
  • Documentation
  • Tests
  • Benchmark
  • Handle database corruption

License

cask is licensed under the MIT license. See LICENSE for details.

cask's People

Contributors

andresilva avatar cetra3 avatar nak3 avatar parisliakos avatar romac avatar zakcodes avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.