Route authority status through daemon document
This commit is contained in:
parent
dea31eed1b
commit
8f2ed3326b
5 changed files with 79 additions and 7 deletions
|
|
@ -9270,10 +9270,16 @@ static void RequireAetheriaRuntimeVerseClientContract(string root)
|
|||
"WatchLatestSoaViews()",
|
||||
"WatchRecord<AetheriaRuntimeDaemonFrameDocument>",
|
||||
"WatchRecord<AetheriaRuntimeDaemonSoaViewDocument>",
|
||||
"WatchVerseAuthorityPolicies()",
|
||||
"CultMeshMutableStatePointer<AetheriaRuntimeDaemonFrameDocument>",
|
||||
"CultMeshMutableStatePointer<AetheriaRuntimeVerseAuthorityPolicyDocument>",
|
||||
"CultMesh.MutableStatePointer(",
|
||||
"CultMesh.CreateCultCacheDocumentRegistry(RuntimeDocumentTypes)",
|
||||
"CultMesh.CreateCultNetDocumentRegistry(RuntimeDocumentTypes, registry)",
|
||||
"typeof(AetheriaRuntimeVerseAuthorityPolicyDocument)",
|
||||
"AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy",
|
||||
"Document<AetheriaRuntimeVerseAuthorityPolicyDocument>(",
|
||||
"GetVerseAuthorityPolicyAsync()",
|
||||
"typeof(EveSurfaceState)",
|
||||
"GetDaemonGameTuiSurfaceAsync()",
|
||||
"GetDaemonEditorTuiSurfaceAsync()",
|
||||
|
|
@ -9291,6 +9297,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root)
|
|||
"state.Daemon.LatestSoaView.LatestAsync()",
|
||||
"state.Daemon.Health.LatestAsync()",
|
||||
"state.Daemon.CommandBoundary.LatestAsync()",
|
||||
"Aetheria().Daemon.AuthorityPolicy.LatestAsync()",
|
||||
"Aetheria().Daemon.ProviderAdvertisement.LatestAsync()",
|
||||
"Aetheria().Daemon.Health.LatestAsync()",
|
||||
"Aetheria().Daemon.CommandBoundary.LatestAsync()",
|
||||
|
|
@ -9367,6 +9374,7 @@ static void RequireAetheriaRuntimeVerseClientContract(string root)
|
|||
"return Database.GetAsync<AetheriaRuntimeDaemonProviderAdvertisementDocument>",
|
||||
"return Database.GetAsync<AetheriaRuntimeDaemonHealthDocument>",
|
||||
"return Database.GetAsync<AetheriaRuntimeDaemonCommandBoundaryDocument>",
|
||||
"return Database.GetAsync<AetheriaRuntimeVerseAuthorityPolicyDocument>",
|
||||
"return Database.GetAsync<AetheriaRuntimeDaemonFrameDocument>",
|
||||
"return Database.GetAsync<AetheriaRuntimeDaemonSoaViewDocument>",
|
||||
"return Database.GetAsync<AetheriaRuntimeStarbridgeScenarioDocument>",
|
||||
|
|
@ -13110,6 +13118,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"CultMeshDocumentHandle<AetheriaRuntimeDaemonProviderAdvertisementDocument> ProviderAdvertisement",
|
||||
"CultMeshDocumentHandle<AetheriaRuntimeDaemonHealthDocument> Health",
|
||||
"CultMeshDocumentHandle<AetheriaRuntimeDaemonCommandBoundaryDocument> CommandBoundary",
|
||||
"CultMeshDocumentHandle<AetheriaRuntimeVerseAuthorityPolicyDocument> AuthorityPolicy",
|
||||
"CultMeshDocumentHandle<AetheriaRuntimeDaemonFrameDocument> LatestFrame",
|
||||
"CultMeshDocumentHandle<AetheriaRuntimeDaemonSoaViewDocument> LatestSoaView",
|
||||
"CultMeshDocumentHandle<global::Aetheria.State.Documents.EveSurfaceState> GameSurface",
|
||||
|
|
@ -13132,6 +13141,7 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"State.Daemon.LatestFrame.LatestAsync()",
|
||||
"State.Daemon.LatestSoaView.LatestAsync()",
|
||||
"State.Daemon.Health.LatestAsync()",
|
||||
"State.Daemon.AuthorityPolicy.LatestAsync()",
|
||||
"State.Daemon.GameSurface.LatestAsync()",
|
||||
"State.Daemon.GameTuiSurface.LatestAsync()",
|
||||
"State.Daemon.EditorSurface.LatestAsync()",
|
||||
|
|
@ -13154,7 +13164,9 @@ static void RequireRuntimeStateReaderOwnsUnityStateAcquisition(string root)
|
|||
"return _verse.GetObservedDaemonStateAsync();",
|
||||
"return _verse.GetLatestAuthoritativeRunFrameAsync();",
|
||||
"return _verse.GetHealthAsync();",
|
||||
"return _verse.GetVerseAuthorityPolicyAsync();",
|
||||
"return _verse.GetLatestSoaViewAsync();",
|
||||
"AetheriaRuntimeDaemonPublicationStore.TryReadVerseAuthorityPolicy",
|
||||
"return _verse.GetDaemonGameSurfaceAsync();",
|
||||
"return _verse.GetDaemonGameTuiSurfaceAsync();",
|
||||
"return _verse.GetDaemonEditorSurfaceAsync();",
|
||||
|
|
|
|||
|
|
@ -159,7 +159,11 @@ public class DaemonRuntimeDocumentTests
|
|||
7,
|
||||
1.25,
|
||||
0.02);
|
||||
var authorityPolicy = AetheriaRuntimeVerseAuthorityPolicyDocument.TrustedCoop(
|
||||
"aetheria.local",
|
||||
"daemon");
|
||||
PublishLatestFrameThroughVerseClient(statePath, frame);
|
||||
PublishVerseAuthorityPolicyThroughVerseClient(statePath, authorityPolicy);
|
||||
|
||||
using var client = AetheriaClient
|
||||
.OpenAsync(statePath, "unity-test", pullOnOpen: true)
|
||||
|
|
@ -221,6 +225,7 @@ public class DaemonRuntimeDocumentTests
|
|||
var legacyGameTuiSurface = client.DaemonGameTuiSurfaceAsync().GetAwaiter().GetResult();
|
||||
var legacyEditorSurface = client.DaemonEditorSurfaceAsync().GetAwaiter().GetResult();
|
||||
var legacyEditorTuiSurface = client.DaemonEditorTuiSurfaceAsync().GetAwaiter().GetResult();
|
||||
var legacyAuthorityStatus = client.AuthorityStatusAsync().GetAwaiter().GetResult();
|
||||
var dockingState = client.Aetheria()
|
||||
.DockingState
|
||||
.LatestAsync()
|
||||
|
|
@ -241,6 +246,12 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.AreSame(
|
||||
client.State.Daemon.CommandBoundary,
|
||||
client.Document<AetheriaRuntimeDaemonCommandBoundaryDocument>());
|
||||
Assert.AreSame(
|
||||
client.State.Daemon.AuthorityPolicy,
|
||||
client.Document<AetheriaRuntimeVerseAuthorityPolicyDocument>());
|
||||
Assert.AreSame(
|
||||
client.State.Daemon.AuthorityPolicy,
|
||||
client.State.DocumentBySchema(AetheriaRuntimeVerseAuthoritySchemas.Policy));
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.SurfaceId, client.State.Daemon.GameSurface.DocumentId);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, client.State.Daemon.GameTuiSurface.DocumentId);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, client.State.Daemon.EditorSurface.DocumentId);
|
||||
|
|
@ -272,6 +283,9 @@ public class DaemonRuntimeDocumentTests
|
|||
Assert.AreEqual(AetheriaRuntimeDaemonGameSurfaceBuilder.TuiSurfaceId, legacyGameTuiSurface.Surface.Id);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.SurfaceId, legacyEditorSurface.Surface.Id);
|
||||
Assert.AreEqual(AetheriaRuntimeDaemonEditorSurfaceBuilder.TuiSurfaceId, legacyEditorTuiSurface.Surface.Id);
|
||||
Assert.IsNotNull(legacyAuthorityStatus);
|
||||
Assert.AreEqual(AetheriaRuntimeVerseAuthoritySchemas.Policy, legacyAuthorityStatus!.Schema);
|
||||
Assert.AreEqual(authorityPolicy.HostRuntimeId, legacyAuthorityStatus.HostRuntimeId);
|
||||
Assert.AreEqual(AetheriaRuntimeCatalogSnapshot.SchemaId, client.State.Catalog.Sources.Last().SchemaId);
|
||||
Assert.GreaterOrEqual(catalog.Items.Count, 0);
|
||||
Assert.AreEqual(AetheriaRuntimePlayerSettingsDocument.SchemaId, playerSettings.Schema);
|
||||
|
|
@ -4152,6 +4166,23 @@ public class DaemonRuntimeDocumentTests
|
|||
.GetResult();
|
||||
}
|
||||
|
||||
private static void PublishVerseAuthorityPolicyThroughVerseClient(
|
||||
string statePath,
|
||||
AetheriaRuntimeVerseAuthorityPolicyDocument policy)
|
||||
{
|
||||
using var client = AetheriaRuntimeVerseClient
|
||||
.OpenAsync(statePath, "daemon-authority-policy-test", startServer: false, pullOnOpen: true)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
client.VerseAuthorityPolicy()
|
||||
.ReplaceAsync(policy)
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
client.FlushAsync()
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
private static AetheriaRuntimeCatalogItem CatalogItem(
|
||||
string itemKey,
|
||||
IReadOnlyList<AetheriaRuntimeBehaviorPayload> behaviorPayloads)
|
||||
|
|
|
|||
|
|
@ -322,15 +322,10 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return await State.Daemon.Health.LatestAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public Task<AetheriaRuntimeVerseAuthorityPolicyDocument?> AuthorityStatusAsync()
|
||||
public async Task<AetheriaRuntimeVerseAuthorityPolicyDocument?> AuthorityStatusAsync()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
return Task.FromResult(
|
||||
AetheriaRuntimeDaemonPublicationStore.TryReadVerseAuthorityPolicy(
|
||||
StatePath,
|
||||
out var policy)
|
||||
? policy
|
||||
: null);
|
||||
return await State.Daemon.AuthorityPolicy.LatestAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<AetheriaRuntimeDaemonSoaViewDocument?> SoaViewAsync()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
CultMeshDocumentHandle<AetheriaRuntimeDaemonProviderAdvertisementDocument> providerAdvertisement,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonHealthDocument> health,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonCommandBoundaryDocument> commandBoundary,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeVerseAuthorityPolicyDocument> authorityPolicy,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonFrameDocument> latestFrame,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonSoaViewDocument> latestSoaView,
|
||||
CultMeshDocumentHandle<global::Aetheria.State.Documents.EveSurfaceState> gameSurface,
|
||||
|
|
@ -49,6 +50,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
providerAdvertisement,
|
||||
health,
|
||||
commandBoundary,
|
||||
authorityPolicy,
|
||||
latestFrame,
|
||||
latestSoaView,
|
||||
gameSurface,
|
||||
|
|
@ -84,6 +86,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
Daemon.ProviderAdvertisement,
|
||||
Daemon.Health,
|
||||
Daemon.CommandBoundary,
|
||||
Daemon.AuthorityPolicy,
|
||||
Daemon.GameSurface,
|
||||
Daemon.GameTuiSurface,
|
||||
Daemon.EditorSurface,
|
||||
|
|
@ -214,6 +217,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
CultMeshDocumentHandle<AetheriaRuntimeDaemonProviderAdvertisementDocument> providerAdvertisement,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonHealthDocument> health,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonCommandBoundaryDocument> commandBoundary,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeVerseAuthorityPolicyDocument> authorityPolicy,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonFrameDocument> latestFrame,
|
||||
CultMeshDocumentHandle<AetheriaRuntimeDaemonSoaViewDocument> latestSoaView,
|
||||
CultMeshDocumentHandle<global::Aetheria.State.Documents.EveSurfaceState> gameSurface,
|
||||
|
|
@ -224,6 +228,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
ProviderAdvertisement = providerAdvertisement ?? throw new ArgumentNullException(nameof(providerAdvertisement));
|
||||
Health = health ?? throw new ArgumentNullException(nameof(health));
|
||||
CommandBoundary = commandBoundary ?? throw new ArgumentNullException(nameof(commandBoundary));
|
||||
AuthorityPolicy = authorityPolicy ?? throw new ArgumentNullException(nameof(authorityPolicy));
|
||||
LatestFrame = latestFrame ?? throw new ArgumentNullException(nameof(latestFrame));
|
||||
LatestSoaView = latestSoaView ?? throw new ArgumentNullException(nameof(latestSoaView));
|
||||
GameSurface = gameSurface ?? throw new ArgumentNullException(nameof(gameSurface));
|
||||
|
|
@ -238,6 +243,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
|
||||
public CultMeshDocumentHandle<AetheriaRuntimeDaemonCommandBoundaryDocument> CommandBoundary { get; }
|
||||
|
||||
public CultMeshDocumentHandle<AetheriaRuntimeVerseAuthorityPolicyDocument> AuthorityPolicy { get; }
|
||||
|
||||
public CultMeshDocumentHandle<AetheriaRuntimeDaemonFrameDocument> LatestFrame { get; }
|
||||
|
||||
public CultMeshDocumentHandle<AetheriaRuntimeDaemonSoaViewDocument> LatestSoaView { get; }
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ namespace GameCult.Aetheria.State.Verse
|
|||
public static CultRecordKey DaemonCommandBoundary { get; } =
|
||||
new CultRecordKey("daemon:aetheria.command_boundary.v1");
|
||||
|
||||
public static CultRecordKey VerseAuthorityPolicy { get; } =
|
||||
new CultRecordKey(AetheriaRuntimeVerseAuthorityPolicyDocument.DocumentKey);
|
||||
|
||||
public static CultRecordKey DaemonFrameLatest { get; } =
|
||||
new CultRecordKey("daemon:aetheria.frame.latest.v1");
|
||||
|
||||
|
|
@ -88,6 +91,7 @@ namespace GameCult.Aetheria.State.Verse
|
|||
typeof(AetheriaRuntimeDaemonProviderAdvertisementDocument),
|
||||
typeof(AetheriaRuntimeDaemonHealthDocument),
|
||||
typeof(AetheriaRuntimeDaemonCommandBoundaryDocument),
|
||||
typeof(AetheriaRuntimeVerseAuthorityPolicyDocument),
|
||||
typeof(AetheriaRuntimeDaemonFrameDocument),
|
||||
typeof(AetheriaRuntimeDaemonSoaViewDocument),
|
||||
typeof(AetheriaRuntimeAssetManifestDocument),
|
||||
|
|
@ -222,6 +226,12 @@ namespace GameCult.Aetheria.State.Verse
|
|||
return await Aetheria().Daemon.CommandBoundary.LatestAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<AetheriaRuntimeVerseAuthorityPolicyDocument?> GetVerseAuthorityPolicyAsync()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
return await Aetheria().Daemon.AuthorityPolicy.LatestAsync().ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task<AetheriaRuntimeDaemonFrameDocument?> GetLatestFrameAsync()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
|
@ -391,6 +401,13 @@ namespace GameCult.Aetheria.State.Verse
|
|||
AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary);
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaRuntimeVerseAuthorityPolicyDocument> VerseAuthorityPolicy()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
return MutableDocumentPointer<AetheriaRuntimeVerseAuthorityPolicyDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy);
|
||||
}
|
||||
|
||||
public CultMeshMutableStatePointer<AetheriaRuntimeDaemonFrameDocument> LatestFrame()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
|
@ -504,6 +521,14 @@ namespace GameCult.Aetheria.State.Verse
|
|||
AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary);
|
||||
}
|
||||
|
||||
public Observable<CultNetDatabaseChange<AetheriaRuntimeVerseAuthorityPolicyDocument>>
|
||||
WatchVerseAuthorityPolicies()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
return Database.WatchRecord<AetheriaRuntimeVerseAuthorityPolicyDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy);
|
||||
}
|
||||
|
||||
public Observable<CultNetDatabaseChange<AetheriaRuntimeDaemonFrameDocument>> WatchLatestFrames()
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
|
@ -742,6 +767,8 @@ namespace GameCult.Aetheria.State.Verse
|
|||
AetheriaRuntimeVerseRecordKeys.DaemonHealth),
|
||||
Document<AetheriaRuntimeDaemonCommandBoundaryDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonCommandBoundary),
|
||||
Document<AetheriaRuntimeVerseAuthorityPolicyDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.VerseAuthorityPolicy),
|
||||
Document<AetheriaRuntimeDaemonFrameDocument>(
|
||||
AetheriaRuntimeVerseRecordKeys.DaemonFrameLatest),
|
||||
Document<AetheriaRuntimeDaemonSoaViewDocument>(
|
||||
|
|
|
|||
Loading…
Reference in a new issue