MappingStateManager

Classes > Sync > MappingStateManager

Static methods for managing mapping state. Implements spec Section 7.5.3 - Sync Decision Logic.

public static class MappingStateManager

Methods

ShouldSyncByVersion(long, MappingStateEntry)

public static bool ShouldSyncByVersion(long changeVersion, MappingStateEntry state)

Determines if a change should be synced based on version tracking.

Parameters:

Name Type Description
changeVersion Int64 Version of the change.
state MappingStateEntry Current mapping state.

Returns: Boolean - True if change should be synced.

ShouldSyncByHash(string, string?)

public static bool ShouldSyncByHash(string currentHash, string? storedHash)

Determines if a change should be synced based on hash tracking.

Parameters:

Name Type Description
currentHash String Hash of current payload.
storedHash String Previously stored hash (null if not synced).

Returns: Boolean - True if change should be synced.

ShouldSyncByTimestamp(string, string?)

public static bool ShouldSyncByTimestamp(string changeTimestamp, string? lastSyncedAt)

Determines if a change should be synced based on timestamp tracking.

Parameters:

Name Type Description
changeTimestamp String Timestamp of the change.
lastSyncedAt String Last sync timestamp for the record (null if not synced).

Returns: Boolean - True if change should be synced.

UpdateAfterSync(MappingStateEntry, long, long, string)

public static MappingStateEntry UpdateAfterSync(MappingStateEntry state, long toVersion, long recordCount, string timestamp)

Updates mapping state after successful sync.

Parameters:

Name Type Description
state MappingStateEntry Current state.
toVersion Int64 Version synced to.
recordCount Int64 Number of records synced.
timestamp String Current timestamp.

Returns: MappingStateEntry - Updated state.