Vixen
caa30e12
csharp
public sealed class GuildState

One guild's roster, as a state machine a test can drive.

Read the guide page for this →

Remarks

Grains over state machines, a fifth time. There is no lock here and there must never be one: what makes it correct is that GuildGrain takes one turn at a time.

⚠ It checks rank, never permission. Whether an officer may kick is a tag on a compiled charter and the realm answers it with the code the client greys the button with. What no local check can win is the race — two officers demoting each other at the same moment — so the grain re-checks the part that is arithmetic: you may not act on somebody at or above your own rank.

⚠ Rank 0 is the leader and there is always exactly one of them. Every rule below exists to keep that true, because a guild with no leader is one nobody can administer again and a guild with two is a state no rule here could resolve afterwards.

Fields and properties (8)

  • public Func<DateTimeOffset> Now

    The clock.

  • public string Charter

    Which charter, by address. Empty until founded.

  • public string Name

    What it is called.

  • public int Capacity

    How many its charter allows.

  • public DateTimeOffset Founded

    When it was founded.

  • public uint Revision

    How many times it has changed.

  • public int Count

    How many are in it.

  • public bool Exists

    Whether it has been founded.

Methods (9)

Used by (2)

  • GuildGrainVixen.Live.Orchestrator
  • GuildStateTestsVixen.Live.Orchestrator.Tests