#async #database #pool #reql

mobc-reql

RethinkDB support for the mobc connection pool

15 unstable releases (5 breaking)

0.6.4 Feb 12, 2022
0.6.3 Oct 30, 2021
0.6.2 May 29, 2021
0.5.0 May 12, 2021
0.1.0 May 2, 2021

#174 in Database interfaces

Download history 23/week @ 2022-01-28 23/week @ 2022-02-04 40/week @ 2022-02-11 30/week @ 2022-02-18 19/week @ 2022-02-25 22/week @ 2022-03-04 64/week @ 2022-03-11 75/week @ 2022-03-18 9/week @ 2022-03-25 26/week @ 2022-04-01 37/week @ 2022-04-08 18/week @ 2022-04-15 26/week @ 2022-04-22 134/week @ 2022-04-29 93/week @ 2022-05-06 264/week @ 2022-05-13

521 downloads per month

MIT/Apache

155KB
5K SLoC

mobc-reql

ReQL connection pool implementation

use mobc_reql::{GetSession, Pool, SessionManager};

// Create the session manager
let manager = SessionManager::new(Default::default());

// Pull the rest of your nodes from your cluster. The connection pool
// connects to the node with the lowest latency.
// It is optional but highly recommended. This way, your app will
// continue working even when nodes go up and down.
tokio::spawn(manager.discover_hosts());

// Create the pool
let pool = Pool::builder().max_open(20).build(manager);

// Get a session from the pool
let session = pool.session().await?;

// You can pass a reference of the session to run.
// This allows you to use the same underlying connection for multiple
// queries as long as none of them is a change-feed.
// You can even use just one connection for your entire app, even running
// the queries concurrently.
//
// Change feeds on the other hand, require dedicated connections,
// so for each changefeed you need to grab a new session from the pool.
r.expr("Hello world!").run(&session);

Dependencies

~9–15MB
~345K SLoC