Skip to main content

dynomite/
lib.rs

1//! Dynomite is a distributed replication layer for Redis and Memcached
2//! datastores. This crate provides the engine as a library so it can be
3//! embedded in another Rust program, and is also driven by the `dynomited`
4//! binary as a standalone server.
5//!
6//! # Embedding
7//!
8//! The public embedding API lives in [`embed`]. Build a [`Server`] with
9//! [`ServerBuilder`] and drive it via the returned [`ServerHandle`]:
10//!
11//! ```no_run
12//! use dynomite::{Server, ServerBuilder};
13//! use dynomite::conf::DataStore;
14//! # tokio::runtime::Builder::new_multi_thread().enable_all().build().unwrap().block_on(async {
15//! let server = ServerBuilder::new("dyn_o_mite")
16//!     .listen("127.0.0.1:0".parse().unwrap())
17//!     .dyn_listen("127.0.0.1:0".parse().unwrap())
18//!     .data_store(DataStore::Redis)
19//!     .servers(vec![dynomite::conf::ConfServer::parse("127.0.0.1:6379:1").unwrap()])
20//!     .tokens_str("0")
21//!     .build()
22//!     .unwrap();
23//! let handle = server.start().await.unwrap();
24//! handle.shutdown().await.unwrap();
25//! # });
26//! ```
27//!
28//! The full reference manual lives in `docs/book/`. See the [`embed`]
29//! module for the complete embedding cookbook.
30
31#![forbid(unsafe_code)]
32#![warn(missing_docs)]
33
34pub mod admin;
35pub mod cluster;
36pub mod conf;
37pub mod core;
38pub mod crypto;
39pub mod embed;
40pub mod entropy;
41pub mod events;
42pub mod hashkit;
43pub mod io;
44pub mod msg;
45pub mod net;
46pub mod proto;
47pub mod runtime;
48pub mod seeds;
49pub mod stats;
50pub mod util;
51
52pub use crate::core::types::{DynError, Msec, MsgId, Sec, SecureServerOption, Status, Usec};
53pub use crate::embed::{Server, ServerBuilder, ServerHandle};