Watch
0
0
Fork
You've already forked hyperhive
0

swarm-archive: back up every agent's state to an append-only restic repository per agent

swarm-archive serves restic repositories with rclone, append-only, one login
and one repository per agent. swarm-controller writes each placed agent's
login and restic password to the store, replaces them on a move and removes
them when the agent is destroyed. Every hive backs its agents up hourly under
its own store identity. The archive host prunes by retention.
This commit is contained in:
atlas 2026-11-10 07:49:49 +01:00
commit 306aae0378

View file

@ -366,7 +366,8 @@ fn spawn_subagent_streams(status: Option<&Arc<status::StatusReader>>, hives: &[H
/// schedule keys, and the permissions bucket and its import, the allowed
/// domains derived from backend environments, and the
/// archetypes agents are created from. Beside them, the
/// copy of the cache facts to each hive, and the proxy credentials squid checks.
/// copy of the cache facts to each hive, the archive credentials of each placed
/// agent, and the proxy credentials squid checks.
/// Lifted out of `main` for `clippy::too_many_lines`.
pub(crate) fn spawn_per_agent_upkeep(
status: Option<&Arc<status::StatusReader>>,
@ -377,12 +378,22 @@ pub(crate) fn spawn_per_agent_upkeep(
spawn_agent_permissions(status, hives);
spawn_backend_egress_backfill(status, hives);
crate::attic_copy::spawn(hives.iter().map(|h| h.name.clone()).collect());
spawn_archive_access(status, hives);
crate::proxy_credential::spawn(hives.iter().map(|h| h.name.clone()).collect());
if let Some(status) = status {
archetypes::spawn(status.queue_client());
}
}
/// Grant and revoke each placed agent's archive credentials when a swarm queue
/// is wired up. Same shape as [`spawn_subagent_streams`].
fn spawn_archive_access(status: Option<&Arc<status::StatusReader>>, hives: &[HiveEntry]) {
let Some(wanted) = wanted_writer(status) else {
return;
};
crate::archive_access::spawn(wanted, hives.iter().map(|h| h.name.clone()).collect());
}
/// Create the agent-permissions bucket and answer hives' imports when a swarm
/// queue is wired up. Same shape as [`spawn_subagent_streams`].
fn spawn_agent_permissions(status: Option<&Arc<status::StatusReader>>, hives: &[HiveEntry]) {