-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add documentation for synchronization algorithm
- Loading branch information
1 parent
cf14d7e
commit 219d163
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# ProfiSync™ | ||
|
||
## Synchronization process | ||
|
||
1. Get all local entities(1) | ||
2. Split into scheduled for deletion(2) with `additionalData=DELETE` and remaining(3) | ||
3. Execute remote and local deletions of 2 | ||
4. Filter 3 into "new" entities(4) with `id=NEW` | ||
5. Upload 4 to remote and adjust `remoteID` of entities | ||
6. Get new list of remaining local entities(5) because `remoteID`s have changed | ||
7. Get remote entities(6) | ||
8. Split 6 into merge conflicts(7) that have a matching `remoteID` in 6 and downloaded lists(8) | ||
9. Store 8 in local database | ||
10. Pair each entity from 7 with the entity with matching `remoteID` from 6(9) | ||
11. 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 | ||
12. Compare server-relevant properties of each item of 10 with the remotely stored version and update if different | ||
13. 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 | ||
|
||
## Common functionality for entities | ||
|
||
* `remoteID` and `additionalData` | ||
* server-relevant comparison | ||
* client-relevant comparison | ||
* database crud | ||
* remote crud | ||
* merging |