Previous Page Arrow Next Page Arrow

5.4 Handling Conflicts on the Target Side

Conflicts are handled on the target side when the target processes the entries of the synchronization feed (see Updating Synchronization Target section).

For each entry in the feed, the target endpoint has four pieces of information to analyze and resolve the conflict:

  • sourceDigest: the source digest, carried by the <digest> element of the synchronization feed.
  • targetDigest: the target digest, that it can obtain from its local store.
  • sourceState: the synchronization state of the source resource, carried by the <syncState> element of the synchronization feed entry.
  • targetState: the synchronization state of the target resource, that it can read from its local store.

The target endpoint uses the following algorithm to decide if there is a conflict or not (see the Conflict Resolution with Digest section for examples of results produced by this algorithm):

  • If sourceState.endpoint = targetState.endpoint, there is no conflict and the update must be applied if sourceState.tick > targetState.tick.
  • If targetState is contained in sourceDigest, i.e. if sourceDigest has a digest entry E such that E.endpoint = targetState.endpoint and E.tick > targetState.tick, there is no conflict and the update must be applied.
  • If sourceState is contained in targetDigest, i.e. if targetDigest has a digest entry E such that E.endpoint = sourceState.endpoint and E.tick > sourceState.tick, there is no conflict and the update must be ignored (target has the most recent version).

  • Otherwise (targetState not contained in sourceDigest, sourceState not contained in targetDigest), there is a conflict.

In case of conflict, the target endpoint uses the following algorithm to resolve the conflict:

  • Let sourceEntry be the sourceDigest digest entry such that sourceEntry.endpoint = sourceState.endpoint.
  • Let targetEntry be the targetDigest digest entry such that targetEntry.endpoint = targetState.endpoint.
  • If sourceEntry .conflictPriority <> targetEntry .conflictPriority, the side with lowest priority wins.

  • Otherwise (sourceEntry .conflictPriority = targetEntry .conflictPriority), then sourceState.stamp and targetState.stamp are compared and the entry with the most recent timestamp wins.
A provider exposing a $syncTarget URL for resource kind MUST conform to the conflict resolution mechanism described in this section

Previous Page Arrow Next Page Arrow