Skip to main content

Module armour

Module armour 

Source
Expand description

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

§Quick start

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.

Re-exports§

pub use crate::CollectionMeta;
pub use crate::Key;
pub use crate::TreeMeta;
pub use collection::Collection;
pub use handler::RpcHandler;
pub use handler::TypedMapHandler;
pub use handler::TypedTreeHandler;
pub use handler::ZeroMapHandler;
pub use handler::ZeroTreeHandler;
pub use migration::TypedMigration;
pub use migration::TypedMigrationFn;
pub use migration::ZeroMigration;
pub use migration::ZeroMigrationFn;
pub use rpc::TreeMap;
pub use seq::SeqGen;
pub use tree_db::CollectionInfo;
pub use tree_db::Db;
pub use tree_db::DbInfo;
pub use typed_client::TypedRpcClient;

Modules§

collection
handler
migration
rpc
seq
tree_db
typed_client