Isolate content reads from live document sessions
This commit is contained in:
parent
af6adf086d
commit
4d37d1c71f
3 changed files with 15 additions and 0 deletions
|
|
@ -173,6 +173,7 @@ namespace GameCult.Mesh
|
|||
using var snapshot = await CultMeshSnapshotSession.ConnectAsync(
|
||||
_sessions,
|
||||
CultMeshEndpointId.Parse(endpointId),
|
||||
CultMeshProtocols.Content,
|
||||
new CultMeshSnapshotRequestOptions
|
||||
{
|
||||
ConnectTimeout = TimeSpan.FromSeconds(5),
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ namespace GameCult.Mesh
|
|||
public static class CultMeshProtocols
|
||||
{
|
||||
public static CultMeshProtocolId Documents { get; } = new CultMeshProtocolId("cultmesh.documents.v1");
|
||||
public static CultMeshProtocolId Content { get; } = new CultMeshProtocolId("cultmesh.content.v1");
|
||||
public static CultMeshProtocolId Discovery { get; } = new CultMeshProtocolId("cultmesh.discovery.v1");
|
||||
public static CultMeshProtocolId PeerExchange { get; } = new CultMeshProtocolId("cultmesh.peer_exchange.v1");
|
||||
public static CultMeshProtocolId Subscriptions { get; } = new CultMeshProtocolId("cultmesh.subscriptions.v1");
|
||||
|
|
|
|||
|
|
@ -122,6 +122,19 @@ namespace GameCult.Mesh
|
|||
return new CultMeshSnapshotSession(session, options ?? new CultMeshSnapshotRequestOptions(), registry);
|
||||
}
|
||||
|
||||
public static async Task<CultMeshSnapshotSession> ConnectAsync(
|
||||
CultMeshSessionManager sessions,
|
||||
CultMeshEndpointId endpointId,
|
||||
CultMeshProtocolId protocol,
|
||||
CultMeshSnapshotRequestOptions options,
|
||||
CultNetDocumentRegistry? registry = null,
|
||||
CancellationToken cancellationToken = default)
|
||||
{
|
||||
if (sessions == null) throw new ArgumentNullException(nameof(sessions));
|
||||
var session = await sessions.ConnectAsync(endpointId, protocol, cancellationToken).ConfigureAwait(false);
|
||||
return new CultMeshSnapshotSession(session, options ?? new CultMeshSnapshotRequestOptions(), registry);
|
||||
}
|
||||
|
||||
/// <summary>Fetches one raw snapshot while retaining the underlying endpoint connection.</summary>
|
||||
public async Task<CultNetSnapshotResponseRawMessage> FetchSnapshotAsync(
|
||||
IReadOnlyList<string>? schemaIds = null,
|
||||
|
|
|
|||
Loading…
Reference in a new issue