diff --git a/Aetheria.State/AetheriaVerseReplica.cs b/Aetheria.State/AetheriaVerseReplica.cs index 0bb48a729..7bfe3ca8b 100644 --- a/Aetheria.State/AetheriaVerseReplica.cs +++ b/Aetheria.State/AetheriaVerseReplica.cs @@ -69,11 +69,14 @@ public static class AetheriaVerseReplica TimeSpan? responseTimeout = null) where T : class { - var documents = await CultMesh.FetchSnapshotDocumentsAsync( + var surface = CreateSnapshotEndpoint( endpoint, - CreateSnapshotOptions("aetheria-verse-replica", schemaIds, recordKeys, connectTimeout, responseTimeout), - AetheriaDocumentRegistry.CreateCultNetRegistry()).ConfigureAwait(false); - return documents; + "aetheria-verse-replica", + schemaIds, + recordKeys, + connectTimeout, + responseTimeout); + return await surface.FetchDocumentsAsync(recordKeys, schemaIds).ConfigureAwait(false); } public static async Task RunReplicaAsync( @@ -212,6 +215,30 @@ public static class AetheriaVerseReplica }; } + private static CultMeshSnapshotEndpoint CreateSnapshotEndpoint( + string endpoint, + string runtimeId, + IReadOnlyList? schemaIds, + IReadOnlyList? recordKeys, + TimeSpan? connectTimeout, + TimeSpan? responseTimeout) + { + var effectiveRuntimeId = string.IsNullOrWhiteSpace(runtimeId) ? "aetheria-verse-replica" : runtimeId; + return CultMesh.SnapshotEndpoint( + endpoint, + new CultMeshSnapshotEndpointOptions + { + Context = CultMesh.Verse("aetheria.remote", effectiveRuntimeId).Context, + DocumentRegistry = AetheriaDocumentRegistry.CreateCultNetRegistry(), + Request = CreateSnapshotOptions( + effectiveRuntimeId, + schemaIds, + recordKeys, + connectTimeout, + responseTimeout) + }); + } + private static Task OpenReplicaNodeAsync( string replicaStatePath, string endpoint,