ElectionOutcome

sealed interface ElectionOutcome

How a member's wait for the session ended — the result of ElectionLobby.awaitRoom.

There are three ways it can end, and two of them are not the session starting. Returning them as a sealed value rather than as one adopted Room plus one exception is deliberate: the failure mode this prevents is a caller not realising BecameHost exists at all, and documentation does not prevent that (#1483).

Inheritors

Types

Link copied to clipboard
data class Adopted(val room: Room) : ElectionOutcome

The elected host froze the lobby and committed. room is this peer's joined session.

Link copied to clipboard

This peer is now the elected host, and the other members are still here. The peer that was hosting left the roster, ElectionLobby.host recomputed to ElectionLobby.selfId, and a member can never receive a Freeze from a host that is now itself — so the wait ended. Nothing collapsed: the seam is live and the co-members are parked in their own awaitRoom on it.

Link copied to clipboard
data class Torn(val reason: CloseReason) : ElectionOutcome

The election collapsed mid-2PC: the co-elector(s) needed to finish it are gone, either through a transport tear or through a membership drain that left this peer alone. Retryable — re-run electLobby(...) to rejoin and re-elect. reason is the seam's own us.tractat.kuilt.core.CloseReason when it tore, else us.tractat.kuilt.core.CloseReason.Unreachable.