Skip to content

glorv/kv-demo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A rust implement of in memory key-value store use lsm-like Algorithm that support get, put, remove and scan cmd. This demo provide a client/server that depend on grpc-rs This KV Store Server support value of any type that implement BytesSerializer.

Build

rust nightly is required for build.

$ cargo build --release

this will generate the server binary

Usage

start server

target/release/server -d path-to-data-directory -p server-port

use client

extern crate kvdemo;

use kvdemo::client::{ConnectOptions, KVGrpcClient};
use kvdemo::codec::BytesSerializer;

let options = ConnectOptions::new("127.0.0.1:8000".into(), 10);
let client = KVGrpcClient::open(options);

let key = "test-key".to_string();
let value: i32 = 123;
assert!(client.put(&k, &value).is_ok());

let value: i32 = client.get(&k)?;
assert_eq!(value, 123);

refer example for more example usage.

TODO

  • []implement aync merge process to reduce table number
  • []implement snapshot storage persistence instead of action log

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks