What are good options to synchronize app data on the client with the gaia hub?
I see use cases
for progressive web apps that store data offline in localStorage
for native apps that use the device storage first and then schedule synchronization
for collections that work for well established data sets like address book, calendar,… that have already a sync protocol like webdav/carddav/caldav
Should some version meta data be added to the files (like for webdav)? Maybe only in the header. This would also help to identify encrypted files vs unencrypted files.
Should gaia support rsync protocol?
Should each developer solve the problem individually by adding version numbers in the data (on the client)?
The way we handle synchronization currently is that a user’s Gaia hub is capable of serializing requests as they come in, and this is really all that it will do (i.e., it implements last-writer-wins). Synchronization between multiple devices can be (and in some sense, must be) handled by the client. A library could be used to support this synchronization, but for the moment, I don’t know if such a library exists. As far as supporting it in Blockstack’s libraries (like blockstack.js), I think that approach would be a mistake, as this seems like something a community or otherwise supported library could implement on top of the simple interface currently provided.
@friedger I’m late to this, but it’s a great question and something I’ve been considering for a while now. Stealthy’s use case can be significantly aided by both synchronization and use of async local storage. At a minimum we to employ dist. computing 101 techniques (time stamp, basic merge etc.).
I appreciate @aaron’s answer b/c it gives me the freedom as a dev to implement what I want without being encumbered or forced into a strategy that isn’t performant to my use case.
For Stealthy, there are two main considerations:
backing up operations in a local session when connectivity to GAIA is poor
synchronizing across multiple sessions
Ultimately we’ll likely roll a lightweight js class that makes sense for us and may employ existing solutions for some of the problems, with a more distant view towards sharing it with the community in its own package.