Class DirectoryClaimStore
Persists and exposes the EchoHubSpace directory claim — the opaque token issued on first
registration and the row's stable ServerId. Also surfaces ephemeral registration
status (success/failure code, conflicting hosts) for operator-facing endpoints.
Persistence uses atomic write (tmp + rename). Treat the file contents as a secret.
public sealed class DirectoryClaimStore
- Inheritance
-
DirectoryClaimStore
- Inherited Members
Constructors
DirectoryClaimStore(IConfiguration, ILogger<DirectoryClaimStore>)
public DirectoryClaimStore(IConfiguration configuration, ILogger<DirectoryClaimStore> logger)
Parameters
configurationIConfigurationloggerILogger<DirectoryClaimStore>
Properties
ClaimToken
public string? ClaimToken { get; }
Property Value
FilePath
public string FilePath { get; }
Property Value
ServerId
public Guid? ServerId { get; }
Property Value
- Guid?
Status
public RegistrationStatus Status { get; }
Property Value
Methods
SaveClaimAsync(string, Guid, CancellationToken)
Persist a freshly-issued claim token alongside the server's stable ServerId. Called exactly once per row's lifetime — on first claim. Atomic on-disk swap.
public Task SaveClaimAsync(string claimToken, Guid serverId, CancellationToken ct = default)
Parameters
Returns
- Task
SetFailure(string, string[]?)
public void SetFailure(string errorCode, string[]? conflictingHosts)
Parameters
SetSuccess(Guid)
public void SetSuccess(Guid serverId)
Parameters
serverIdGuid
UpdateServerIdAsync(Guid, CancellationToken)
Update only the ServerId — used when re-registering with an existing token (Success path, hub returns ServerId again but no fresh token). No-op if the value is unchanged.
public Task UpdateServerIdAsync(Guid serverId, CancellationToken ct = default)
Parameters
serverIdGuidctCancellationToken
Returns
- Task