manta_shared/
lib.rs

1//! Shared library used by both `manta-cli` and `manta-server`.
2//!
3//! Top-level modules:
4//!
5//! - [`types`] — wire-shaped data (request `*Params`, response DTOs,
6//!   cluster-status helpers). The CLI↔server API contract — both
7//!   binaries serialize and deserialize through these types.
8//! - [`common`] — bi-binary behavioural helpers: the [`common::config`]
9//!   loader (returns an untyped `::config::Config`),
10//!   [`common::error::MantaError`], and
11//!   [`common::log_ops::configure`]. Single-binary helpers (`audit`,
12//!   `kafka`, `jwt_ops`, the SAT-file Jinja renderer) and the typed
13//!   config schemas (`CliConfiguration`, `ServerConfiguration`,
14//!   `Auditor`/`Kafka`) live with whichever binary uses them.
15//!
16//! The backend bridge (`StaticBackendDispatcher`, the CSM/OCHAMI trait
17//! impls, and `authorization` helpers that take a `&StaticBackendDispatcher`)
18//! lives in `manta-server`; the CLI never reaches it.
19//!
20//! # Quick start
21//!
22//! Initialise logging and load the CLI config; the `NotFound` error
23//! variant carries a sample `cli.toml` and (if applicable) a
24//! migration mapping from the legacy unified `config.toml`:
25//!
26//! ```no_run
27//! use manta_shared::common::{config, error::MantaError, log_ops};
28//!
29//! fn main() -> Result<(), MantaError> {
30//!   log_ops::configure("info", false);
31//!
32//!   let cfg = config::get_cli_configuration()?;
33//!   let log_level = cfg.get_string("log").unwrap_or_else(|_| "info".into());
34//!   tracing::info!("log level from cli.toml: {log_level}");
35//!   Ok(())
36//! }
37//! ```
38//!
39//! The returned `::config::Config` is untyped on purpose — `manta-cli`
40//! deserialises it into `CliConfiguration` and `manta-server` into
41//! `ServerConfiguration`, so the same loader serves both binaries.
42
43// Every public item in this crate must carry a `///` doc comment.
44// We're a publishable crate (`publish = true`); the docs.rs page is
45// the primary external interface and stale-or-missing docs there are
46// user-facing. CI's `cargo doc` step keeps this honest.
47#![deny(missing_docs)]
48
49pub mod common;
50pub mod types;