Module plan

Module plan 

Source
Expand description

Planning a transition, with the scope as part of the element’s identity.

§The one idea in this module

The diff’s comparison key is (element, scope), not element. It costs nothing and it deletes a whole family of special cases.

When a player changes team, their scope goes from /g7/t3 to /g7/t2. That is not “a field that changed”, it is the entry (B, /g7/t3) disappearing and the entry (B, /g7/t2) appearing. So the ordinary diff produces, on its own:

RemoveUser(B)               [scope /g7/t3]
AddUser(B, channel Team2)   [scope /g7/t2]

and the per-connection filter stays a single branchless test:

connectionobservesreceives
teammate still in t3{/g7/t3}the Remove alone, so B leaves
player in t2{/g7/t2}the Add alone, so B arrives
spectator{/g7}both, settled by crate::compose::collapse
player in another game{/g8}nothing

A property falls out for free: a move within a scope stays a MoveUser, while a move between scopes becomes a departure and an arrival. Which is semantically exactly right.

The identifier does not change: it is the same person, and the client’s local preferences for them must survive the move. Only the diff’s notion of sameness carries the scope.

§No audio operations

Audio comes from a separate table whose ordering is guaranteed differently (guide 9.5), so the plan is purely a sequence of view mutations.

REF: docs/design/guide-implementation.md 5

Structs§

ChannelPatch
A sparse channel change.
OverlayOps
Overlay operations, split at the point crate::compose::splice needs.
PlannedOp
An operation together with the scope that decides who receives it.
UserPatch
A sparse user change. The channel move is a separate operation, because it has to be ordered before any channel removal.

Enums§

ElementId
What an operation identifies, for crate::compose::collapse.
PlanOp
One view mutation. Not a Mumble message: spelling these on the wire is crate::emit’s job.

Functions§

plan
Plan the transition from before to after.
plan_elements
Plan an overlay transition.