Delete daemon latest sidecar stores
This commit is contained in:
parent
382105458e
commit
10df4d2152
9 changed files with 51 additions and 510 deletions
|
|
@ -240,7 +240,7 @@ internal sealed class AuthoritySmokeChecks
|
|||
FixedDeltaSeconds = 0.02,
|
||||
ObservedCommands = Array.Empty<AetheriaRuntimeDaemonCommandDocument>(),
|
||||
PreRejectedCommandIds = [command.CommandId],
|
||||
PublishWitnesses = false
|
||||
BuildPublications = false
|
||||
});
|
||||
|
||||
Require(result.Frame.RejectedCommandIds.Contains(command.CommandId), "pre-rejected command should enter frame rejection receipts");
|
||||
|
|
@ -807,7 +807,7 @@ internal sealed class AuthoritySmokeChecks
|
|||
policy,
|
||||
[ravenByRaven, hostileByRaven]).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(ravenStatePath, "raven-local", rtsPort: 41076).ConfigureAwait(false);
|
||||
var ravenFrame = ReadPublishedFrame(ravenStatePath);
|
||||
var ravenFrame = await ReadPublishedFrameAsync(ravenStatePath, "raven-local").ConfigureAwait(false);
|
||||
|
||||
Require(ravenFrame.AppliedCommandIds.Contains(ravenByRaven.CommandId), "raven daemon should apply Raven-authored Raven movement");
|
||||
Require(ravenFrame.RejectedCommandIds.Contains(hostileByRaven.CommandId), "raven daemon should reject Raven-authored hostile movement");
|
||||
|
|
@ -823,7 +823,7 @@ internal sealed class AuthoritySmokeChecks
|
|||
policy,
|
||||
[ravenByStarfire, hostileByStarfire]).ConfigureAwait(false);
|
||||
await RunDaemonOnceAsync(starfireStatePath, "starfire-local", rtsPort: 41077).ConfigureAwait(false);
|
||||
var starfireFrame = ReadPublishedFrame(starfireStatePath);
|
||||
var starfireFrame = await ReadPublishedFrameAsync(starfireStatePath, "starfire-local").ConfigureAwait(false);
|
||||
|
||||
Require(starfireFrame.RejectedCommandIds.Contains(ravenByStarfire.CommandId), "starfire daemon should reject Starfire-authored Raven movement");
|
||||
Require(starfireFrame.AppliedCommandIds.Contains(hostileByStarfire.CommandId), "starfire daemon should apply Starfire-authored hostile movement");
|
||||
|
|
@ -1124,15 +1124,16 @@ internal sealed class AuthoritySmokeChecks
|
|||
await node.SubmitDaemonCommandAsync(command).ConfigureAwait(false);
|
||||
await node.FlushAsync().ConfigureAwait(false);
|
||||
|
||||
AetheriaRuntimeDaemonFrameStore.PublishFrame(
|
||||
statePath,
|
||||
AetheriaRuntimeDaemonFrameDocument.Create(
|
||||
await node.LatestFrame()
|
||||
.ReplaceAsync(AetheriaRuntimeDaemonFrameDocument.Create(
|
||||
InitialCoopRun(),
|
||||
runtimeId,
|
||||
"authority-smoke",
|
||||
frameId: -1,
|
||||
simulationTimeSeconds: 0,
|
||||
fixedDeltaSeconds: 0.02));
|
||||
fixedDeltaSeconds: 0.02))
|
||||
.ConfigureAwait(false);
|
||||
await node.FlushAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task RunDaemonOnceAsync(
|
||||
|
|
@ -1415,7 +1416,8 @@ internal sealed class AuthoritySmokeChecks
|
|||
{
|
||||
try
|
||||
{
|
||||
if (TryReadPublishedFrame(statePath, out var frame))
|
||||
var frame = await TryReadPublishedFrameAsync(statePath, runtimeId).ConfigureAwait(false);
|
||||
if (frame != null)
|
||||
{
|
||||
lastFrame = frame;
|
||||
if (isReady(frame))
|
||||
|
|
@ -1437,16 +1439,27 @@ internal sealed class AuthoritySmokeChecks
|
|||
(lastError == null ? "" : $" Last error: {lastError.GetType().Name}: {lastError.Message}"));
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeDaemonFrameDocument ReadPublishedFrame(string statePath)
|
||||
private static async Task<AetheriaRuntimeDaemonFrameDocument> ReadPublishedFrameAsync(
|
||||
string statePath,
|
||||
string runtimeId)
|
||||
{
|
||||
return AetheriaRuntimeDaemonFrameStore.ReadPublishedFrame(statePath);
|
||||
var frame = await TryReadPublishedFrameAsync(statePath, runtimeId).ConfigureAwait(false);
|
||||
if (frame == null)
|
||||
throw new InvalidOperationException($"No managed latest daemon frame is published at {statePath}.");
|
||||
|
||||
return frame;
|
||||
}
|
||||
|
||||
private static bool TryReadPublishedFrame(
|
||||
private static async Task<AetheriaRuntimeDaemonFrameDocument?> TryReadPublishedFrameAsync(
|
||||
string statePath,
|
||||
out AetheriaRuntimeDaemonFrameDocument frame)
|
||||
string runtimeId)
|
||||
{
|
||||
return AetheriaRuntimeDaemonFrameStore.TryReadPublishedFrame(statePath, out frame);
|
||||
await using var node = await AetheriaStateNode.OpenAsync(
|
||||
statePath,
|
||||
runtimeId,
|
||||
startServer: false,
|
||||
enableDurableShardLogs: false).ConfigureAwait(false);
|
||||
return await node.LatestFrame().ReadAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static string ProcessDiagnostics(IReadOnlyList<Process> childProcesses)
|
||||
|
|
@ -1518,7 +1531,7 @@ internal sealed class AuthoritySmokeChecks
|
|||
FixedDeltaSeconds = 0.02,
|
||||
ObservedCommands = authorizedCommands,
|
||||
PreRejectedCommandIds = rejectedIds,
|
||||
PublishWitnesses = false
|
||||
BuildPublications = false
|
||||
});
|
||||
|
||||
return result.Frame;
|
||||
|
|
|
|||
|
|
@ -1311,16 +1311,12 @@ static async Task EnsureVerseAuthorityPolicyAsync(
|
|||
{
|
||||
var existing = await node.VerseAuthorityPolicy().ReadAsync().ConfigureAwait(false);
|
||||
if (existing != null && string.Equals(existing.Schema, AetheriaRuntimeVerseAuthoritySchemas.Policy, StringComparison.Ordinal))
|
||||
{
|
||||
AetheriaRuntimeDaemonPublicationStore.PublishVerseAuthorityPolicy(node.StatePath, existing);
|
||||
return;
|
||||
}
|
||||
|
||||
var policy = AetheriaRuntimeVerseAuthorityPolicyDocument.TrustedCoop(options.VerseId, options.DaemonId);
|
||||
await node.VerseAuthorityPolicy()
|
||||
.ReplaceAsync(policy)
|
||||
.ConfigureAwait(false);
|
||||
AetheriaRuntimeDaemonPublicationStore.PublishVerseAuthorityPolicy(node.StatePath, policy);
|
||||
}
|
||||
|
||||
static async Task<AetheriaRuntimeRunCheckpointCommit?> ReadRuntimeRunCheckpointAsync(AetheriaStateNode node)
|
||||
|
|
|
|||
|
|
@ -8672,8 +8672,6 @@ static void RequireDaemonVersePublication(string root)
|
|||
{
|
||||
var daemonDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonDocuments.cs");
|
||||
var daemonTickRunnerPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonTickRunner.cs");
|
||||
var daemonFrameStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonFrameStore.cs");
|
||||
var daemonPublicationStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonPublicationStore.cs");
|
||||
var daemonSoaDocumentsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonSoaDocuments.cs");
|
||||
var daemonSoaFramePublisherPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonSoaFramePublisher.cs");
|
||||
var daemonStateRefsPath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonStateRefs.cs");
|
||||
|
|
@ -8697,8 +8695,6 @@ static void RequireDaemonVersePublication(string root)
|
|||
{
|
||||
daemonDocumentsPath,
|
||||
daemonTickRunnerPath,
|
||||
daemonFrameStorePath,
|
||||
daemonPublicationStorePath,
|
||||
daemonSoaDocumentsPath,
|
||||
daemonSoaFramePublisherPath,
|
||||
daemonStateRefsPath,
|
||||
|
|
@ -8731,8 +8727,6 @@ static void RequireDaemonVersePublication(string root)
|
|||
|
||||
var daemonDocuments = File.ReadAllText(daemonDocumentsPath);
|
||||
var daemonTickRunner = File.ReadAllText(daemonTickRunnerPath);
|
||||
var daemonFrameStore = File.ReadAllText(daemonFrameStorePath);
|
||||
var daemonPublicationStore = File.ReadAllText(daemonPublicationStorePath);
|
||||
var daemonSoaDocuments = File.ReadAllText(daemonSoaDocumentsPath);
|
||||
var daemonSoaFramePublisher = File.ReadAllText(daemonSoaFramePublisherPath);
|
||||
var daemonStateRefs = File.ReadAllText(daemonStateRefsPath);
|
||||
|
|
@ -8869,12 +8863,18 @@ static void RequireDaemonVersePublication(string root)
|
|||
string.Join(", ", missingBoundarySymbols));
|
||||
}
|
||||
|
||||
var requiredStoreSymbols = new[]
|
||||
var forbiddenPublicationStoreSymbols = new[]
|
||||
{
|
||||
"WriteDaemonFrame(",
|
||||
"ReadDaemonFrame(",
|
||||
"WriteDaemonSoaView(",
|
||||
"ReadDaemonSoaView(",
|
||||
"WriteDaemonProviderAdvertisement(",
|
||||
"ReadDaemonProviderAdvertisement(",
|
||||
"WriteDaemonHealth(",
|
||||
"ReadDaemonHealth(",
|
||||
"WriteVerseAuthorityPolicy(",
|
||||
"ReadVerseAuthorityPolicy(",
|
||||
"WriteDaemonCommandBoundary(",
|
||||
"ReadDaemonCommandBoundary(",
|
||||
"WriteStarbridgeSessionSummary(",
|
||||
|
|
@ -8883,28 +8883,6 @@ static void RequireDaemonVersePublication(string root)
|
|||
"ReadDaemonGameSurface(",
|
||||
"WriteDaemonEditorSurface(",
|
||||
"ReadDaemonEditorSurface(",
|
||||
"PublishProviderAdvertisement(",
|
||||
"PublishHealth(",
|
||||
"PublishCommandBoundary(",
|
||||
"PublishStarbridgeSessionSummary(",
|
||||
"PublishGameSurface(",
|
||||
"PublishGameTuiSurface(",
|
||||
"PublishEditorSurface(",
|
||||
"PublishEditorTuiSurface("
|
||||
};
|
||||
var storeSource = documentStore + "\n" + daemonPublicationStore;
|
||||
var missingStoreSymbols = requiredStoreSymbols
|
||||
.Where(symbol => !storeSource.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (missingStoreSymbols.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon Verse publication store is incomplete: " +
|
||||
string.Join(", ", missingStoreSymbols));
|
||||
}
|
||||
|
||||
var forbiddenPublicationStoreSymbols = new[]
|
||||
{
|
||||
"TryReadProviderAdvertisement(",
|
||||
"TryReadHealth(",
|
||||
"TryReadVerseAuthorityPolicy(",
|
||||
|
|
@ -8917,15 +8895,29 @@ static void RequireDaemonVersePublication(string root)
|
|||
"TryReadEditorTuiSurface("
|
||||
};
|
||||
var publicationStoreReaderHits = forbiddenPublicationStoreSymbols
|
||||
.Where(symbol => daemonPublicationStore.Contains(symbol, StringComparison.Ordinal))
|
||||
.Where(symbol => documentStore.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
if (publicationStoreReaderHits.Length > 0)
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon publication store still exposes file-backed readers instead of passing typed tick-result documents: " +
|
||||
"Daemon latest publication still exposes file-backed sidecar helpers instead of managed typed documents: " +
|
||||
string.Join(", ", publicationStoreReaderHits));
|
||||
}
|
||||
|
||||
var daemonFrameStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonFrameStore.cs");
|
||||
if (File.Exists(daemonFrameStorePath))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon latest frames must stay on managed CultMesh pointers; delete AetheriaRuntimeDaemonFrameStore.cs instead of reviving sidecar path writes.");
|
||||
}
|
||||
|
||||
var daemonPublicationStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonPublicationStore.cs");
|
||||
if (File.Exists(daemonPublicationStorePath))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon latest publications must stay on managed CultMesh pointers; delete AetheriaRuntimeDaemonPublicationStore.cs instead of reviving sidecar path writes.");
|
||||
}
|
||||
|
||||
var daemonSoaViewStorePath = Path.Combine(root, "Packages", "org.gamecult.aetheria.state", "Runtime", "AetheriaRuntimeDaemonSoaViewStore.cs");
|
||||
if (File.Exists(daemonSoaViewStorePath))
|
||||
{
|
||||
|
|
@ -8933,13 +8925,6 @@ static void RequireDaemonVersePublication(string root)
|
|||
"Daemon SoA latest-view publication must stay on managed CultMesh pointers; delete AetheriaRuntimeDaemonSoaViewStore.cs instead of reviving sidecar path writes.");
|
||||
}
|
||||
|
||||
if (daemonFrameStore.Contains("TryReadFrame(", StringComparison.Ordinal) ||
|
||||
daemonFrameStore.Contains("ReadFrame(", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon frame store still exposes file-backed readers; use tick-result documents or AetheriaClient managed observation.");
|
||||
}
|
||||
|
||||
var requiredDaemonRegistrySymbols = new[]
|
||||
{
|
||||
"CultMesh.CreateCultCacheDocumentRegistry(DocumentTypes)",
|
||||
|
|
@ -9011,8 +8996,7 @@ static void RequireDaemonVersePublication(string root)
|
|||
throw new InvalidOperationException("Daemon Eve surface projector no longer lowers daemon surfaces into registered Eve surface state.");
|
||||
}
|
||||
|
||||
if (!daemonPublicationStore.Contains("GetCommandBoundaryPath(", StringComparison.Ordinal) ||
|
||||
!daemonDocuments.Contains("AetheriaRuntimeDaemonCommandKinds", StringComparison.Ordinal))
|
||||
if (!daemonDocuments.Contains("AetheriaRuntimeDaemonCommandKinds", StringComparison.Ordinal))
|
||||
{
|
||||
throw new InvalidOperationException(
|
||||
"Daemon command boundary no longer exposes typed daemon command metadata.");
|
||||
|
|
@ -9027,7 +9011,7 @@ static void RequireDaemonVersePublication(string root)
|
|||
".daemon.pending",
|
||||
"ReadPending("
|
||||
};
|
||||
var daemonQueueSource = daemonDocuments + "\n" + daemonTickRunner + "\n" + daemonPublicationStore + "\n" + tests;
|
||||
var daemonQueueSource = daemonDocuments + "\n" + daemonTickRunner + "\n" + tests;
|
||||
var survivingDaemonQueueSymbols = forbiddenDaemonQueueSymbols
|
||||
.Where(symbol => daemonQueueSource.Contains(symbol, StringComparison.Ordinal))
|
||||
.ToArray();
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@
|
|||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeDaemonStateRefs.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeMainMenuSurfaceBuilder.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeRenderSplatDocuments.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeDaemonPublicationStore.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeInputSettingsSurfaceBuilder.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeItemCategories.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeSettingsDocuments.cs" />
|
||||
|
|
@ -120,7 +119,6 @@
|
|||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeLoadoutTemplateCommands.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeVerseReplicaBridge.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeDaemonOperationClient.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeDaemonFrameStore.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeDaemonOperations.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeCommittedFactImporter.cs" />
|
||||
<Compile Include="Packages\org.gamecult.aetheria.state\Runtime\AetheriaRuntimeInputSettingsCommands.cs" />
|
||||
|
|
|
|||
|
|
@ -47,205 +47,6 @@ namespace GameCult.Aetheria.State.Verse
|
|||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.Command));
|
||||
}
|
||||
|
||||
public static void WriteDaemonFrame(string path, AetheriaRuntimeDaemonFrameDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.daemon_frame.{document.SessionId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.Frame,
|
||||
"gamecult.aetheria.daemon_frame",
|
||||
"gamecult.aetheria.daemon_frame.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonFrameDocument ReadDaemonFrame(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeDaemonFrameDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.Frame));
|
||||
}
|
||||
|
||||
public static void WriteDaemonSoaView(string path, AetheriaRuntimeDaemonSoaViewDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.daemon_soa_view.{document.SessionId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.SoaView,
|
||||
"gamecult.aetheria.daemon_soa_view",
|
||||
"gamecult.aetheria.daemon_soa_view.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonSoaViewDocument ReadDaemonSoaView(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeDaemonSoaViewDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.SoaView));
|
||||
}
|
||||
|
||||
public static void WriteAssetManifest(string path, AetheriaRuntimeAssetManifestDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.asset_manifest.{document.RunId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.AssetManifest,
|
||||
"gamecult.aetheria.asset_manifest",
|
||||
"gamecult.aetheria.asset_manifest.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeAssetManifestDocument ReadAssetManifest(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeAssetManifestDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.AssetManifest));
|
||||
}
|
||||
|
||||
public static void WriteDaemonProviderAdvertisement(
|
||||
string path,
|
||||
AetheriaRuntimeDaemonProviderAdvertisementDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.daemon_provider.{document.DaemonId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.ProviderAdvertisement,
|
||||
"gamecult.aetheria.daemon_provider_advertisement",
|
||||
"gamecult.aetheria.daemon_provider_advertisement.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonProviderAdvertisementDocument ReadDaemonProviderAdvertisement(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeDaemonProviderAdvertisementDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.ProviderAdvertisement));
|
||||
}
|
||||
|
||||
public static void WriteDaemonHealth(string path, AetheriaRuntimeDaemonHealthDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.daemon_health.{document.DaemonId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.Health,
|
||||
"gamecult.aetheria.daemon_health",
|
||||
"gamecult.aetheria.daemon_health.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonHealthDocument ReadDaemonHealth(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeDaemonHealthDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.Health));
|
||||
}
|
||||
|
||||
public static void WriteVerseAuthorityPolicy(
|
||||
string path,
|
||||
AetheriaRuntimeVerseAuthorityPolicyDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
AetheriaRuntimeVerseAuthorityPolicyDocument.DocumentKey,
|
||||
AetheriaRuntimeVerseAuthoritySchemas.Policy,
|
||||
"gamecult.aetheria.verse_authority_policy",
|
||||
"gamecult.aetheria.verse_authority_policy.v1",
|
||||
document.UpdatedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeVerseAuthorityPolicyDocument ReadVerseAuthorityPolicy(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeVerseAuthorityPolicyDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeVerseAuthoritySchemas.Policy));
|
||||
}
|
||||
|
||||
public static void WriteDaemonCommandBoundary(
|
||||
string path,
|
||||
AetheriaRuntimeDaemonCommandBoundaryDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.daemon_command_boundary.{document.BoundaryId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.CommandBoundary,
|
||||
"gamecult.aetheria.daemon_command_boundary",
|
||||
"gamecult.aetheria.daemon_command_boundary.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonCommandBoundaryDocument ReadDaemonCommandBoundary(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeDaemonCommandBoundaryDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.CommandBoundary));
|
||||
}
|
||||
|
||||
public static void WriteStarbridgeSessionSummary(
|
||||
string path,
|
||||
AetheriaRuntimeStarbridgeSessionSummaryDocument document)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:gamecult.aetheria.starbridge_session_summary.{document.SessionId}.v1",
|
||||
AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary,
|
||||
"gamecult.aetheria.starbridge_session_summary",
|
||||
"gamecult.aetheria.starbridge_session_summary.v1",
|
||||
document.PublishedAtUtc,
|
||||
MessagePackSerializer.Serialize(document));
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeStarbridgeSessionSummaryDocument ReadStarbridgeSessionSummary(string path)
|
||||
{
|
||||
return MessagePackSerializer.Deserialize<AetheriaRuntimeStarbridgeSessionSummaryDocument>(
|
||||
CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary));
|
||||
}
|
||||
|
||||
public static void WriteDaemonGameSurface(string path, AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
WriteDaemonSurface(
|
||||
path,
|
||||
document,
|
||||
AetheriaRuntimeDaemonSchemas.GameSurface,
|
||||
"gamecult.aetheria.daemon_game_surface",
|
||||
"gamecult.aetheria.daemon_game_surface.v1");
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument ReadDaemonGameSurface(string path)
|
||||
{
|
||||
return ReadRuntimeSurfaceDocument(CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.GameSurface));
|
||||
}
|
||||
|
||||
public static void WriteDaemonEditorSurface(string path, AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
WriteDaemonSurface(
|
||||
path,
|
||||
document,
|
||||
AetheriaRuntimeDaemonSchemas.EditorSurface,
|
||||
"gamecult.aetheria.daemon_editor_surface",
|
||||
"gamecult.aetheria.daemon_editor_surface.v1");
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeSurfaceDocument ReadDaemonEditorSurface(string path)
|
||||
{
|
||||
return ReadRuntimeSurfaceDocument(CultMesh.ReadSingleFileDocumentPayload(path, AetheriaRuntimeDaemonSchemas.EditorSurface));
|
||||
}
|
||||
|
||||
private static void WriteDaemonSurface(
|
||||
string path,
|
||||
AetheriaRuntimeSurfaceDocument document,
|
||||
string schema,
|
||||
string schemaName,
|
||||
string schemaVersion)
|
||||
{
|
||||
WriteDocument(
|
||||
path,
|
||||
$"latest:{schemaName}.{document.Surface.Id}.v1",
|
||||
schema,
|
||||
schemaName,
|
||||
schemaVersion,
|
||||
document.UpdatedAtUtc,
|
||||
WriteRuntimeSurfaceDocument(document));
|
||||
}
|
||||
|
||||
private static void WriteDocument(
|
||||
string path,
|
||||
string key,
|
||||
|
|
|
|||
|
|
@ -1,52 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace GameCult.Aetheria.State.Verse
|
||||
{
|
||||
public static class AetheriaRuntimeDaemonFrameStore
|
||||
{
|
||||
public static string GetFramePath(string stateFilePath)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(stateFilePath))
|
||||
throw new ArgumentException("State file path must be non-empty.", nameof(stateFilePath));
|
||||
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonFramePath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string PublishFrame(string stateFilePath, AetheriaRuntimeDaemonFrameDocument frame)
|
||||
{
|
||||
if (frame == null) throw new ArgumentNullException(nameof(frame));
|
||||
|
||||
frame.Schema = AetheriaRuntimeDaemonSchemas.Frame;
|
||||
if (string.IsNullOrWhiteSpace(frame.PublishedAtUtc))
|
||||
frame.PublishedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var framePath = GetFramePath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(framePath) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonFrame(framePath, frame);
|
||||
return framePath;
|
||||
}
|
||||
|
||||
public static AetheriaRuntimeDaemonFrameDocument ReadPublishedFrame(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeCultCacheDocumentStore.ReadDaemonFrame(GetFramePath(stateFilePath));
|
||||
}
|
||||
|
||||
public static bool TryReadPublishedFrame(
|
||||
string stateFilePath,
|
||||
out AetheriaRuntimeDaemonFrameDocument frame)
|
||||
{
|
||||
var framePath = GetFramePath(stateFilePath);
|
||||
if (!File.Exists(framePath))
|
||||
{
|
||||
frame = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
frame = AetheriaRuntimeCultCacheDocumentStore.ReadDaemonFrame(framePath);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 2da25246f5a801f4db2d26f4100b70ad
|
||||
|
|
@ -1,195 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace GameCult.Aetheria.State.Verse
|
||||
{
|
||||
public static class AetheriaRuntimeDaemonPublicationStore
|
||||
{
|
||||
public static string GetProviderAdvertisementPath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonProviderPath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetHealthPath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonHealthPath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetVerseAuthorityPolicyPath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetVerseAuthorityPolicyPath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetCommandBoundaryPath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonCommandBoundaryPath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetAssetManifestPath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonAssetManifestPath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetStarbridgeSessionSummaryPath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonStarbridgeSessionSummaryPath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetGameSurfacePath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonGameSurfacePath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetGameTuiSurfacePath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonGameTuiSurfacePath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetEditorSurfacePath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonEditorSurfacePath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string GetEditorTuiSurfacePath(string stateFilePath)
|
||||
{
|
||||
return AetheriaRuntimeStateBoundary.GetDaemonEditorTuiSurfacePath(stateFilePath);
|
||||
}
|
||||
|
||||
public static string PublishProviderAdvertisement(
|
||||
string stateFilePath,
|
||||
AetheriaRuntimeDaemonProviderAdvertisementDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
document.Schema = AetheriaRuntimeDaemonSchemas.ProviderAdvertisement;
|
||||
if (string.IsNullOrWhiteSpace(document.PublishedAtUtc))
|
||||
document.PublishedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var path = GetProviderAdvertisementPath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonProviderAdvertisement(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishHealth(string stateFilePath, AetheriaRuntimeDaemonHealthDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
document.Schema = AetheriaRuntimeDaemonSchemas.Health;
|
||||
if (string.IsNullOrWhiteSpace(document.PublishedAtUtc))
|
||||
document.PublishedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var path = GetHealthPath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonHealth(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishVerseAuthorityPolicy(
|
||||
string stateFilePath,
|
||||
AetheriaRuntimeVerseAuthorityPolicyDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
document.Schema = AetheriaRuntimeVerseAuthoritySchemas.Policy;
|
||||
if (string.IsNullOrWhiteSpace(document.UpdatedAtUtc))
|
||||
document.UpdatedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var path = GetVerseAuthorityPolicyPath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteVerseAuthorityPolicy(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishCommandBoundary(
|
||||
string stateFilePath,
|
||||
AetheriaRuntimeDaemonCommandBoundaryDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
document.Schema = AetheriaRuntimeDaemonSchemas.CommandBoundary;
|
||||
if (string.IsNullOrWhiteSpace(document.PublishedAtUtc))
|
||||
document.PublishedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var path = GetCommandBoundaryPath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonCommandBoundary(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishAssetManifest(
|
||||
string stateFilePath,
|
||||
AetheriaRuntimeAssetManifestDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
document.Schema = AetheriaRuntimeDaemonSchemas.AssetManifest;
|
||||
if (string.IsNullOrWhiteSpace(document.PublishedAtUtc))
|
||||
document.PublishedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var path = GetAssetManifestPath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteAssetManifest(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishStarbridgeSessionSummary(
|
||||
string stateFilePath,
|
||||
AetheriaRuntimeStarbridgeSessionSummaryDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
document.Schema = AetheriaRuntimeDaemonSchemas.StarbridgeSessionSummary;
|
||||
if (string.IsNullOrWhiteSpace(document.PublishedAtUtc))
|
||||
document.PublishedAtUtc = DateTime.UtcNow.ToString("O");
|
||||
|
||||
var path = GetStarbridgeSessionSummaryPath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteStarbridgeSessionSummary(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishGameSurface(string stateFilePath, AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
var path = GetGameSurfacePath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonGameSurface(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishGameTuiSurface(string stateFilePath, AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
var path = GetGameTuiSurfacePath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonGameSurface(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishEditorSurface(string stateFilePath, AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
var path = GetEditorSurfacePath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonEditorSurface(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
public static string PublishEditorTuiSurface(string stateFilePath, AetheriaRuntimeSurfaceDocument document)
|
||||
{
|
||||
if (document == null) throw new ArgumentNullException(nameof(document));
|
||||
|
||||
var path = GetEditorTuiSurfacePath(stateFilePath);
|
||||
Directory.CreateDirectory(Path.GetDirectoryName(path) ?? ".");
|
||||
AetheriaRuntimeCultCacheDocumentStore.WriteDaemonEditorSurface(path, document);
|
||||
return path;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 893394e396737fe48a79566dbbfd5272
|
||||
Loading…
Reference in a new issue