Skip to main content

trusty_code/log_drain/
mod.rs

1//! `tcode`'s adoption of `trusty_common::log_drain::run_once` (#6537, Phase 5
2//! of epic #6533).
3//!
4//! Why: trusty-mpm's own daemon already periodically uploads its logs
5//! (#6535, `trusty_mpm::core::trusty_tools_config::log_drain` +
6//! `trusty_mpm::daemon::log_drain`); `tcode serve` writes logs nobody
7//! collects — before #6537 it had no file log at all (see
8//! `crate::logging::file_log_dir`). This module is the same shape as
9//! trusty-mpm's Phase 3 pair, scoped down to what a single-project daemon
10//! actually needs: ONE destination, ONE source (tcode's own file log), and
11//! the identity of the project `tcode serve` is bound to — trusty-mpm's
12//! `sources[]` grouping (#6657) exists for a host draining several projects
13//! at once, which `tcode serve` never does.
14//!
15//! What: [`config::LogDrainConfig`] is the on-disk shape
16//! (`~/.trusty-code/log_drain.yaml`), using the same field names as
17//! trusty-mpm's `log_drain:` section; [`resolve::resolve_log_drain`] turns it
18//! into a runnable [`resolve::LogDrainSetting`]; [`scheduler::spawn`] starts
19//! the interval loop from `serve::build_router` when the plan resolves
20//! enabled. The drain CORE — `collect`, the manifest, `put`, `run_once` — is
21//! `trusty_common::log_drain`; nothing here reimplements it.
22//!
23//! Test: `config::tests`, `resolve::tests`, `scheduler::tests`.
24//!
25//! [`config::LogDrainConfig`]: crate::log_drain::LogDrainConfig
26//! [`resolve::resolve_log_drain`]: crate::log_drain::resolve_log_drain
27//! [`resolve::LogDrainSetting`]: crate::log_drain::LogDrainSetting
28//! [`scheduler::spawn`]: crate::log_drain::spawn
29
30mod config;
31mod resolve;
32mod scheduler;
33
34pub use config::LogDrainConfig;
35pub use resolve::{LogDrainConfigError, LogDrainSetting, ResolvedLogDrain, resolve_log_drain};
36pub use scheduler::spawn;