public sealed class InstanceStateOne saved instance, as a state machine a test can drive.
Remarks
Grains over state machines, a sixth time. No lock, because InstanceGrain takes one turn at a time.
⚠ There is no clock in this type. Every method that needs to know whether the lockout has lifted is handed the time, for HousePlot's reason one tier up: a grain that ticked would be a grain the cluster has to keep activated, and an instance nobody has asked about for a week is one whose reset can be noticed the next time somebody does.
⚠ The expiry is an absolute boundary the caller computed. Doc 28's LockoutPolicy.NextResetAfter is the only place a reset time comes from — a timer from when somebody entered would drift every player's reset to wherever their first run happened to fall, and a guild that raids on Wednesdays would find half its roster locked.
Fields and properties (9)
public string InstanceWhich instance, by address. Empty until opened.
public string DifficultyWhich difficulty.
public int CapacityHow many may be bound.
public DateTimeOffset OpenedWhen it was opened.
public DateTimeOffset ExpiresWhen the lockout lifts.
public bool ClosedWhether it has ended.
public uint RevisionHow many times it has changed.
public int CountHow many are bound.
public bool ExistsWhether it has been opened.
Methods (8)
public InstanceRecord Read()What it looks like.
public bool IsBound(PlayerKey player)Whether somebody is saved to it.
public bool IsDefeated(string encounter)Whether something is dead.
public InstanceOutcome Open(string instance, string difficulty, ImmutableArray<PlayerKey> access, int capacity, DateTimeOffset now, DateTimeOffset expires)Opens it.
public InstanceOutcome Bind(PlayerKey player, DateTimeOffset now)Saves somebody to it.
public InstanceOutcome Defeat(string encounter, DateTimeOffset now)Records that something is dead.
public InstanceOutcome Close()Ends it early.
public void Restore(InstanceRecord saved, int capacity, ImmutableArray<PlayerKey> access)Puts a saved instance back, as it was, with no checks.
Used by (2)
- InstanceGrainVixen.Live.Orchestrator
- InstanceStateTestsVixen.Live.Orchestrator.Tests