4 releases

Uses old Rust 2015

0.1.3 Jan 2, 2017
0.1.2 Jan 2, 2017
0.1.1 Jan 2, 2017
0.1.0 Dec 31, 2016

#45 in #local-file

MIT license

21KB
526 lines

kvlite

A key-value store backed by your local file system. Mostly a toy project to learn Rust.

Documentation

Usage

First, add this to your Cargo.toml:

[dependencies]
kvlite = "0.1.2"

Next, add this to your crate:

extern crate kvlite;

use kvlite::Store;

See documentation for library usage.

CLI Usage

With rust installed, you can use cargo install kvlite to get the kvl CLI tool.

usage: kvl <command> [<args>]

kvlite is a key-value store backed by the local file system.

commands:
    set <key> <value>        Create or update a key's value.
    get <key>                Look up a key's value.
    del <key>                Remove a key.

lib.rs:

A key-value store backed by your local file system.

The underlying hashmap uses an inefficient hashing algorithm to place keys and values into large and unoptimized buckets that it reads/writes from a file.

The file size is very large, and does not re-allocate memory. Also, the hashmap doesn't resize its keyspace. I may or may not fix these things.. this project was mostly just to learn Rust.

Reads are something like 2k QPS, writes 500 QPS. It's thread- and process-safe (probably).

Installation

Add this to your Cargo.toml:

[dependencies]
kvlite = "0.1.2"

Examples

extern crate kvlite;

use kvlite::FileHashMap;

let kv = FileHashMap::new("myfile.kvlite");

kv.insert("foo", "bar");

let foo = kv.get("foo").unwrap();

println!("foo: {}", foo);  // prints: "foo: bar"

Dependencies

~1.5MB
~36K SLoC