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// One advisory lock, keyed on the file it guards. Every store that
36// publishes a new value by `rename` holds it across the whole cycle.
37pub mod file_lock;
38pub mod kv;
39// One definition of the log-line timestamp for the writer and every reader:
40// the daemon stamps, and three different file readers in shep-cli strip.
41pub mod logstamp;
42pub mod overrides;
43pub mod paths;
44pub mod protocol;
45pub mod secrets;
46pub mod selector;
47pub mod signals;
48pub mod status;
49// OS-specific transport (unix socket or named pipe) lives here so nothing
50// above it needs a `cfg`.
51pub mod transport;
52pub mod values;
53
54/// One-import surface for downstream crates
55pub mod prelude {
56 #[doc(no_inline)]
57 pub use crate::config::{AppConfig, DeclaredApp, Flockfile};
58 #[doc(no_inline)]
59 pub use crate::paths::ShepPaths;
60 #[doc(no_inline)]
61 pub use crate::selector::ProcessSelector;
62 #[doc(no_inline)]
63 pub use crate::status::ProcStatus;
64 #[doc(no_inline)]
65 pub use crate::values::{MemSize, UpDuration};
66}