From ac3b711214a7f2227b3b651aac01021290721981 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 29 Jun 2026 01:04:09 +0100 Subject: [PATCH] Use generic daemon state node documents --- Aetheria.State.AuthoritySmoke/Program.cs | 22 ++-- Aetheria.State.Daemon/Program.cs | 56 ++++---- Aetheria.State.Smoke/Program.cs | 29 +++-- Aetheria.State.Verify/Program.cs | 155 ++++++++++++++++------- Aetheria.State/AetheriaStateNode.cs | 80 +----------- 5 files changed, 172 insertions(+), 170 deletions(-) diff --git a/Aetheria.State.AuthoritySmoke/Program.cs b/Aetheria.State.AuthoritySmoke/Program.cs index 13f62cfe5..d9b2d3efc 100644 --- a/Aetheria.State.AuthoritySmoke/Program.cs +++ b/Aetheria.State.AuthoritySmoke/Program.cs @@ -645,13 +645,13 @@ internal sealed class AuthoritySmokeChecks await writer.Database .PutAsync(AetheriaRuntimeVerseRecordKeys.DaemonHealth, health) .ConfigureAwait(false); - await writer.VerseAuthorityPolicy() + await writer.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy) .ReplaceAsync(policy) .ConfigureAwait(false); - await writer.StarbridgeScenario() + await writer.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest) .ReplaceAsync(scenario) .ConfigureAwait(false); - await writer.StarbridgeSession() + await writer.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest) .ReplaceAsync(session) .ConfigureAwait(false); await writer.FlushAsync().ConfigureAwait(false); @@ -773,15 +773,15 @@ internal sealed class AuthoritySmokeChecks startServer: false, enableDurableShardLogs: false).ConfigureAwait(false); - await ravenNode.VerseAuthorityPolicy() + await ravenNode.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy) .ReplaceAsync(policy) .ConfigureAwait(false); - await starfireNode.VerseAuthorityPolicy() + await starfireNode.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy) .ReplaceAsync(policy) .ConfigureAwait(false); - var ravenPolicy = await ravenNode.VerseAuthorityPolicy().ReadAsync().ConfigureAwait(false); - var starfirePolicy = await starfireNode.VerseAuthorityPolicy().ReadAsync().ConfigureAwait(false); + var ravenPolicy = await ravenNode.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy).ReadAsync().ConfigureAwait(false); + var starfirePolicy = await starfireNode.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy).ReadAsync().ConfigureAwait(false); Require(ravenPolicy != null, "raven node should load authority policy"); Require(starfirePolicy != null, "starfire node should load authority policy"); @@ -1117,14 +1117,14 @@ internal sealed class AuthoritySmokeChecks startServer: false, enableDurableShardLogs: false).ConfigureAwait(false); - await node.VerseAuthorityPolicy() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy) .ReplaceAsync(policy) .ConfigureAwait(false); foreach (var command in commands) await node.SubmitDaemonCommandAsync(command).ConfigureAwait(false); await node.FlushAsync().ConfigureAwait(false); - await node.LatestFrame() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest) .ReplaceAsync(AetheriaRuntimeDaemonFrameDocument.Create( InitialCoopRun(), runtimeId, @@ -1332,7 +1332,7 @@ internal sealed class AuthoritySmokeChecks runtimeId, startServer: false, enableDurableShardLogs: false).ConfigureAwait(false); - var frame = await node.LatestFrame().ReadAsync().ConfigureAwait(false); + var frame = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest).ReadAsync().ConfigureAwait(false); if (frame != null) { lastFrame = frame; @@ -1459,7 +1459,7 @@ internal sealed class AuthoritySmokeChecks runtimeId, startServer: false, enableDurableShardLogs: false).ConfigureAwait(false); - return await node.LatestFrame().ReadAsync().ConfigureAwait(false); + return await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest).ReadAsync().ConfigureAwait(false); } private static string ProcessDiagnostics(IReadOnlyList childProcesses) diff --git a/Aetheria.State.Daemon/Program.cs b/Aetheria.State.Daemon/Program.cs index 0fa1141af..dd3607fb2 100644 --- a/Aetheria.State.Daemon/Program.cs +++ b/Aetheria.State.Daemon/Program.cs @@ -31,7 +31,7 @@ await EnsureVerseAuthorityPolicyAsync(node, options).ConfigureAwait(false); discoveryHost.Update(verseHost); await PublishRuntimeSessionAsync(node, options, startedAtUtc, "starting").ConfigureAwait(false); await PublishStateSurfacesAsync(node, options, startedAtUtc).ConfigureAwait(false); -var latestFrame = await node.LatestFrame().ReadAsync().ConfigureAwait(false); +var latestFrame = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest).ReadAsync().ConfigureAwait(false); using var cultMeshRudpHost = StartRtsCultMeshHost(node, options, () => latestFrame); using var rtsPumpCancellation = new CancellationTokenSource(); var rtsPump = RunRtsCultMeshPumpAsync(cultMeshRudpHost, rtsPumpCancellation.Token); @@ -138,9 +138,9 @@ static async Task TickAsync( .Where(command => command != null && !accountedCommandIds.Contains(command.CommandId ?? "")) .ToArray(); var policyRejectedCommandIds = new List(); - var authorityPolicy = await node.VerseAuthorityPolicy().ReadAsync().ConfigureAwait(false); - var starbridgeScenario = await node.StarbridgeScenario().ReadAsync().ConfigureAwait(false); - var starbridgeSession = await node.StarbridgeSession().ReadAsync().ConfigureAwait(false); + var authorityPolicy = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy).ReadAsync().ConfigureAwait(false); + var starbridgeScenario = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest).ReadAsync().ConfigureAwait(false); + var starbridgeSession = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest).ReadAsync().ConfigureAwait(false); var authorityLeases = node.ReadAuthorityLeases(); var authorizedCommands = AetheriaRuntimeAuthorityRouter.AuthorizedCommands( pendingObservedCommands, @@ -389,7 +389,7 @@ static RudpCultNetSchemaServer StartRtsCultMeshHost( .ToArray(); } - var health = await node.Health().ReadAsync().ConfigureAwait(false); + var health = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth).ReadAsync().ConfigureAwait(false); if (health != null && SnapshotWants( request, AetheriaRuntimeDaemonSchemas.Health, @@ -412,7 +412,7 @@ static RudpCultNetSchemaServer StartRtsCultMeshHost( .ToArray(); } - var authorityPolicy = await node.VerseAuthorityPolicy().ReadAsync().ConfigureAwait(false); + var authorityPolicy = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy).ReadAsync().ConfigureAwait(false); if (authorityPolicy != null && SnapshotWants( request, AetheriaRuntimeDaemonSchemas.VerseAuthorityPolicy, @@ -435,7 +435,7 @@ static RudpCultNetSchemaServer StartRtsCultMeshHost( .ToArray(); } - var starbridgeScenario = await node.StarbridgeScenario().ReadAsync().ConfigureAwait(false); + var starbridgeScenario = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest).ReadAsync().ConfigureAwait(false); if (starbridgeScenario != null && SnapshotWants( request, AetheriaRuntimeDaemonSchemas.StarbridgeScenario, @@ -487,7 +487,7 @@ static RudpCultNetSchemaServer StartRtsCultMeshHost( AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface.ToString(), "editor-tui").ConfigureAwait(false); - var starbridgeSession = await node.StarbridgeSessionSummary().ReadAsync().ConfigureAwait(false); + var starbridgeSession = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionSummary).ReadAsync().ConfigureAwait(false); if (starbridgeSession != null && SnapshotWants( request, @@ -625,10 +625,10 @@ static Task ReadEveSurfacePublicationAsync(AetheriaStateNode n { return surfaceKind switch { - "game" => node.DaemonGameSurface().ReadAsync(), - "game-tui" => node.DaemonGameTuiSurface().ReadAsync(), - "editor" => node.DaemonEditorSurface().ReadAsync(), - "editor-tui" => node.DaemonEditorTuiSurface().ReadAsync(), + "game" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface).ReadAsync(), + "game-tui" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface).ReadAsync(), + "editor" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface).ReadAsync(), + "editor-tui" => node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface).ReadAsync(), _ => throw new ArgumentOutOfRangeException(nameof(surfaceKind), surfaceKind, "Unknown Eve surface publication.") }; } @@ -747,47 +747,47 @@ static async Task PublishDaemonApiDocumentsAsync( AetheriaStateNode node, AetheriaRuntimeDaemonTickResult result) { - await node.LatestFrame() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest) .ReplaceAsync(result.Frame) .ConfigureAwait(false); if (result.SoaView != null && string.Equals(result.SoaView.Schema, AetheriaRuntimeDaemonSchemas.SoaView, StringComparison.Ordinal)) { - await node.LatestSoaView() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest) .ReplaceAsync(result.SoaView) .ConfigureAwait(false); } if (result.ProviderAdvertisement != null) - await node.ProviderAdvertisement() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement) .ReplaceAsync(result.ProviderAdvertisement) .ConfigureAwait(false); if (result.Health != null) - await node.Health() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth) .ReplaceAsync(result.Health) .ConfigureAwait(false); if (result.CommandBoundary != null) - await node.CommandBoundary() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary) .ReplaceAsync(result.CommandBoundary) .ConfigureAwait(false); if (result.StarbridgeSessionSummary != null) - await node.StarbridgeSessionSummary() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionSummary) .ReplaceAsync(result.StarbridgeSessionSummary) .ConfigureAwait(false); if (result.GameSurface != null) - await node.DaemonGameSurface() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) .ReplaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(result.GameSurface)) .ConfigureAwait(false); if (result.GameTuiSurface != null) - await node.DaemonGameTuiSurface() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface) .ReplaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(result.GameTuiSurface)) .ConfigureAwait(false); if (result.EditorSurface != null) - await node.DaemonEditorSurface() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface) .ReplaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(result.EditorSurface)) .ConfigureAwait(false); if (result.EditorTuiSurface != null) - await node.DaemonEditorTuiSurface() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface) .ReplaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(result.EditorTuiSurface)) .ConfigureAwait(false); } @@ -1179,8 +1179,8 @@ static async Task EnsureStarbridgeSessionDocumentsAsync( AetheriaStateNode node, AetheriaDaemonHostOptions options) { - var existingScenario = await node.StarbridgeScenario().ReadAsync().ConfigureAwait(false); - var existingSession = await node.StarbridgeSession().ReadAsync().ConfigureAwait(false); + var existingScenario = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest).ReadAsync().ConfigureAwait(false); + var existingSession = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest).ReadAsync().ConfigureAwait(false); if (existingScenario != null && string.Equals(existingScenario.Schema, AetheriaRuntimeDaemonSchemas.StarbridgeScenario, StringComparison.Ordinal) && existingSession != null && @@ -1297,10 +1297,10 @@ static async Task EnsureStarbridgeSessionDocumentsAsync( RuntimeRoles = scenario.RuntimeRoles }; - await node.StarbridgeScenario() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest) .ReplaceAsync(scenario) .ConfigureAwait(false); - await node.StarbridgeSession() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest) .ReplaceAsync(session) .ConfigureAwait(false); await node.FlushAsync().ConfigureAwait(false); @@ -1310,12 +1310,12 @@ static async Task EnsureVerseAuthorityPolicyAsync( AetheriaStateNode node, AetheriaDaemonHostOptions options) { - var existing = await node.VerseAuthorityPolicy().ReadAsync().ConfigureAwait(false); + var existing = await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy).ReadAsync().ConfigureAwait(false); if (existing != null && string.Equals(existing.Schema, AetheriaRuntimeVerseAuthoritySchemas.Policy, StringComparison.Ordinal)) return; var policy = AetheriaRuntimeVerseAuthorityPolicyDocument.TrustedCoop(options.VerseId, options.DaemonId); - await node.VerseAuthorityPolicy() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy) .ReplaceAsync(policy) .ConfigureAwait(false); } diff --git a/Aetheria.State.Smoke/Program.cs b/Aetheria.State.Smoke/Program.cs index 4047eb987..f0eb808ab 100644 --- a/Aetheria.State.Smoke/Program.cs +++ b/Aetheria.State.Smoke/Program.cs @@ -141,10 +141,14 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s daemonFrame, daemonHealth, daemonCommandBoundary); - await node.ProviderAdvertisement().ReplaceAsync(daemonProvider); - await node.Health().ReplaceAsync(daemonHealth); - await node.CommandBoundary().ReplaceAsync(daemonCommandBoundary); - await node.LatestFrame().ReplaceAsync(daemonFrame); + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement) + .ReplaceAsync(daemonProvider); + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth) + .ReplaceAsync(daemonHealth); + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary) + .ReplaceAsync(daemonCommandBoundary); + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest) + .ReplaceAsync(daemonFrame); await node.FlushAsync(); using var daemonCommandClient = await AetheriaClient.OpenAsync( statePath, @@ -165,7 +169,7 @@ await using (var node = await AetheriaStateNode.OpenAsync(statePath, "aetheria-s throw new InvalidOperationException("AetheriaClient control submission did not appear as a typed daemon state record."); } } - await node.DaemonGameSurface() + await node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) .ReplaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(daemonGameSurface)); await node.RuntimeSession("smoke-runtime").ReplaceAsync(new AetheriaRuntimeSession { @@ -625,11 +629,16 @@ await using (var reopened = await AetheriaStateNode.OpenAsync(statePath, "aether var operationsSurface = await reopened.OperationsSurface().ReadAsync(); var playerSettingsSurface = await reopened.PlayerSettingsSurface().ReadAsync(); var advertisement = await reopened.ProviderAdvertisementSurface().ReadAsync(); - var daemonProvider = await reopened.ProviderAdvertisement().ReadAsync(); - var daemonHealth = await reopened.Health().ReadAsync(); - var daemonCommandBoundary = await reopened.CommandBoundary().ReadAsync(); - var daemonFrame = await reopened.LatestFrame().ReadAsync(); - var daemonGameSurface = await reopened.DaemonGameSurface().ReadAsync(); + var daemonProvider = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement) + .ReadAsync(); + var daemonHealth = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth) + .ReadAsync(); + var daemonCommandBoundary = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary) + .ReadAsync(); + var daemonFrame = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest) + .ReadAsync(); + var daemonGameSurface = await reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface) + .ReadAsync(); var runtimeSession = await reopened.RuntimeSession("smoke-runtime").ReadAsync(); var playerSettings = await reopened.PlayerSettings().ReadAsync(); var loadout = await reopened.LoadoutTemplate(loadoutKey).ReadAsync(); diff --git a/Aetheria.State.Verify/Program.cs b/Aetheria.State.Verify/Program.cs index 68e3aa6e0..c6084fbf7 100644 --- a/Aetheria.State.Verify/Program.cs +++ b/Aetheria.State.Verify/Program.cs @@ -10245,12 +10245,13 @@ static void RequireAuthoritySmokeUsesManagedPointers(string root) var authoritySmoke = File.ReadAllText(authoritySmokePath); var requiredSymbols = new[] { - "writer.StarbridgeScenario()", - "writer.StarbridgeSession()", - "ravenNode.VerseAuthorityPolicy()", - "starfireNode.VerseAuthorityPolicy()", - "node.VerseAuthorityPolicy()", - "node.LatestFrame().ReadAsync()", + "writer.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy)", + "writer.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest)", + "writer.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest)", + "ravenNode.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy)", + "starfireNode.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)", ".ReplaceAsync(policy)", ".ReplaceAsync(scenario)", ".ReplaceAsync(session)", @@ -10272,7 +10273,13 @@ static void RequireAuthoritySmokeUsesManagedPointers(string root) "PutStarbridgeSessionAsync(", "PutVerseAuthorityPolicyAsync(", "GetVerseAuthorityPolicyAsync(", - "GetDaemonFrameAsync(" + "GetDaemonFrameAsync(", + "writer.StarbridgeScenario()", + "writer.StarbridgeSession()", + "ravenNode.VerseAuthorityPolicy()", + "starfireNode.VerseAuthorityPolicy()", + "node.VerseAuthorityPolicy()", + "node.LatestFrame()" }; var survivingSymbols = forbiddenSymbols .Where(symbol => authoritySmoke.Contains(symbol, StringComparison.Ordinal)) @@ -10299,10 +10306,7 @@ static void RequireAetheriaStateNodeUsesManagedPointers(string root) "public CultMeshMutableStatePointer World()", "public CultMeshMutableStatePointer MigrationLedger()", "public CultMeshMutableStatePointer ItemDefinition(", - "public CultMeshMutableStatePointer LatestFrame()", - "public CultMeshMutableStatePointer LatestSoaView()", - "public CultMeshMutableStatePointer StarbridgeScenario()", - "public CultMeshMutableStatePointer DaemonGameSurface()", + "public CultMeshMutableStatePointer MutableDocument(CultRecordKey key)", "private CultMeshMutableStatePointer MutableDocumentPointer(CultRecordKey key)", "CultMesh.MutableStatePointer(" }; @@ -10356,7 +10360,20 @@ static void RequireAetheriaStateNodeUsesManagedPointers(string root) "public Task> PutEntitySnapshotAsync(", "public Task GetEntitySnapshotAsync(", "public Task> PutVerseHostSettingsAsync(", - "public Task GetVerseHostSettingsAsync(" + "public Task GetVerseHostSettingsAsync(", + "public CultMeshMutableStatePointer ProviderAdvertisement()", + "public CultMeshMutableStatePointer Health()", + "public CultMeshMutableStatePointer CommandBoundary()", + "public CultMeshMutableStatePointer VerseAuthorityPolicy()", + "public CultMeshMutableStatePointer LatestFrame()", + "public CultMeshMutableStatePointer LatestSoaView()", + "public CultMeshMutableStatePointer StarbridgeScenario()", + "public CultMeshMutableStatePointer StarbridgeSession()", + "public CultMeshMutableStatePointer StarbridgeSessionSummary()", + "public CultMeshMutableStatePointer DaemonGameSurface()", + "public CultMeshMutableStatePointer DaemonGameTuiSurface()", + "public CultMeshMutableStatePointer DaemonEditorSurface()", + "public CultMeshMutableStatePointer DaemonEditorTuiSurface()" }; var survivingSymbols = forbiddenSymbols .Where(symbol => stateNode.Contains(symbol, StringComparison.Ordinal)) @@ -10664,9 +10681,7 @@ static void RequireDaemonVersePublication(string root) "Database.WatchRecord(key)", "public CultMeshDocumentHandle RuntimeCatalog()", "AetheriaRuntimeCatalogStore.OpenReadOnly(StatePath)", - "public CultMeshMutableStatePointer LatestFrame()", - "public CultMeshMutableStatePointer LatestSoaView()", - "public CultMeshMutableStatePointer StarbridgeSessionSummary()", + "public CultMeshMutableStatePointer MutableDocument(CultRecordKey key)", "public CultMeshMutableStatePointer MigrationLedger()", "public CultMeshMutableStatePointer LegacyCatalogQuarantine()", "public CultMeshMutableStatePointer ItemDefinition(CultRecordKey key)", @@ -10674,7 +10689,20 @@ static void RequireDaemonVersePublication(string root) "public CultMeshMutableStatePointer NameFile(CultRecordKey key)", "private CultMeshMutableStatePointer MutableDocumentPointer(CultRecordKey key)", "CultMesh.MutableStatePointer(", - "AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest", + "AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest" + }; + var missingDaemonNodeSymbols = requiredDaemonNodeSymbols + .Where(symbol => !stateNode.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (missingDaemonNodeSymbols.Length > 0) + { + throw new InvalidOperationException( + "AetheriaStateNode no longer exposes daemon Verse API records ergonomically: " + + string.Join(", ", missingDaemonNodeSymbols)); + } + + var forbiddenDaemonNodeSymbols = new[] + { "public CultMeshMutableStatePointer ProviderAdvertisement()", "public CultMeshMutableStatePointer Health()", "public CultMeshMutableStatePointer CommandBoundary()", @@ -10689,14 +10717,14 @@ static void RequireDaemonVersePublication(string root) "public CultMeshMutableStatePointer DaemonEditorSurface()", "public CultMeshMutableStatePointer DaemonEditorTuiSurface()" }; - var missingDaemonNodeSymbols = requiredDaemonNodeSymbols - .Where(symbol => !stateNode.Contains(symbol, StringComparison.Ordinal)) + var survivingDaemonNodeSymbols = forbiddenDaemonNodeSymbols + .Where(symbol => stateNode.Contains(symbol, StringComparison.Ordinal)) .ToArray(); - if (missingDaemonNodeSymbols.Length > 0) + if (survivingDaemonNodeSymbols.Length > 0) { throw new InvalidOperationException( - "AetheriaStateNode no longer exposes daemon Verse API records ergonomically: " + - string.Join(", ", missingDaemonNodeSymbols)); + "AetheriaStateNode still exposes named daemon Verse record helpers instead of the generic typed document handle: " + + string.Join(", ", survivingDaemonNodeSymbols)); } if (!daemonSurfaceProjector.Contains("public static EveSurfaceState ToState(AetheriaRuntimeSurfaceDocument document)", StringComparison.Ordinal) || @@ -10874,30 +10902,27 @@ static void RequireDaemonVersePublication(string root) "ProjectReference Include=\"..\\Aetheria.State\\Aetheria.State.csproj\"", "AetheriaStateNode.OpenAsync(", "startServer: true", - "node.LatestFrame().ReadAsync()", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)", "Catalog = node.RuntimeCatalog().Latest()", "node.RuntimeCatalog().Latest());", - "node.VerseAuthorityPolicy().ReadAsync()", - "node.StarbridgeScenario().ReadAsync()", - "node.StarbridgeSession().ReadAsync()", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest)", "StarbridgeScenario = starbridgeScenario", "StarbridgeSession = starbridgeSession", "BuildPublications = buildPublications", "new AetheriaVerseDiscoveryHost(node)", "discoveryHost.Update(", "PublishDaemonApiDocumentsAsync(node, result)", - "node.LatestFrame()", - "node.LatestSoaView()", - "node.ProviderAdvertisement()", - "node.Health()", - "node.CommandBoundary()", - "node.DaemonGameSurface().ReadAsync()", - "node.DaemonGameTuiSurface().ReadAsync()", - "node.DaemonEditorSurface().ReadAsync()", - "node.DaemonEditorTuiSurface().ReadAsync()", - "node.StarbridgeSessionSummary()", - "node.DaemonGameSurface()", - "node.DaemonEditorTuiSurface()", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.StarbridgeSessionSummary)", ".ReplaceAsync(result.Frame)", ".ReplaceAsync(result.SoaView)", ".ReplaceAsync(result.Health)", @@ -10937,6 +10962,32 @@ static void RequireDaemonVersePublication(string root) string.Join(", ", missingDaemonHostSymbols)); } + var forbiddenNamedDaemonHostSymbols = new[] + { + "node.LatestFrame()", + "node.LatestSoaView()", + "node.ProviderAdvertisement()", + "node.Health()", + "node.CommandBoundary()", + "node.VerseAuthorityPolicy()", + "node.StarbridgeScenario()", + "node.StarbridgeSession()", + "node.StarbridgeSessionSummary()", + "node.DaemonGameSurface()", + "node.DaemonGameTuiSurface()", + "node.DaemonEditorSurface()", + "node.DaemonEditorTuiSurface()" + }; + var survivingNamedDaemonHostSymbols = forbiddenNamedDaemonHostSymbols + .Where(symbol => daemonHostSource.Contains(symbol, StringComparison.Ordinal)) + .ToArray(); + if (survivingNamedDaemonHostSymbols.Length > 0) + { + throw new InvalidOperationException( + "Aetheria.State.Daemon still uses named daemon Verse record helpers instead of generic typed document handles: " + + string.Join(", ", survivingNamedDaemonHostSymbols)); + } + var committedFactImportStart = daemonHostSource.IndexOf( "static async Task ImportRemoteCommittedFactsAsync", StringComparison.Ordinal); @@ -11306,22 +11357,22 @@ static void RequireDaemonVersePublication(string root) var requiredSmokeSymbols = new[] { - "node.ProviderAdvertisement().ReplaceAsync(daemonProvider)", - "node.Health().ReplaceAsync(daemonHealth)", - "node.CommandBoundary().ReplaceAsync(daemonCommandBoundary)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary)", "AetheriaClient.OpenAsync(", "daemonCommandClient.Control.SensorPing();", "eveCommandClient.Ui.InputSettingsAsync(", "AetheriaClient control submission did not appear as a typed daemon state record.", "AetheriaClient UI submission did not appear as a typed Eve state record.", - "node.LatestFrame().ReplaceAsync(daemonFrame)", - "node.DaemonGameSurface()", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)", + "node.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface)", ".ReplaceAsync(AetheriaRuntimeEveSurfaceStateProjector.ToState(daemonGameSurface))", - "reopened.ProviderAdvertisement().ReadAsync()", - "reopened.Health().ReadAsync()", - "reopened.CommandBoundary().ReadAsync()", - "reopened.LatestFrame().ReadAsync()", - "reopened.DaemonGameSurface().ReadAsync()", + "reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement)", + "reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonHealth)", + "reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary)", + "reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest)", + "reopened.MutableDocument(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface)", "DaemonGameSurfaceKey", "DaemonGameTuiSurfaceKey", "DaemonEditorSurfaceKey", @@ -11363,6 +11414,16 @@ static void RequireDaemonVersePublication(string root) "GetDaemonFrameAsync(", "PutDaemonGameSurfaceAsync(", "GetDaemonGameSurfaceAsync(", + "node.ProviderAdvertisement()", + "node.Health()", + "node.CommandBoundary()", + "node.LatestFrame()", + "node.DaemonGameSurface()", + "reopened.ProviderAdvertisement()", + "reopened.Health()", + "reopened.CommandBoundary()", + "reopened.LatestFrame()", + "reopened.DaemonGameSurface()", "PutRuntimeSessionAsync(", "GetRuntimeSessionAsync(", "PutLoadoutTemplateAsync(", diff --git a/Aetheria.State/AetheriaStateNode.cs b/Aetheria.State/AetheriaStateNode.cs index 395f88f12..ac03ee4af 100644 --- a/Aetheria.State/AetheriaStateNode.cs +++ b/Aetheria.State/AetheriaStateNode.cs @@ -89,6 +89,12 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria typed state node document")); } + public CultMeshMutableStatePointer MutableDocument(CultRecordKey key) + where TDocument : class + { + return MutableDocumentPointer(key); + } + public CultMeshDocumentHandle RuntimeCatalog() { return _runtimeCatalog ??= CultMesh.Document( @@ -110,80 +116,6 @@ public sealed class AetheriaStateNode : IAsyncDisposable, IDisposable routeHint: new CultMeshRouteHint(CultMeshLocalityKind.SharedMemory, "Aetheria typed catalog state")); } - public CultMeshMutableStatePointer ProviderAdvertisement() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.DaemonProviderAdvertisement); - } - - public CultMeshMutableStatePointer Health() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.DaemonHealth); - } - - public CultMeshMutableStatePointer CommandBoundary() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary); - } - - public CultMeshMutableStatePointer VerseAuthorityPolicy() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy); - } - - public CultMeshMutableStatePointer LatestFrame() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest); - } - - public CultMeshMutableStatePointer LatestSoaView() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.DaemonSoaViewLatest); - } - - public CultMeshMutableStatePointer StarbridgeScenario() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.StarbridgeScenarioLatest); - } - - public CultMeshMutableStatePointer StarbridgeSession() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.StarbridgeSessionLatest); - } - - public CultMeshMutableStatePointer StarbridgeSessionSummary() - { - return MutableDocumentPointer( - AetheriaRuntimeVerseRecordKeys.StarbridgeSessionSummary); - } - - public CultMeshMutableStatePointer DaemonGameSurface() - { - return MutableDocumentPointer(AetheriaRuntimeVerseRecordKeys.DaemonGameSurface); - } - - public CultMeshMutableStatePointer DaemonGameTuiSurface() - { - return MutableDocumentPointer(AetheriaRuntimeVerseRecordKeys.DaemonGameTuiSurface); - } - - public CultMeshMutableStatePointer DaemonEditorSurface() - { - return MutableDocumentPointer(AetheriaRuntimeVerseRecordKeys.DaemonEditorSurface); - } - - public CultMeshMutableStatePointer DaemonEditorTuiSurface() - { - return MutableDocumentPointer(AetheriaRuntimeVerseRecordKeys.DaemonEditorTuiSurface); - } - public CultMeshMutableStatePointer CatalogSurface() { return MutableDocumentPointer(new CultRecordKey(AetheriaCatalogSurfaceProjector.SurfaceKey));