mirror of
https://github.com/block/buzz.git
synced 2026-08-18 06:50:31 +02:00
Adds the control plane for cross-pod huddle joins: the counterpart to the media datagram fan-out in audio/mesh.rs. `resolve_join` decides which pod owns a huddle (Redis fenced CAS lease is the arbiter; mesh membership is only a hint) and returns a `JoinOutcome` the handler acts on — LocalOwner (admit here) or RemoteOwner (register with the owning pod over HuddleControl). Fencing is enforced on the join hop: a remote-owner outcome is validated against the live lease via `validate_fenced_header` before routing, mapping failures to typed MeshError variants (never media-drop semantics). The owner re-validates on receipt — fencing at every hop. Defines the HuddleControl payload schema (`HuddleControlMsg`, postcard) carried opaquely in MeshStreamFrame::Data: RegisterPeer/PeerRegistered/RegisterRejected/ UnregisterPeer, with a fence-rejection taxonomy 1:1 with the media path's. Dependency-injected via the `HuddleDirectory` trait (impl'd for SessionDirectory) so the resolver is unit-tested without Redis. No touches to state.rs/main.rs/routes — the handler.rs hook lands after the startup-wiring lane adds `state.mesh()`. 8 tests; build + clippy clean. Co-authored-by: Tyler Longwell <tlongwell@block.xyz> Signed-off-by: Tyler Longwell <tlongwell@block.xyz>