MappedSyncCoordinator
Sync coordinator with data mapping support. Applies mappings (Section 7) during sync operations.
public static class MappedSyncCoordinator
Methods
PullWithMapping(string, long, SyncMappingConfig, BatchConfig, Func<long, int, Result<IReadOnlyList<SyncLogEntry>, SyncError>>, Func<MappedEntry, SyncOperation, Result<bool, SyncError>>, Func<Result<bool, SyncError>>, Func<Result<bool, SyncError>>, Action<long>, Func<string, MappingSyncState?>, Action<MappingSyncState>, Func<string, string, RecordHash?>, Action<RecordHash>, ILogger)
public static Result<PullResult, SyncError> PullWithMapping(string myOriginId, long lastSyncedVersion, SyncMappingConfig mappingConfig, BatchConfig config, Func<long, int, Result<IReadOnlyList<SyncLogEntry>, SyncError>> fetchRemoteChanges, Func<MappedEntry, SyncOperation, Result<bool, SyncError>> applyMappedChange, Func<Result<bool, SyncError>> enableTriggerSuppression, Func<Result<bool, SyncError>> disableTriggerSuppression, Action<long> updateLastSyncedVersion, Func<string, MappingSyncState?> getMappingState, Action<MappingSyncState> updateMappingState, Func<string, string, RecordHash?> getRecordHash, Action<RecordHash> saveRecordHash, ILogger logger)
Pulls changes from remote and applies them with mapping transformations. Per spec Section 12.2 - Sync Session Protocol.
Parameters:
| Name | Type | Description |
|---|---|---|
myOriginId |
String |
This replica's origin ID. |
lastSyncedVersion |
Int64 |
Last synced version. |
mappingConfig |
SyncMappingConfig |
Mapping configuration. |
config |
BatchConfig |
Batch configuration. |
fetchRemoteChanges |
SyncError>> |
Fetches changes from remote. |
applyMappedChange |
SyncError>> |
Applies a mapped change locally. |
enableTriggerSuppression |
SyncError>> |
Enables trigger suppression. |
disableTriggerSuppression |
SyncError>> |
Disables trigger suppression. |
updateLastSyncedVersion |
Int64> |
Updates last synced version. |
getMappingState |
MappingSyncState> |
Gets mapping state for tracking. |
updateMappingState |
MappingSyncState> |
Updates mapping state after sync. |
getRecordHash |
RecordHash> |
Gets record hash for hash tracking. |
saveRecordHash |
RecordHash> |
Saves record hash after sync. |
logger |
ILogger |
Logger. |
Returns: SyncError> - Mapped pull result or error.
PushWithMapping(long, SyncMappingConfig, BatchConfig, Func<long, int, Result<IReadOnlyList<SyncLogEntry>, SyncError>>, Func<IReadOnlyList<(MappedEntry Entry, SyncLogEntry Original)>, Result<bool, SyncError>>, Action<long>, Func<string, MappingSyncState?>, Action<MappingSyncState>, Func<string, string, RecordHash?>, Action<RecordHash>, ILogger)
public static Result<PushResult, SyncError> PushWithMapping(long lastPushedVersion, SyncMappingConfig mappingConfig, BatchConfig config, Func<long, int, Result<IReadOnlyList<SyncLogEntry>, SyncError>> fetchLocalChanges, Func<IReadOnlyList<(MappedEntry Entry, SyncLogEntry Original)>, Result<bool, SyncError>> sendMappedChanges, Action<long> updateLastPushedVersion, Func<string, MappingSyncState?> getMappingState, Action<MappingSyncState> updateMappingState, Func<string, string, RecordHash?> getRecordHash, Action<RecordHash> saveRecordHash, ILogger logger)
Pushes local changes with mapping transformations.
Parameters:
| Name | Type | Description |
|---|---|---|
lastPushedVersion |
Int64 |
Last pushed version. |
mappingConfig |
SyncMappingConfig |
Mapping configuration. |
config |
BatchConfig |
Batch configuration. |
fetchLocalChanges |
SyncError>> |
Fetches local changes. |
sendMappedChanges |
SyncError>> |
Sends mapped changes to remote. |
updateLastPushedVersion |
Int64> |
Updates last pushed version. |
getMappingState |
MappingSyncState> |
Gets mapping state. |
updateMappingState |
MappingSyncState> |
Updates mapping state. |
getRecordHash |
RecordHash> |
Gets record hash. |
saveRecordHash |
RecordHash> |
Saves record hash. |
logger |
ILogger |
Logger. |
Returns: SyncError> - Push result or error.