shep_core/lib.rs
1//! Shared foundation of the shep workspace
2//!
3//! Typed configuration (Flockfile + daemon config), value newtypes,
4//! process selectors, `$SHEP_HOME` paths, and wire protocol version 1.
5//! Every other crate depends on this one; it depends on no sibling.
6//!
7//! # Quick start
8//! ```
9//! use shep_core::prelude::*;
10//!
11//! let app: AppConfig = toml::from_str("name = \"web\"\nscript = \"./srv\"").unwrap();
12//! assert!(app.autorestart);
13//! let limit: MemSize = "512M".parse().unwrap();
14//! assert_eq!(limit.bytes(), 512 << 20);
15//! ```
16//!
17//! Module-by-module design: `docs/systematic-refactor/refactor-workspace/map.md`;
18//! behavior contract: `docs/specs/shep-v1.md`.
19
20#![doc(test(attr(deny(warnings))))]
21#![forbid(unsafe_code)]
22
23// Declared above `barks`, `kv` and `overrides` because all three begin and
24// end a write through it, as do `shep.toml`, `dogs.toml` and the muster
25// roll in the crates above this one: one create-at-`0600` staging file and
26// one definition of what finishes an atomic replace, rather than six
27// writers each carrying their own copy and deciding how far to flush.
28pub mod atomic_file;
29pub mod barks;
30pub mod config;
31// The probe contract both sides of a dog's `--version`/`--schema` answer
32// parse: flag names, the answer grammar, the schema's secret marker key.
33pub mod dogs;
34pub mod kv;
35// One definition of the log-line timestamp for the writer and every reader:
36// the daemon stamps, and three different file readers in shep-cli strip.
37pub mod logstamp;
38pub mod overrides;
39pub mod paths;
40pub mod protocol;
41pub mod selector;
42pub mod signals;
43pub mod status;
44// Declared next to `protocol`, deliberately: that module owns what travels
45// over the control plane and this one owns what carries it. Keeping the two
46// in one crate is what lets every layer above them — the client's actor, the
47// daemon's connection state machine, every RPC verb — be written once with
48// no `cfg` in it at all.
49pub mod transport;
50pub mod values;
51
52/// One-import surface for downstream crates
53pub mod prelude {
54 #[doc(no_inline)]
55 pub use crate::config::{AppConfig, DeclaredApp, Flockfile};
56 #[doc(no_inline)]
57 pub use crate::paths::ShepPaths;
58 #[doc(no_inline)]
59 pub use crate::selector::ProcessSelector;
60 #[doc(no_inline)]
61 pub use crate::status::ProcStatus;
62 #[doc(no_inline)]
63 pub use crate::values::{MemSize, UpDuration};
64}