#rpc #microservices #networking #async #api

saildb

SailDB is an in-memory database based on Canary and SRPC

2 releases

0.0.2 Dec 29, 2021
0.0.1 Dec 28, 2021

#85 in #network

MIT license

28KB
664 lines

SailDB

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()))

A simple example of SailDB

Dependencies

~13–23MB
~353K SLoC