GamePresence

class GamePresence(seam: Seam, presenceScope: CoroutineScope, expectVirtualTime: Boolean = false)

Lobby presence over seam, backed by an EphemeralMap replicated by Quilter.

Carries each peer's host-declaration flag so the game host entry point can fail fast when a duplicate host is detected, and the host's admission-closed signal so gameJoin can throw RosterFullException when the roster is already full.

Dedicated seam required. Pass a us.tractat.kuilt.core.MuxSeam channel, not the Raft seam — Seam.incoming is single-collection (ADR-034). Task 6 wires this to the game host entry point.

Parameters

seam

the Seam to replicate presence over.

scope

the CoroutineScope whose kotlinx.coroutines.Job parents the replicator's owned child job. In tests, pass backgroundScope from kotlinx.coroutines.test.TestScope so the Quilter's infinite collectors cancel cleanly at test end.

expectVirtualTime

suppress the Quilter TestDispatcher guard warning; set true in tests that run under kotlinx.coroutines.test.UnconfinedTestDispatcher.

Constructors

Link copied to clipboard
constructor(seam: Seam, presenceScope: CoroutineScope, expectVirtualTime: Boolean = false)

Properties

Link copied to clipboard
val admissionClosed: StateFlow<Set<NodeId>?>

The final voter set once admission has closed on this presence channel, null until then.

Link copied to clipboard
val announced: StateFlow<Set<ReplicaId>>

The set of replicas that have announced themselves on this presence channel — every replica that has called declareHost or declarePresent, as observed in the converged map.

Link copied to clipboard

The ReplicaId assigned to this peer by the underlying Quilter.

Link copied to clipboard
val spectatorsClosed: StateFlow<Boolean>

true once the host has signalled that the spectator gallery is closed — either because spectators are disabled or because maxSpectators has been reached.

Functions

Link copied to clipboard

Publishes the admission-closed signal on the host's presence slot, replacing the "host" marker with an encoded form that carries the final voter set.

Link copied to clipboard

Re-opens admission by reverting the host's slot to HOST_DECLARED.

Link copied to clipboard

The converged set of replicas that have declared themselves host.

Link copied to clipboard

Declare this peer as the game host.

Link copied to clipboard

Declare this peer as a non-host participant ("present").

Link copied to clipboard

Declare this peer as a spectator (permanent non-voting learner).

Link copied to clipboard

Publishes the spectators-closed signal on the host's presence slot.

Link copied to clipboard

Declare that this voter is voluntarily leaving the session.

Link copied to clipboard

The converged set of replicas that have declared themselves as spectators.

Link copied to clipboard

The converged set of replicas that have declared a voluntary departure via declareVacate.