Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andresilva/cask
A fast key-value store written in Rust
https://github.com/andresilva/cask
database key-value rust
Last synced: 4 days ago
JSON representation
A fast key-value store written in Rust
- Host: GitHub
- URL: https://github.com/andresilva/cask
- Owner: andresilva
- License: mit
- Created: 2015-06-15T11:06:54.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-12-16T15:38:35.000Z (almost 3 years ago)
- Last Synced: 2024-10-27T22:15:44.724Z (17 days ago)
- Topics: database, key-value, rust
- Language: Rust
- Homepage:
- Size: 8.76 MB
- Stars: 108
- Watchers: 5
- Forks: 9
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Cask
A fast key-value store written in Rust. The underlying storage system is a log-structured hash table
which is inspired by [bitcask](https://github.com/basho/bitcask/).[![Build Status](https://travis-ci.org/andresilva/cask.svg?branch=master)](https://travis-ci.org/andresilva/cask)
[![Crates.io](https://img.shields.io/crates/v/cask.svg?maxage=2592000)](https://crates.io/crates/cask)
[![License](https://img.shields.io/dub/l/vibe-d.svg)](https://raw.githubusercontent.com/andresilva/cask/master/LICENSE)[API Documentation](http://andresilva.github.io/cask)
* * *
**WARNING**: ⚠️ Please do not trust any valuable data to this yet. ⚠️
## Installation
Use the [crates.io](http://crates.io/) repository, add this to your Cargo.toml along with the rest
of your dependencies:```toml
[dependencies]
cask = "0.7.0"
```Then, use `Cask` in your crate:
```rust
extern crate cask;
use cask::{CaskOptions, SyncStrategy};
```## Usage
The basic usage of the library is shown below:
```rust
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
- [X] Basic error handling
- [X] Merge files during compaction
- [X] Configurable compaction triggers and thresholds
- [X] Documentation
- [ ] Tests
- [ ] Benchmark
- [ ] Handle database corruption## License
cask is licensed under the [MIT](http://opensource.org/licenses/MIT) license. See `LICENSE` for
details.