SyncTrackingManager

Classes > Sync > SyncTrackingManager

Manages sync tracking state per spec Section 7.5. Determines whether records should be synced based on tracking strategy.

public static class SyncTrackingManager

Methods

ShouldSync(SyncLogEntry, TableMapping, Func<string, MappingSyncState?>, Func<string, string, RecordHash?>)

public static bool ShouldSync(SyncLogEntry entry, TableMapping mapping, Func<string, MappingSyncState?> getMappingState, Func<string, string, RecordHash?> getRecordHash)

Determines if an entry should be synced based on tracking state. Per spec Section 7.5.3 - Sync Decision Logic.

Parameters:

Name Type Description
entry SyncLogEntry Sync log entry.
mapping TableMapping Table mapping with tracking config.
getMappingState MappingSyncState> Function to get mapping state.
getRecordHash RecordHash> Function to get record hash.

Returns: Boolean - True if entry should be synced.

ComputePayloadHash(string)

public static string ComputePayloadHash(string payload)

Computes SHA-256 hash of canonical JSON payload. Per spec Section 16.2 - Canonical JSON.

Parameters:

Name Type Description
payload String JSON payload to hash.

Returns: String - Hex-encoded SHA-256 hash.

UpdateMappingState(string, long, int, MappingSyncState?)

public static MappingSyncState UpdateMappingState(string mappingId, long version, int recordCount, MappingSyncState? existingState)

Creates updated mapping state after successful sync.

Parameters:

Name Type Description
mappingId String Mapping identifier.
version Int64 Latest synced version.
recordCount Int32 Number of records synced.
existingState MappingSyncState Existing state to update.

Returns: MappingSyncState - Updated mapping state.

CreateRecordHash(string, string, string)

public static RecordHash CreateRecordHash(string mappingId, string sourcePk, string payload)

Creates record hash for hash-based tracking.

Parameters:

Name Type Description
mappingId String Mapping identifier.
sourcePk String Source primary key JSON.
payload String Payload to hash.

Returns: RecordHash - Record hash entry.