buffdb 0.1.1

Embedded storage at the speed of light.
docs.rs failed to build buffdb-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: buffdb-0.5.0

buffDB

This is an early implementation of a persistence layer for gRPC written in Rust and based on SQLite. The goal is to abstract a lot of the complexity associated with using protobufs and flattbuffers so that mobile users can go fast.

How to run

To run the server, you need to have Rust installed. Then, with the repository cloned, you can run

cargo run

This will start the server on [::1]:50051, storing the key-value pairs in kv_store.sqlite3 and the blob data in blob_store.sqlite3. All three can be configured with command line flags: --addr, --kv-store, and --blob-store respectively.

To build with optimizations enabled, run cargo build --release. The resulting binary will be located at target/release/buffdb. It is statically linked, so it can be moved anywhere on your file system without issue.

Prefer to handle the gRPC server yourself? buffdb can be used as a library as well!

Example usage in Rust

Run cargo add buffdb tonic tokio to add the necessary dependencies. Then you can execute the following code:

use buffdb::kv::{Key, KeyValue, KeyValueRpc, KvStore};
use tonic::Request;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let store = KvStore::new_in_memory();

    store
        .set(Request::new(KeyValue {
            key: "key".to_owned(),
            value: "value".to_owned(),
        }))
        .await?;

    let response = store
        .delete(Request::new(Key {
            key: "key".to_owned(),
        }))
        .await?;
    assert_eq!(response.get_ref().value, "value");

    let response = store
        .get(Request::new(Key {
            key: "key".to_owned(),
        }))
        .await;
    assert!(response.is_err());

    Ok(())
}