Watch
0
0
Fork
You've already forked hyperhive
0

swarm-archive: grant only once an archive is up; keep logins across a gap in placements

The archive host creates a ready marker in the store and swarm-controller
writes no credentials before it exists, so a swarm without an archive, and a
mixed-version swarm, leave every hive backup a logged no-op. A hive with no
declaration no longer counts as placing nothing: its copies and its agents'
user lines stay. The restic password is pinned by tests across a revoke, a
re-placement and a move.
This commit is contained in:
atlas 2026-11-10 08:18:45 +01:00
commit 91f36f39d2

View file

@ -965,13 +965,28 @@ pub(crate) async fn placements(
wanted: &wanted::WantedWriter,
hives: &[String],
) -> Result<std::collections::BTreeSet<(String, String)>> {
Ok(placements_with_gaps(wanted, hives).await?.0)
}
/// [`placements`], and the hives that have no declaration at all. Such a hive
/// places nothing here, but the queue cannot tell a hive that never had agents
/// from one whose declaration is not there (yet).
pub(crate) async fn placements_with_gaps(
wanted: &wanted::WantedWriter,
hives: &[String],
) -> Result<(
std::collections::BTreeSet<(String, String)>,
std::collections::BTreeSet<String>,
)> {
let mut placed = std::collections::BTreeSet::new();
let mut undeclared = std::collections::BTreeSet::new();
for hive in hives {
let Some(declared) = wanted
.view(hive)
.await
.map_err(|e| e.context(format!("read where hive {hive} places agents")))?
else {
undeclared.insert(hive.clone());
continue;
};
placed.extend(
@ -982,7 +997,7 @@ pub(crate) async fn placements(
.map(|(name, _)| (hive.clone(), name)),
);
}
Ok(placed)
Ok((placed, undeclared))
}
/// Every agent in `placements`, with its archetype.