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

@ -35,6 +35,21 @@ pub const PASSWORD: &str = "password";
/// The field of [`user_path`] holding the htpasswd line.
pub const HTPASSWD: &str = "htpasswd";
/// The field of [`ready_path`].
pub const READY: &str = "ready";
/// Where the archive host announces itself. `swarm-controller` writes no
/// credentials until this exists, so a swarm without an archive gets none.
///
/// # Errors
/// Never in practice: the segments are constants.
pub fn ready_path() -> Result<String, Error> {
Ok(format!(
"{}/ready",
principal_prefix(Kind::Service, SERVICE)?
))
}
/// The directory holding every [`user_path`], to list.
///
/// # Errors
@ -104,6 +119,10 @@ mod tests {
grant_path("alpha", "atlas").expect("plain names"),
"swarm/hives/alpha/archive/atlas"
);
assert_eq!(
ready_path().expect("constant"),
"swarm/services/archive/ready"
);
assert_eq!(
users_prefix().expect("constant"),
"swarm/services/archive/users"