From 6fbed1564fb514e1814295ec6cd382cd1a9af97f Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sat, 27 Jun 2026 17:45:18 +0100 Subject: [PATCH] Bind replica document fetches through CultMesh snapshot endpoints --- Aetheria.State/AetheriaVerseReplica.cs | 35 +++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 4 deletions(-) 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,