public sealed class PlayerAdmissionThe door: a ticket, a capacity check, and a name to hold the session's player against.
Remarks
An ISessionAuthenticator, which is doc 16's existing seam and needs no new mechanism: the session hands over whatever the client sent at the handshake, and this decides. What arrives is an encoded TransferTicket; what comes back is accept-as-somebody or a named refusal.
⚠ Synchronous, and it has to stay that way. The interface allows Pending for an authenticator that has to ask an identity provider — and this one never does, because the ticket is self-contained and the key is already here. That is the property ADR-020 was designed for: admission costs an HMAC, so a transfer's second session opens in the time it takes to hash a hundred bytes rather than in a round trip to the orchestrator.
Fields and properties (6)
public Func<DateTimeOffset> NowThe realm's clock, for expiry. Replaceable so a test does not have to wait.
public bool IsDrainingWhether the shard is taking arrivals.
public int CountHow many are here.
public IReadOnlyCollection<RealmPlayer> PlayersEverybody here.
public AdmissionRefusal LastRefusalWhy the last refusal happened, for the heartbeat and the log.
public IReadOnlyDictionary<AdmissionRefusal, int> RefusalsHow many have been turned away, by reason.
Methods (6)
public PlayerAdmission(RealmSpec spec, TransferTicketSigner signer)Stands a door up.
public AuthenticationDecision Authenticate(in AuthenticationRequest request)Decides, or says it is still deciding.
public RealmPlayer? Bind(NetworkPlayer player)Ties a session player to the ticket that got them in.
public RealmPlayer? Release(PlayerId id)Forgets somebody who has left.
public bool TryGet(PlayerId id, out RealmPlayer? player)Finds somebody by their session identity.
public bool TryGet(PlayerKey key, out RealmPlayer? player)Finds somebody by who they durably are.
Used by (2)
- RealmHostVixen.Live.Realm
- RealmHostTestsVixen.Live.Realm.Tests