Vixen
c7401864
csharp
public sealed class LockoutBridge

Doc 28's lockouts against doc 27's IInstanceGrain: answered in the frame, written down afterwards, and never awaited.

Read the guide page for this →

Remarks

LedgerBridge's shape for the same reason. ILockoutStore is synchronous because a zone-in asks it mid-frame; the grain that owns the answer is a round trip. ADR-016 forbids awaiting one, so the bridge answers from a view and posts the write.

⚠ But a lockout is not a balance, and the difference is dangerous. An unknown balance reads as zero and a player is refused a purchase — annoying, and safe. An unknown lockout reads as null, which Find defines as "not locked" — so a player whose lockouts have not been loaded is admitted to a raid they are already saved to, and the run they get is one the fleet cannot take back. Doc 28's whole reason for making this fleet-wide is that *"a lockout one shard knew about is a lockout a player evades by zoning"*, and a cold cache is that hole reopened from inside.

⚠ The interface cannot express "I do not know", so the mistake is counted instead. IsWarm is what admission checks before letting anybody in, and a Find for somebody who was never warmed increments ColdReads and raises Cold. That is the same posture Divergences takes: a wrong answer that cannot be prevented by the type is made loud rather than quiet.

Fields and properties (4)

  • public int Count

    How many lockouts the view holds.

  • public int Warm

    How many players have been loaded.

  • public int Pending

    How many writes are waiting.

  • public int ColdReads

    How many times somebody was asked about who had never been loaded. Never anything but zero.

Events (1)

  • public Action<PlayerId>? Cold

    Raised when a lockout is read for somebody who was never loaded.

Methods (9)

  • public LockoutBridge(IGameplayIdentity identity)

    Makes one.

  • public bool IsWarm(PlayerId player)

    Whether somebody's lockouts have been loaded.

  • public void Warmed(PlayerId player, IEnumerable<Lockout> lockouts)

    Puts somebody's lockouts in, as the cluster gave them.

  • public bool Forget(PlayerId player)

    Forgets somebody who left.

  • public Lockout? Find(PlayerId subject, DefId instance, string difficulty)

    What somebody is locked to.

  • public void Save(Lockout lockout)

    Records or extends one.

  • public int Purge(double now)
  • public ImmutableArray<PendingLockout> Drain()

    Takes everything waiting to be written down.

  • public bool Settle(PendingLockout write)

    Says a write landed.

Used by (5)

  • MmoRealmMmo.Realm
  • RealmTestsMmo.Realm.Tests
  • ShardMmo.Soak
  • SoakMmo.Soak
  • LockoutBridgeTestsVixen.Live.Gameplay.Tests