chadtmiller.com/group-host
atmosphere group host
0
0
A group moved in is in its own spaces' writer sets
crates/group-host/src/migration.rs+4−0
| @@ -748,6 +748,10 @@ pub async fn migrate_activate( | ||
} | ||
let on = host.activate_arrived(&group, &account.handle); | ||
on.map_err(XrpcError::internal)?; | ||
// Its repos in spaces were written while it was off, which no space | ||
// hears of: each is told now, as an account brought here is. | ||
let told = host.tell_spaces(&group).await; | ||
told.map_err(XrpcError::internal)?; | ||
let spaces = host.store.spaces_of(&group).map_err(XrpcError::internal)?; | ||
for space in &spaces { | ||
host.reindex(space); | ||
crates/group-host/tests/migration.rs+5−0
| @@ -242,6 +242,11 @@ async fn moves_a_group_whole_to_another_host() { | ||
assert_eq!(status, 200, "{on}"); | ||
assert_eq!(on["spaces"], spaces.len()); | ||
assert!(b.host.deactivation(&did).unwrap().is_none()); | ||
// The group's own repo in each of its spaces is told once it is on. | ||
for space in spaces.iter().filter_map(Json::as_str) { | ||
let writers = b.host.store.writers(space, None, 100).unwrap(); | ||
assert!(writers.iter().any(|w| w.did == did), "{space}: {writers:?}"); | ||
} | ||
let lxm = format!("{NS}.getGroup"); | ||
let (_, view) = get(&b, &lxm, &format!("group={did}"), &[auth(&b, &alice, &lxm)]).await; | ||
assert_eq!(view["group"]["displayName"], "Riders"); | ||
docs/design/moving.md+3−2
| @@ -108,8 +108,9 @@ of it. The group's account and data stay there, switched off. | ||
`migrateActivate` is refused `NotYet` until the DID document names the | ||
new host's `PUBLIC_URL` as its PDS and the signing key made there; asking | ||
again once the directory has caught up succeeds. It switches the group | ||
on, tells the relays its handle and that it is active, and queues each of | ||
its spaces to be read again for the index. | ||
on, tells the relays its handle and that it is active, tells each of its | ||
spaces of the group's repo there (written while it was off, which no | ||
space hears of), and queues each to be read again for the index. | ||
| ||
So the group is whole on one host at every step. Before the hand-over, | ||
the host it leaves controls it, and a failed receive left nothing at the | ||