cleanup(#1177): unify manager socket path, remove dead manager-name branches, rename ensure_manager
This commit is contained in:
parent
3bb45acd87
commit
eb3c6cd0c4
8 changed files with 36 additions and 41 deletions
|
|
@ -23,7 +23,6 @@ use crate::operator_questions::OperatorQuestions;
|
|||
const DASHBOARD_CHANNEL: usize = 256;
|
||||
|
||||
const AGENT_RUNTIME_ROOT: &str = "/run/hyperhive/agents";
|
||||
const MANAGER_RUNTIME_ROOT: &str = "/run/hyperhive/manager";
|
||||
/// Manager-editable per-agent config repos. Bind-mounted RW into the manager
|
||||
/// container as `/agents/<name>/`. Hive-c0re only writes to these on first
|
||||
/// spawn (initial commit); after that it's manager-only.
|
||||
|
|
@ -857,12 +856,15 @@ impl Coordinator {
|
|||
Self::agent_dir(name).join("mcp.sock")
|
||||
}
|
||||
|
||||
/// Runtime dir for the manager. Uses the same per-agent subdir layout as
|
||||
/// sub-agents — the manager is just another agent under
|
||||
/// `AGENT_RUNTIME_ROOT` with its own subdirectory.
|
||||
pub fn manager_dir() -> PathBuf {
|
||||
PathBuf::from(MANAGER_RUNTIME_ROOT)
|
||||
Self::agent_dir(crate::lifecycle::MANAGER_NAME)
|
||||
}
|
||||
|
||||
pub fn manager_socket_path() -> PathBuf {
|
||||
Self::manager_dir().join("mcp.sock")
|
||||
Self::socket_path(crate::lifecycle::MANAGER_NAME)
|
||||
}
|
||||
|
||||
/// Ensure a runtime dir + (for sub-agents) per-agent socket exists. For
|
||||
|
|
@ -872,7 +874,7 @@ impl Coordinator {
|
|||
/// `/run/hive/mcp.sock` bind that ends up in `set_nspawn_flags`.
|
||||
pub fn ensure_runtime(self: &Arc<Self>, name: &str) -> Result<PathBuf> {
|
||||
if name == crate::lifecycle::MANAGER_NAME {
|
||||
let dir = Self::manager_dir();
|
||||
let dir = Self::agent_dir(name);
|
||||
std::fs::create_dir_all(&dir)
|
||||
.with_context(|| format!("create manager dir {}", dir.display()))?;
|
||||
return Ok(dir);
|
||||
|
|
|
|||
Loading…
Reference in a new issue