Bind CultMesh authority identity to physical routes
This commit is contained in:
parent
21163d83fa
commit
6c848bd6c0
45 changed files with 1671 additions and 194 deletions
|
|
@ -391,7 +391,8 @@ namespace GameCult.Mesh
|
|||
PayloadSchema = requestSchema.Trim(),
|
||||
PayloadEncoding = "messagepack-base64",
|
||||
Payload = Convert.ToBase64String(MessagePackSerializer.Serialize(request, CultNetSchemaMessageSerialization.Options)),
|
||||
SourceRuntimeId = sourceRuntimeId.Trim()
|
||||
SourceRuntimeId = sourceRuntimeId.Trim(),
|
||||
TargetRuntimeId = target.AuthorityRuntimeId
|
||||
};
|
||||
using var timeout = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
|
||||
timeout.CancelAfter(_operationResponseTimeout);
|
||||
|
|
@ -441,6 +442,11 @@ namespace GameCult.Mesh
|
|||
if (!string.Equals(envelope.ServiceId, expectedService, StringComparison.Ordinal) ||
|
||||
!string.Equals(envelope.Operation, expectedOperation, StringComparison.Ordinal))
|
||||
throw new InvalidOperationException("CultMesh operation response did not match the requested service and operation.");
|
||||
if (!string.Equals(envelope.SourceRuntimeId, target.AuthorityRuntimeId, StringComparison.Ordinal))
|
||||
throw new CultMeshSessionException(new CultMeshSessionFailure(
|
||||
CultMeshSessionFailureReason.Authority,
|
||||
$"CultMesh operation response came from runtime '{envelope.SourceRuntimeId ?? "(missing)"}', " +
|
||||
$"not selected authority '{target.AuthorityRuntimeId}'."));
|
||||
if (string.Equals(envelope.PayloadSchema, CultNetOperationServer.FailureSchemaId, StringComparison.Ordinal))
|
||||
{
|
||||
if (!string.Equals(envelope.PayloadEncoding, "messagepack-base64", StringComparison.Ordinal))
|
||||
|
|
@ -795,7 +801,7 @@ namespace GameCult.Mesh
|
|||
_cache,
|
||||
new CultRecordKey(recordKey),
|
||||
CultMesh.Verse(target.VerseId, "cultmesh-client").Context,
|
||||
routeHint: new CultMeshRouteHint(CultMeshLocalityKind.Network, target.ProviderRuntimeId));
|
||||
routeHint: new CultMeshRouteHint(CultMeshLocalityKind.Network, target.AuthorityRuntimeId));
|
||||
}
|
||||
|
||||
public CultMeshDocumentHandle<TDocument> Handle { get; }
|
||||
|
|
@ -897,7 +903,7 @@ namespace GameCult.Mesh
|
|||
_subscription = new CultNetDatabaseSubscriptionClient(session.OpenSchemaClient(), _cache, networkRegistry);
|
||||
Handle = CultMesh.Collection<TDocument>(
|
||||
_cache,
|
||||
routeHint: new CultMeshRouteHint(CultMeshLocalityKind.Network, target.ProviderRuntimeId));
|
||||
routeHint: new CultMeshRouteHint(CultMeshLocalityKind.Network, target.AuthorityRuntimeId));
|
||||
}
|
||||
|
||||
public CultMeshCollectionHandle<TDocument> Handle { get; }
|
||||
|
|
|
|||
Loading…
Reference in a new issue