Skip to content

threecgreen/kvs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persistent key-value store

Implemented with write-ahead log, based on the project described here.

CLI Usage

The current directory is used for persisting the database.

$ cargo run -- set KEY VALUE
$ cargo run -- get KEY
VALUE
$ cargo run -- rm KEY
$ cargo run -- get KEY
Key not found

Usage as a library

use kvs::KvStore;
use std::error::Error;

fn main() -> Result<(), Box<dyn Error>> {
    let mut store = KvStore::open("/path/to/db");
    let key = "KEY";
    store.set(key, "VALUE");
    println!("The value at {} is {}", key, store.get("VALUE").unwrap());

    Ok(())
}

About

Persistent key-value store

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages