armdb 0.1.11

sharded bitcask key-value storage optimized for NVMe
Documentation
//! Integration with the armour ecosystem (feature `armour`).
//!
//! Provides multi-tree database management, schema-versioned migrations,
//! and a binary RPC server compatible with armour-rpc clients.
//!
//! # Components
//!
//! - [`Db`] — manages a directory of named collections with persistent
//!   metadata ([`DbInfo`]) and sequential ID generation.
//! - [`TreeMeta`] — static descriptor for a collection (name, key scheme, type, version).
//! - [`Db::open_typed_tree`] / [`Db::open_typed_map`] /
//!   [`Db::open_zero_tree`] / [`Db::open_zero_map`] —
//!   open a tree or map with automatic migration when the stored schema version
//!   differs from [`TreeMeta::version`].
//! - [`RpcHandler`] — trait for handling binary RPC requests per collection.
//! - [`TypedTreeHandler`] — [`RpcHandler`] implementation that bridges
//!   bytes-level RPC to a [`TypedTree`](crate::TypedTree) via a [`Codec`](crate::Codec).
//! - [`TreeMap`] — `Arc<HashMap<u64, Arc<dyn RpcHandler>>>` routing table
//!   (key = `xxh3(name)`).
//!
//! # Quick start
//!
//! ```ignore
//! use std::sync::Arc;
//! use armdb::armour::{Db, TypedTreeHandler, TreeMap};
//! use armdb::RapiraCodec;
//!
//! let db = Db::open("data/myapp")?;
//! let tree = Arc::new(db.open_typed_tree::<User, _>(RapiraCodec, &[])?);
//!
//! // Register handler and start RPC server
//! let trees: TreeMap = Arc::new(/* hashname -> handler */);
//! db.listen_tcp(trees.clone(), "127.0.0.1:9000");
//! db.listen_uds(trees, "/tmp/myapp.sock");
//! ```
//!
//! # RPC protocol
//!
//! Length-delimited frames over TCP or Unix socket. Each request carries an
//! opcode, a collection hashname (`xxh3` of the collection name), and an
//! operation-specific payload. See [`rpc`] module for codec details.
//!
//! Graceful shutdown: Ctrl-C sends a broadcast via `async_broadcast`;
//! all accept loops and active connections terminate.

pub mod collection;
pub mod db;
#[cfg(feature = "rpc")]
pub mod handler;
pub mod migration;
#[cfg(feature = "rpc")]
pub mod rpc;
pub mod seq;
#[cfg(feature = "rpc")]
pub mod typed_client;

pub use crate::{CollectionMeta, Key, TreeMeta};
pub use collection::Collection;
pub use db::{CollectionInfo, Db, DbInfo};
#[cfg(feature = "rpc")]
pub use handler::{RpcHandler, TypedMapHandler, TypedTreeHandler, ZeroMapHandler, ZeroTreeHandler};
pub use migration::{TypedMigration, TypedMigrationFn};
#[cfg(feature = "rpc")]
pub use rpc::TreeMap;
pub use seq::SeqGen;
#[cfg(feature = "rpc")]
pub use typed_client::TypedRpcClient;