Search code examples
safariicloudpouchdb

is pouchdb replication compatible with icloud sync?


Does iCloud synchronisation in Safari interfere with PouchDB replication ? A search on Google did not reveal any known issues. What happens to PouchDB's replication when using Safari on multiple devices synchronized over iCloud. Devices may independently go offline or back online at any time. Is there a risk that iCloud synchronisation corrupts PouchDB's replication process ?


Solution

  • Replication cannot get corrupted, but they can create "conflicts".

    The way icloud deals with safari doesn't matter. The only thing that matters is that :

    Conflicts are an unavoidable reality when dealing with distributed systems.

    From the CouchDB guide (works for PouchDB):

    CouchDB does not attempt to merge the conflicting revision. Your application dictates how the merging should be done. The choice of picking the winning revision is arbitrary.

    iCould doesn't sync running processes. After iCloud syncs devices, it will just be a "normal" case of replication failure. If your app automatically sets replication in live mode, it will restart from the current state of the database. If not, you'll have to pull-to-refresh/press-a-button/whatever mecanism your app uses to start a replication process.