Vixen
02b45cc4
csharp
public sealed class PlayerGrain

The grain around PlayerLeaseState. A scheduling decision, and nothing more.

Read the guide page for this →

Remarks

⚠ Every grain in this assembly is this thin, on purpose. The logic is a plain class that a test constructs and drives; the grain supplies the one property the logic depends on and cannot provide for itself — that it is never re-entered. Writing the state machine inside the grain would make it untestable without a silo, which is how a coordination layer ends up with no tests at all.

Methods (6)

  • public PlayerGrain(LeaseOptions? options = null)

    The grain around PlayerLeaseState. A scheduling decision, and nothing more.

  • public Task<PlayerLease> AcquireLease(ShardId shard)

    Takes the lease for a shard, superseding whoever held it.

  • public Task<PlayerLease> RenewLease(ShardId shard, long epoch)

    Says the holder is still alive.

  • public Task ReleaseLease(ShardId shard, long epoch)

    Gives it back.

  • public Task<PlayerLease> Lease()

    Who holds it, without taking it.

  • public Task<ShardId> Where()

    Which shard this character is on, as far as the cluster knows.