Re: [whatwg/storage] "syncable" storage? (#1)

Reconciliation really is the insurmountable problem. Syncing generally always requires require application-specific logic.

Lets take the most trivial imaginable. A consisting of 100 levels. The game stores a single numeric value, the level that user has reached.

Say that we simply sync the last updated copy of the full database.

1. The user play the game on their phone and reach level 10.
2. This value gets synced across all devices.
3. The user then play the game on their tablet while the tablet is offline, reaching level 20.
4. The next day the user opens the game on their phone again, which is still at level 10 since the tablet is still offline.
5. The user immediately realize that the progress from the tablet has not yet synced and so close the game. However the game always flushes to disk whenever closed and so the value 10 is written to the database.
6. The user opens the tablet and connects it to the internet so that it can sync, hoping to sync the progress across all devices.
7. Instead the value 10, which has a later modification date, is synced to the tablet.
8. User is sad because game is now back to level 10 everywhere.

Even in this extremely trivial example, where the database consists of only a single value, application specific logic is needed in order to know that the highest value is the right one, not the latest value.

There's really no way to do this automatically. Consider if the user decided to play one level in step 5 rather than closing immediately. There's no way to do this per-box or per-database in order to simplify the problem to the point that it can be handled by the UA.

If data has been modified in two locations we simply have to expose both the server-side data and the local data to the webpage and let it decide how to merge the two.

In practice I would also expect performance to make it impossible to sync automatically.


There are various solutions to this problem. With different APIs exposed to the client, and with different amounts of flexibility on what data can be stored and how.

I'd definitely think that we should reach out to people that have worked on database syncing. This is a really complex area and we should not invent our own thing, but rather leverage experience that already exist.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/storage/issues/1#issuecomment-204540951

Received on Friday, 1 April 2016 19:48:28 UTC