hive-priv: split main.rs into one module per op family
No behaviour change: a pure move plus pub(crate) visibility. PrivRequest, hive-priv-sock and every validation rule are untouched; the 58 tests move next to the code they test, unchanged. Why (#5476): the 28 root ops shared one 4.3k-line file, so no op family could be reviewed on its own and every new root op landed there by default. main.rs keeps the socket loop and the dispatch table. container (lifecycle), container_config (nspawn flags, systemd drop-ins, daemon-reload), storage (btrfs subvolumes, quotas, snapshots, du), files (pause marker, socket dir, legacy tmpfiles) and infra (gateway nginx, forge admin, infra containers) each carry their own validation; shared holds the agent-name checks, the credential-name charset and StagedFile, plus the tests' scratch helpers (one counter crate-wide, so test dirs stay unique). hive-priv/README.md is in the diff because it named src/main.rs as the home of container_flake_action and now describes the module layout.
This commit is contained in:
parent
44984e0d36
commit
6ac637c7e3
8 changed files with 4052 additions and 3899 deletions
|
|
@ -30,11 +30,21 @@ The wire contract (`PrivRequest` / response types) lives in the separate
|
|||
`hive-priv-sock` crate so this root binary depends on just the protocol shapes,
|
||||
not the whole daemon-shared crate.
|
||||
|
||||
## Layout
|
||||
|
||||
`src/main.rs` holds the socket loop and the dispatch table, one arm per
|
||||
`PrivRequest` variant. Each op family, with its validation, has its own module:
|
||||
`container` (lifecycle), `container_config` (nspawn flags, systemd drop-ins),
|
||||
`storage` (btrfs subvolumes, quotas, snapshots, disk measurement), `files`
|
||||
(pause marker, socket dir, legacy tmpfiles) and `infra` (gateway nginx, forge
|
||||
admin, infra containers). Helpers more than one family calls live in `shared`.
|
||||
Each module's `//!` header lists its ops.
|
||||
|
||||
## Implementation notes
|
||||
|
||||
### Container toplevel builds (create/update)
|
||||
|
||||
`container_flake_action` (in `src/main.rs`) builds
|
||||
`container_flake_action` (in `src/container.rs`) builds
|
||||
`nixosConfigurations.<name>.config.system.build.toplevel` itself
|
||||
(`nix_build_toplevel`) and passes the resolved store path to
|
||||
`nixos-container create`/`update` via `--system-path`, for both verbs.
|
||||
|
|
|
|||
Loading…
Reference in a new issue