Crates.io | okofdb |
lib.rs | okofdb |
version | 0.1.3 |
source | src |
created_at | 2018-03-17 18:05:40.198629 |
updated_at | 2018-03-18 10:48:44.96663 |
description | One Key One File Database |
homepage | |
repository | https://github.com/Voultapher/okofdb |
max_upload_size | |
id | 56162 |
size | 26,578 |
okofdb
is a key value database.
If you need multiple concurrent writers, synchronization is your applications responsibility. Depending on your use case, possibly a very stupid way of storing your data.
Above an implementation defined value size threshold it will use snap to compress the value.
extern crate okofdb;
use okofdb::okof;
use std::path::Path;
fn main() {
let path = Path::new("dbdir");
let key = "test";
let value = b"Hello, world!";
okof::write(&path, &key, value).unwrap();
assert_eq!(okof::read(&path, &key).unwrap(), value);
let other_value = String::from("Other value");
okof::write(&path, &key, other_value.as_bytes()).unwrap();
assert_eq!(okof::read(&path, &key).unwrap(), other_value.as_bytes());
okof::delete(&path, &key).unwrap();
match okof::read(&path, &key) {
Err(okof::Error::NotFound) => (),
_ => { assert!(false); },
}
}
Add this crate to your project.
Rust toolchain and cargo.
Note, some filesystems might struggle with a lot of files in a single directory, which will happen if there are many keys.
One key == One File.
cargo test
TBD
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
See also the list of contributors who participated in this project.
This project is licensed under the Apache License, Version 2.0 - see the LICENSE.md file for details.