Class OfflineSyncEngine
Provider-neutral offline sync engine for pushing local edits and pulling feature pages.
public sealed class OfflineSyncEngine : IOfflineSyncRunner
- Inheritance
-
OfflineSyncEngine
- Implements
- Inherited Members
Constructors
OfflineSyncEngine(IHonuaFeatureQueryClient, IHonuaFeatureEditClient, IOfflineFeatureStore, IOfflineChangeJournal, IOfflineSyncCheckpointStore, OfflineSyncEngineOptions?, IOfflineSyncStateStore?, IOfflineConflictStore?)
Initializes a new instance of the OfflineSyncEngine class.
public OfflineSyncEngine(IHonuaFeatureQueryClient queryClient, IHonuaFeatureEditClient editClient, IOfflineFeatureStore featureStore, IOfflineChangeJournal changeJournal, IOfflineSyncCheckpointStore checkpointStore, OfflineSyncEngineOptions? options = null, IOfflineSyncStateStore? stateStore = null, IOfflineConflictStore? conflictStore = null)
Parameters
queryClientIHonuaFeatureQueryClientProvider-neutral query client.
editClientIHonuaFeatureEditClientProvider-neutral edit client.
featureStoreIOfflineFeatureStoreLocal feature store.
changeJournalIOfflineChangeJournalLocal change journal.
checkpointStoreIOfflineSyncCheckpointStoreSync checkpoint store.
optionsOfflineSyncEngineOptionsSync engine options.
stateStoreIOfflineSyncStateStoreOptional sync state store.
conflictStoreIOfflineConflictStoreOptional conflict store.
OfflineSyncEngine(IHonuaFeatureQueryClient, IHonuaFeatureEditClient, IOfflineFeatureStore, IOfflineChangeJournal, IOfflineSyncCheckpointStore, OfflineSyncEngineOptions?, IOfflineSyncStateStore?, IOfflineConflictStore?, ILogger<OfflineSyncEngine>?)
Initializes a new instance of the OfflineSyncEngine class.
public OfflineSyncEngine(IHonuaFeatureQueryClient queryClient, IHonuaFeatureEditClient editClient, IOfflineFeatureStore featureStore, IOfflineChangeJournal changeJournal, IOfflineSyncCheckpointStore checkpointStore, OfflineSyncEngineOptions? options, IOfflineSyncStateStore? stateStore, IOfflineConflictStore? conflictStore, ILogger<OfflineSyncEngine>? logger)
Parameters
queryClientIHonuaFeatureQueryClientProvider-neutral query client.
editClientIHonuaFeatureEditClientProvider-neutral edit client.
featureStoreIOfflineFeatureStoreLocal feature store.
changeJournalIOfflineChangeJournalLocal change journal.
checkpointStoreIOfflineSyncCheckpointStoreSync checkpoint store.
optionsOfflineSyncEngineOptionsSync engine options.
stateStoreIOfflineSyncStateStoreOptional sync state store.
conflictStoreIOfflineConflictStoreOptional conflict store.
loggerILogger<OfflineSyncEngine>Optional logger for sync phases and failure diagnostics.
Methods
PullAsync(OfflinePackageManifest, CancellationToken)
Pulls remote feature pages into the local feature store.
public Task<OfflinePullResult> PullAsync(OfflinePackageManifest manifest, CancellationToken cancellationToken = default)
Parameters
manifestOfflinePackageManifestOffline package manifest.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<OfflinePullResult>
Pull result.
Remarks
This is a full refresh: every call re-queries each source from the beginning and re-stores all matching features. It is not an incremental/delta pull. The provider-neutral feature query API (FeatureQueryResult) exposes no server high-water-mark / sync token, so there is nothing to advance between runs; the persisted checkpoint therefore tracks only the number of features pulled and does not record an advancing SyncToken.
Callers that need server-driven delta sync (a serverGen high-water
mark) should use ReplicaSyncClient instead. Pass the locally applied
generation to its extract or synchronization requests, apply the delivered adds,
updates, and tombstones, then persist the delivered generation. Download synchronization
can return intervening changes and is not merely an acknowledgement of an extract.
PushAsync(string, CancellationToken)
Pushes pending local edits to the provider.
public Task<OfflinePushResult> PushAsync(string packageId, CancellationToken cancellationToken = default)
Parameters
packageIdstringOffline package identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<OfflinePushResult>
Push result.
Remarks
Pending operations are uploaded with at-least-once delivery: a retryable failure (transport error or timeout) re-uploads the same operation on the next push. For Add operations this means a response lost after the server has already committed the insert results in the feature being re-added, creating a duplicate, because the request carries no server-honored idempotency key. Callers that require exactly-once add semantics must reconcile duplicates out of band (e.g. by querying a stable client-assigned GlobalId after sync). Durable idempotency requires honua-server to treat a client-supplied operation key as a no-op on replay; see the SDK release notes.
SyncAsync(OfflinePackageManifest, CancellationToken)
Runs a full push and pull sync for an offline package.
public Task<OfflineSyncRunResult> SyncAsync(OfflinePackageManifest manifest, CancellationToken cancellationToken = default)
Parameters
manifestOfflinePackageManifestOffline package manifest.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<OfflineSyncRunResult>
Full sync run result.