Crates.io | saildb |
lib.rs | saildb |
version | 0.0.2 |
source | src |
created_at | 2021-12-28 23:19:18.486631 |
updated_at | 2021-12-29 20:36:20.321012 |
description | SailDB is an in-memory database based on Canary and SRPC. |
homepage | |
repository | https://github.com/znx3p0/saildb |
max_upload_size | |
id | 504500 |
size | 27,949 |
SailDB is an in-memory database based on Canary and SRPC.
SailDB is extremely performant since communications are based on top of Canary, and the key-value store is backed by Dashmap.
SailDB is generic over the keys and values, and can be constructed at runtime, and is designed to be as simple to use as possible.
Creating a SailDB database is extremely simple:
// bind the global route to this socket
Tcp::bind("127.0.0.1:8080").await?;
// bind a SailDB to the global route with the default id
Sail::<String, String>::bind();
Accessing the database should be as simple as this
let addr = "127.0.0.1:8080".parse::<Addr>()?;
let mut db: Sail<String, String> = Sail::new(addr).await?;
let (key, val) = ("hello".to_string(), "world!".to_string());
db.insert(&key, &val).await?;
let val = db.get(&key).await?;
assert!(val, Some("world!".to_string()))