refactor(#2862): one snapshot store per swarm, not one per peer

The push side modelled a store per peer hive: a --peer argument, a
swarm.peers.<domain>.snapshotStorePort option, and a swarm_peers module
whose entire job was answering "which peer". A swarm has exactly one
store, so none of that had anything to select between.

The receiver already proved it. It keys destination directories by
agent, not by sending hive, precisely so an agent that migrates keeps
one unbroken incremental chain -- which only makes sense if every hive
pushes to the same place. Per-hive stores would split the chain in two,
the case that keying exists to prevent.

So the destination moves to services.hyperhive.swarm.snapshotStore,
rendered into HYPERHIVE_SNAPSHOT_STORE, and swarm_peers is deleted
rather than adapted. address has no default because it is a
deployment fact this host cannot derive; port defaults because it is a
convention both ends read from the same option docs. An unset or empty
address fails naming the option instead of connecting somewhere
arbitrary, and a test asserts the message suggests no value.
This commit is contained in:
atlas 2026-07-31 22:00:59 +02:00 committed by mara
commit ba71e45486
9 changed files with 171 additions and 279 deletions

View file

@ -638,14 +638,17 @@ pub enum SnapshotCmd {
#[arg(long)]
dest: String,
},
/// Stream a snapshot to a peer hive's snapshot store over the
/// Stream a snapshot to the swarm's snapshot store over the
/// WireGuard mesh — the network half of the migration transport.
///
/// Nothing is staged locally: `btrfs send` writes straight into the
/// connection, so a multi-gigabyte agent needs no scratch space on
/// this host. The mesh is the authentication (cryptokey routing
/// binds the peer's address to its key), so there is no credential
/// binds the sender's address to its key), so there is no credential
/// to pass here.
///
/// There is no destination argument: a swarm has one store, read
/// from `services.hyperhive.swarm.snapshotStore`.
Push {
/// Snapshot label passed to `subvol snapshot create --label`.
label: String,
@ -655,10 +658,5 @@ pub enum SnapshotCmd {
/// Omit for a full send.
#[arg(long)]
parent: Option<String>,
/// Peer hive domain, as declared in
/// `services.hyperhive.swarm.peers`. Its mesh address and
/// snapshot-store port are read from there.
#[arg(long)]
peer: String,
},
}