Skip to main content

dynomite/
lib.rs

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