Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReIndex now rebases local pending changes #295

Conversation

jleandroperez
Copy link
Contributor

Legacy Re-Index Behavior:

  1. If it's the first time the bucket is sync'ed (that is, pre-existant data before integrating Simperium), the ghostData field is updated with the remote ghost.
    1. If the SPManagedObject instance implements the shouldOverwriteLocalChangesFromIndex selector (and returns YES), we override the local data with the remote data.
    2. Otherwise the object is marked for processing: the delta between the local data and remote data will be sent to the backend, resulting in the local version to be sync'ed to other devices.
  2. If it's not the first time the bucket is sync'ed, and local ghost version doesn't match wit
    h the remote version, local data is overwritten.

We'll be updating this behavior to be consistent with this SPChangeProcessor enhancement.

New Re-Index Behavior:

For each one of the objects in the index, we should:

  1. Calculate Delta: LocalGhost > LocalMembers
  2. Load the full Remote Member Data
  3. If the delta from step (1) is not empty, then let's attempt to rebase + apply localDiff
    3.1. Calculate Delta: LocalGhost > RemoteMembers
    3.2. Transform localDiff: LocalGhost >> RemoteMembers >> LocalDiff (equivalent to git rebase)
    3.3. Attempt to apply the Local Transformed Diff
  4. Update the ghost with the remote member data + version

jleandroperez added a commit that referenced this pull request Jun 18, 2014
…nding-changes

ReIndex now rebases local pending changes
@jleandroperez jleandroperez merged commit 7dfa9cf into issues/291-change-processor-error-handling Jun 18, 2014
@jleandroperez jleandroperez deleted the issues/294-reindex-now-rebases-local-pending-changes branch June 18, 2014 15:29
@jleandroperez jleandroperez mentioned this pull request Jun 30, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant