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// Shared atomic-write primitive: barks, kv, overrides, shep.toml, dogs.toml
24// and the muster roll all write through it.
25pub mod atomic_file;
26pub mod barks;
27pub mod config;
28// The staging file `shep.toml` and `dogs.toml` are written through, and the
29// old name for the lock their writers hold. Lives here rather than in
30// shep-cli (where it was born) so shep-daemon can hold it too.
31pub mod config_lock;
32// The probe contract both sides of a dog's `--version`/`--schema` answer
33// parse: flag names, the answer grammar, the schema's secret marker key.
34pub mod dogs;
35// The exit codes a dog shares with the CLI, so an operator reads one
36// taxonomy in `shep dogs` whichever binary exited.
37pub mod exit;
38// One advisory lock, keyed on the file it guards. Every store that
39// publishes a new value by `rename` holds it across the whole cycle.
40pub mod file_lock;
41pub mod kv;
42// One definition of the log-line timestamp for the writer and every reader:
43// the daemon stamps, and three different file readers in shep-cli strip.
44pub mod logstamp;
45pub mod overrides;
46pub mod paths;
47pub mod protocol;
48pub mod secrets;
49pub mod selector;
50pub mod signals;
51pub mod status;
52// OS-specific transport (unix socket or named pipe) lives here so nothing
53// above it needs a `cfg`.
54pub mod transport;
55pub mod values;
56
57/// One-import surface for downstream crates
58pub mod prelude {
59 #[doc(no_inline)]
60 pub use crate::config::{AppConfig, DeclaredApp, Flockfile};
61 #[doc(no_inline)]
62 pub use crate::paths::ShepPaths;
63 #[doc(no_inline)]
64 pub use crate::selector::ProcessSelector;
65 #[doc(no_inline)]
66 pub use crate::status::ProcStatus;
67 #[doc(no_inline)]
68 pub use crate::values::{MemSize, UpDuration};
69}