Make daemon verse host settings typed state
This commit is contained in:
parent
6de0141b33
commit
1bb80638f2
14 changed files with 466 additions and 24 deletions
|
|
@ -17,6 +17,7 @@ var evePendingBefore = CountPendingEveCommands(statePath);
|
|||
var now = DateTimeOffset.UtcNow.ToString("O");
|
||||
|
||||
await using var node = await AetheriaStateNode.OpenAsync(statePath, runtimeId);
|
||||
var verseHostSettings = await EnsureVerseHostSettingsAsync(node, now);
|
||||
await node.PutRuntimeSessionAsync(new AetheriaRuntimeSession
|
||||
{
|
||||
RuntimeId = runtimeId,
|
||||
|
|
@ -67,9 +68,15 @@ var completedSession = new AetheriaRuntimeSession
|
|||
Status = "completed"
|
||||
};
|
||||
await node.PutRuntimeSessionAsync(completedSession);
|
||||
await node.PutOperationsSurfaceAsync(AetheriaOperationsSurfaceProjector.Build(commitStatus, eveStatus, completedSession));
|
||||
await node.PutOperationsSurfaceAsync(
|
||||
AetheriaOperationsSurfaceProjector.Build(
|
||||
commitStatus,
|
||||
eveStatus,
|
||||
verseHostSettings,
|
||||
completedSession));
|
||||
await PublishPlayerSettingsSurfaceAsync(node, now);
|
||||
await node.PutProviderAdvertisementAsync(AetheriaProviderAdvertisementProjector.Build(statePath, now));
|
||||
await node.PutProviderAdvertisementAsync(
|
||||
AetheriaProviderAdvertisementProjector.Build(verseHostSettings, statePath, now));
|
||||
await node.FlushAsync();
|
||||
|
||||
Console.WriteLine($"Applied pending Aetheria runtime commits: {statePath}");
|
||||
|
|
@ -110,3 +117,16 @@ static async Task PublishPlayerSettingsSurfaceAsync(AetheriaStateNode node, stri
|
|||
await node.PutPlayerSettingsSurfaceAsync(
|
||||
AetheriaPlayerSettingsSurfaceProjector.Build(settings, publishedAtUtc)).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
static async Task<AetheriaVerseHostSettings> EnsureVerseHostSettingsAsync(AetheriaStateNode node, string now)
|
||||
{
|
||||
var existing = await node.GetVerseHostSettingsAsync().ConfigureAwait(false);
|
||||
var normalized = AetheriaVerseHostSettingsNormalizer.Normalize(existing);
|
||||
if (existing == null || string.IsNullOrWhiteSpace(existing.LastUpdatedAtUtc))
|
||||
{
|
||||
normalized.LastUpdatedAtUtc = now;
|
||||
await node.PutVerseHostSettingsAsync(normalized).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue