- Get all local entities(1)
- Split into scheduled for deletion(2) with
additionalData=DELETE
and remaining(3) - Execute remote and local deletions of 2
- Filter 3 into "new" entities(4) with
id=NEW
- Upload 4 to remote and adjust
remoteID
of entities - Get new list of remaining local entities(5) because
remoteID
s have changed - Get remote entities(6)
- Split 6 into merge conflicts(7) that have a matching
remoteID
in 6 and downloaded lists(8) - Store 8 in local database
- Pair each entity from 7 with the entity with matching
remoteID
from 6(9) - Merge the pairs from 9 to a single entity(10) and update the timestamp in
additionalData
- If a property only exists locally, use the local property and vice versa
- If a property exists both locally and remotely then use the values from the entity with higher timestamp
- Compare server-relevant properties of each item of 10 with the remotely stored version and update if different
- Compare client-relevant properties of each item of 10 with the locally stored version and update if different
- The comparison could be omitted because SQLite performance is not a concern
remoteID
andadditionalData
- server-relevant comparison
- client-relevant comparison
- database crud
- remote crud
- merging