/ GUNRPG.Application / Distributed / IGameAuthority.cs
IGameAuthority.cs
 1  namespace GUNRPG.Application.Distributed;
 2  
 3  /// <summary>
 4  /// Abstraction over how game state is replicated and authority is managed.
 5  /// Implementations may be offline (single-node) or distributed (peer-to-peer lockstep).
 6  /// </summary>
 7  public interface IGameAuthority
 8  {
 9      /// <summary>Unique identifier for this node in the distributed network.</summary>
10      Guid NodeId { get; }
11  
12      /// <summary>Submit a player action to the authority for processing.</summary>
13      Task SubmitActionAsync(PlayerActionDto action, CancellationToken ct = default);
14  
15      /// <summary>Get the current game state as a DTO.</summary>
16      GameStateDto GetCurrentState();
17  
18      /// <summary>Get the current state hash (SHA256 hex string).</summary>
19      string GetCurrentStateHash();
20  
21      /// <summary>Get the full ordered action log.</summary>
22      IReadOnlyList<DistributedActionEntry> GetActionLog();
23  
24      /// <summary>Whether this authority is in a desynchronized state.</summary>
25      bool IsDesynced { get; }
26  }