Expand description
tcode serve’s adoption of trusty_common::log_drain::run_once (#6537).
Why: tcode serve writes a durable file log (logging::file_log_dir)
nothing collects. This is the single-project drain scheduler, the same
shape as trusty-mpm’s own Phase 3 wiring, scoped down to what one project’s
daemon needs.
What: LogDrainConfig (~/.trusty-code/log_drain.yaml), resolve_log_drain,
spawn.
Test: log_drain::config::tests, log_drain::resolve::tests,
log_drain::scheduler::tests.
tcode’s adoption of trusty_common::log_drain::run_once (#6537, Phase 5
of epic #6533).
Why: trusty-mpm’s own daemon already periodically uploads its logs
(#6535, trusty_mpm::core::trusty_tools_config::log_drain +
trusty_mpm::daemon::log_drain); tcode serve writes logs nobody
collects — before #6537 it had no file log at all (see
crate::logging::file_log_dir). This module is the same shape as
trusty-mpm’s Phase 3 pair, scoped down to what a single-project daemon
actually needs: ONE destination, ONE source (tcode’s own file log), and
the identity of the project tcode serve is bound to — trusty-mpm’s
sources[] grouping (#6657) exists for a host draining several projects
at once, which tcode serve never does.
What: config::LogDrainConfig is the on-disk shape
(~/.trusty-code/log_drain.yaml), using the same field names as
trusty-mpm’s log_drain: section; resolve::resolve_log_drain turns it
into a runnable resolve::LogDrainSetting; scheduler::spawn starts
the interval loop from serve::build_router when the plan resolves
enabled. The drain CORE — collect, the manifest, put, run_once — is
trusty_common::log_drain; nothing here reimplements it.
Test: config::tests, resolve::tests, scheduler::tests.
Structs§
- Resolved
LogDrain - A validated, runnable drain plan — everything
run_tickneeds except the destination connection, which it makes at tick time.
Enums§
- LogDrain
Config Error - Every way a
SingleSourceSectioncan be wrong. - LogDrain
Setting - What the config says the drain should do.
Functions§
- resolve_
log_ drain - Resolve the config into a runnable plan, or refuse.
- spawn
- Start the interval loop as a background task.
Type Aliases§
- LogDrain
Config - The
log_drain.yamlschema. Every field optional, same names as trusty-mpm’slog_drain:section.