feat: group host-side /var/lib/hyperhive state into db/ forge/ matrix/ run/ subdirs with startup migration
This commit is contained in:
parent
cfafc9d93d
commit
14c7b0d406
15 changed files with 261 additions and 51 deletions
|
|
@ -1,4 +1,4 @@
|
|||
//! `/var/lib/hyperhive/agent-sockets.json` writer. Sibling to
|
||||
//! `/var/lib/hyperhive/run/agent-sockets.json` writer. Sibling to
|
||||
//! `agent_ports.rs`; same atomic `<path>.tmp` + `rename()` shape so
|
||||
//! the gateway's nginx worker never reads a partial file. Includes
|
||||
//! manager and sub-agents so the gateway can route
|
||||
|
|
@ -13,8 +13,6 @@ use std::path::{Path, PathBuf};
|
|||
|
||||
use anyhow::{Context, Result};
|
||||
|
||||
const HOST_SOCKETS_PATH: &str = "/var/lib/hyperhive/agent-sockets.json";
|
||||
|
||||
/// Host-side parent directory holding per-agent socket subdirs. The
|
||||
/// gateway container bind-mounts this whole tree (read-only) so it
|
||||
/// can `proxy_pass` to any agent. Each agent's container bind-mounts
|
||||
|
|
@ -43,7 +41,7 @@ const READY_MARKER_LEGACY: &str = ".bound";
|
|||
|
||||
#[must_use]
|
||||
pub fn host_sockets_path() -> PathBuf {
|
||||
PathBuf::from(HOST_SOCKETS_PATH)
|
||||
crate::paths::agent_sockets_file()
|
||||
}
|
||||
|
||||
/// Per-agent socket subdir on the host. Lifecycle pre-creates this
|
||||
|
|
@ -111,7 +109,7 @@ pub fn ready_marker_for(name: &str) -> PathBuf {
|
|||
}
|
||||
|
||||
/// Render the map as pretty-printed JSON. Pretty so a human peek at
|
||||
/// `cat /var/lib/hyperhive/agent-sockets.json` shows one row per agent
|
||||
/// `cat /var/lib/hyperhive/run/agent-sockets.json` shows one row per agent
|
||||
/// — keeps the file readable without a separate jq step (mirrors
|
||||
/// `agent_ports::render`).
|
||||
fn render(map: &BTreeMap<String, PathBuf>) -> String {
|
||||
|
|
@ -128,7 +126,7 @@ fn render(map: &BTreeMap<String, PathBuf>) -> String {
|
|||
}
|
||||
|
||||
/// Atomically write the JSON for `names` to
|
||||
/// `/var/lib/hyperhive/agent-sockets.json`. Writes via a sibling
|
||||
/// `/var/lib/hyperhive/run/agent-sockets.json`. Writes via a sibling
|
||||
/// `<path>.tmp` + rename so a crashing process never leaves a
|
||||
/// partial file behind that the gateway worker would fail to parse.
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in a new issue