public sealed class QueueStateOne queue, as a state machine a test can drive.
Remarks
Grains over state machines, a seventh time. The matching itself is Vixen.Live.Matchmaking's and stays a pure function of tickets and a clock; what is here is the bookkeeping a grain is for — who is waiting, what has been formed, and which seats a backfill has opened.
⚠ Deliberately not holding a Matchmaker. Its queue is the thing this type replaces: doc 28 says a ticket is *"a grain-held record"*, so the tickets live here and the matcher is handed a snapshot of them per cycle. Two queues — one in the grain and one in the matchmaker — is two places a ticket can be, and cancelling would have to hit both.
⚠ Formed is not started. A roster still needs a shard and allocating one can fail, so its tickets are held rather than released and the caller confirms or abandons.
Fields and properties (2)
public int WaitingHow many tickets are waiting.
public int OpenHow many matches are formed and not yet started.
Methods (9)
public QueueState(IQueueMatcher? matcher = null)Makes one.
public QueueTicket Enqueue(QueueEntry entry)Joins the queue.
public bool Cancel(string ticket)Gives up.
public QueueTicket? Ticket(string ticket)Where a ticket has got to.
public ImmutableArray<QueueMatch> Cycle(DateTimeOffset now)Forms whatever can be formed.
public bool Start(Guid match)Says a formed match got its shard.
public bool Abandon(Guid match, DateTimeOffset now)Says a formed match did not get one.
public bool Backfill(Guid match, int seats)Says somebody left a running match.
public QueueSnapshot Read(DateTimeOffset now)What the queue looks like.
Used by (2)
- QueueGrainVixen.Live.Orchestrator
- QueueStateTestsVixen.Live.Orchestrator.Tests