Package-level declarations

Types

Link copied to clipboard
interface ElectionLobby

A pre-session lobby over a symmetric mesh. Not a Room — during the lobby there is no admit handshake, no admitted roster, no heartbeat: just the live connected peers and a reactive elected host. A Room is created exactly once, at start/awaitRoom, by adopting the woven seam with a now-fixed role. See docs/host-election-design.md.

Link copied to clipboard
sealed interface ElectionOutcome

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

Link copied to clipboard
@Serializable
sealed interface LobbyMessage

Wire messages for the host-election freeze round (#1439). Sent over the raw lobby seam BEFORE any us.tractat.kuilt.session.Room adopts it, so the framing is parallel to — and prefix-disjoint from — us.tractat.kuilt.session.admit.AdmitMessage.

Link copied to clipboard

Thrown by ElectionLobby.start on a mid-2PC peer-set collapse — the co-elector(s) needed to complete the freeze/ack round are gone. This covers both ways a fabric signals it: a transport tear (the underlying seam latches us.tractat.kuilt.core.SeamState.Torn, e.g. a 2-peer mesh whose only link dropped) and a membership drain (Seam.peers collapses to {self} while state stays Woven — the last member simply left the roster). Retryable, not fatal: the caller may re-run electLobby(...) to rejoin and re-elect. It exists so the collapse surfaces a terminal signal the caller can act on, rather than suspending start forever.

Link copied to clipboard

Thrown by ElectionLobby.start when this peer is not the currently-elected host.

Functions

Link copied to clipboard
fun electHost(peers: Set<PeerId>): PeerId

The elected host is the peer with the lowest PeerId value among those currently connected.