Request snapshot aliases by record key
This commit is contained in:
parent
b16f49665a
commit
d5f9d2d752
2 changed files with 16 additions and 6 deletions
|
|
@ -291,7 +291,7 @@ namespace GameCult.Mesh
|
|||
var descriptor = CultDocumentRegistry.Shared.GetRequired<TDocument>();
|
||||
return CultMesh.FetchSnapshotDocumentsAsync<TDocument>(
|
||||
Endpoint,
|
||||
CreateRequest(schemaIds ?? new[] { descriptor.SchemaId }, recordKeys),
|
||||
CreateRequest(ResolveDefaultSchemaFilter(schemaIds, recordKeys, descriptor), recordKeys),
|
||||
DocumentRegistry);
|
||||
}
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ namespace GameCult.Mesh
|
|||
var descriptor = CultDocumentRegistry.Shared.GetRequired<TDocument>();
|
||||
var result = await SyncSnapshotAsync(
|
||||
node,
|
||||
schemaIds ?? new[] { descriptor.SchemaId },
|
||||
ResolveDefaultSchemaFilter(schemaIds, recordKeys, descriptor),
|
||||
recordKeys,
|
||||
flush)
|
||||
.ConfigureAwait(false);
|
||||
|
|
@ -448,6 +448,19 @@ namespace GameCult.Mesh
|
|||
return request;
|
||||
}
|
||||
|
||||
private static IReadOnlyList<string>? ResolveDefaultSchemaFilter(
|
||||
IReadOnlyList<string>? schemaIds,
|
||||
IReadOnlyList<string>? recordKeys,
|
||||
CultDocumentDescriptor descriptor)
|
||||
{
|
||||
if (schemaIds != null)
|
||||
return schemaIds;
|
||||
|
||||
return recordKeys is { Count: > 0 }
|
||||
? null
|
||||
: new[] { descriptor.SchemaId };
|
||||
}
|
||||
|
||||
private static CultMeshSnapshotRequestOptions CloneSnapshotRequestOptions(CultMeshSnapshotRequestOptions? source)
|
||||
{
|
||||
if (source == null)
|
||||
|
|
|
|||
Loading…
Reference in a new issue