Class ReplicaSyncClient
HTTP-based IReplicaSyncClient implementation targeting the GeoServices
FeatureServer replica sync endpoints (createReplica, extractChanges,
synchronizeReplica, unRegisterReplica).
public sealed class ReplicaSyncClient : IReplicaSyncClient
- Inheritance
-
ReplicaSyncClient
- Implements
- Inherited Members
Constructors
ReplicaSyncClient(HttpClient)
Initializes a new instance of the ReplicaSyncClient class.
public ReplicaSyncClient(HttpClient httpClient)
Parameters
httpClientHttpClientAn HttpClient configured with the base address of the feature server.
Exceptions
- ArgumentNullException
Thrown when
httpClientis null.
Methods
CreateReplicaAsync(string, string, IReadOnlyList<int>?, CancellationToken)
Creates a new server-side replica for the specified service.
public Task<CreateReplicaResult> CreateReplicaAsync(string serviceId, string replicaName, IReadOnlyList<int>? layerIds = null, CancellationToken cancellationToken = default)
Parameters
serviceIdstringThe feature service identifier.
replicaNamestringA name for the new replica.
layerIdsIReadOnlyList<int>Optional layer IDs to include. When null, all layers are included.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<CreateReplicaResult>
The created replica ID and initial server generation number.
ExtractChangesAsync(string, string, string?, CancellationToken)
Extracts feature changes (adds, updates, deletes) from the server, scoped to the changes that occurred after the supplied server generation.
public Task<ExtractChangesResult> ExtractChangesAsync(string serviceId, string replicaId, string? sinceServerGen, CancellationToken cancellationToken = default)
Parameters
serviceIdstringThe feature service identifier.
replicaIdstringThe replica ID obtained from CreateReplicaAsync(string, string, IReadOnlyList<int>?, CancellationToken).
sinceServerGenstringThe server generation the local replica last applied, used as the lower bound ("since") for the extract. When null or whitespace, the server returns changes since its recorded replica cursor.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<ExtractChangesResult>
Layer-level changes, delivered generations, and transfer-limit metadata.
Remarks
The GeoServices replica protocol scopes extractChanges by the replica's last-known
server generation. Pass the generation applied locally to extract its subsequent delta.
Omitting it uses the server's recorded replica cursor, which may have advanced after a
download that was not applied locally. The default implementation delegates to the
generation-less overload for backward compatibility with existing implementations.
ExtractChangesAsync(string, string, CancellationToken)
Extracts feature changes (adds, updates, deletes) from the server's recorded replica cursor.
public Task<ExtractChangesResult> ExtractChangesAsync(string serviceId, string replicaId, CancellationToken cancellationToken = default)
Parameters
serviceIdstringThe feature service identifier.
replicaIdstringThe replica ID obtained from CreateReplicaAsync(string, string, IReadOnlyList<int>?, CancellationToken).
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<ExtractChangesResult>
Layer-level changes, delivered generations, and transfer-limit metadata.
SynchronizeReplicaAsync(string, string, long, string, CancellationToken)
Synchronizes a replica using the generation already received and applied locally as the
download lower bound (replicaServerGen).
public Task<SynchronizeResult> SynchronizeReplicaAsync(string serviceId, string replicaId, long receivedServerGen, string syncDirection = "download", CancellationToken cancellationToken = default)
Parameters
serviceIdstringThe feature service identifier.
replicaIdstringThe replica ID.
receivedServerGenlongThe nonnegative server generation already applied locally.
syncDirectionstringSync direction (for example,
"download").cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<SynchronizeResult>
The replica ID, delivered generation, changes, and transfer-limit metadata.
Remarks
Pass the generation of the locally applied snapshot or preceding delivery. Apply the returned changes and save their generation together before continuing. If local application fails, retry with the preceding applied generation, even if the server cursor advanced. If ExceededTransferLimit is true, repeat after applying this window. This downloads intervening edits; it does not merely acknowledge an extract. Implementations that do not support an explicit generation throw rather than ignore it.
SynchronizeReplicaAsync(string, string, string, CancellationToken)
Synchronizes a replica and exposes any downloaded feature changes.
public Task<SynchronizeResult> SynchronizeReplicaAsync(string serviceId, string replicaId, string syncDirection = "download", CancellationToken cancellationToken = default)
Parameters
serviceIdstringThe feature service identifier.
replicaIdstringThe replica ID.
syncDirectionstringSync direction (for example,
"download").cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.
Returns
- Task<SynchronizeResult>
The replica ID, delivered generation, changes, and transfer-limit metadata.
Remarks
Download synchronization advances the server's delivery cursor. It is not an acknowledgement that the caller applied the changes locally. Apply every returned change before persisting the returned generation; use the generation-aware overload to retry an unapplied delivery.
UnRegisterReplicaAsync(string, string, CancellationToken)
Unregisters a replica from the server, freeing server-side resources.
public Task UnRegisterReplicaAsync(string serviceId, string replicaId, CancellationToken cancellationToken = default)
Parameters
serviceIdstringThe feature service identifier.
replicaIdstringThe replica ID to unregister.
cancellationTokenCancellationTokenA token to observe while waiting for the task to complete.