continuing from Connecting food cooperatives (since product sync is becoming too specific for the general connecting foodsoft interoperability thread.
The OFN rest API provides means to post and retrieve product data. In order to repliacate data between OFN instances and/or offline apps some kind of data synchronization protocoll/handshake is necessary.
-
How to efficiently determine that there are no new product changes to download? (instead of simply deleting and re-downloading all products again) There is a last_modified column in the database tables but it does not seem to be exposed via the api?
-
How to detect/handle the case when both parties changed the same
product (field) between a sync? There are two versions in this case that
would need some automatic or manuall merge/resolve strategy…?
Maybe some sync like git pull && local merge && git push
What do you think?
Does sync create more complexities than just doing realtime queries? Or, why create copies of the relevant data?
Good point.
Why additional complexification of two-way syncing instead of simply querying a central server in real-time?
In our specific case: there is an offline mobile app in a food storage cellar with unreliable wifi reception. Currently a lot of foodhub data is stored on this single device and needs to be exported and backuped manually via bluetooth or email. With OFN as a backend everyone could access and contribute information conveniently from home via web browser. But a dependence on connectivity could disrupt the food checkout experience.
More generally: a decentralized (open food) network topology distributes economic power more evenly. Communicating data changes between federated (partial) copies of data makes the network more resillient against social/data corruption and communication/connectivity interruption. Regionally neighbouring OFN instances might want to synchronize overlapping data to multiply network effects and share synergies…
Is it worth the complexitiies (short-term)? Not sure, but I’m excited about the topic and would like to give it a try That’s why I’m curious what you think about it!
@orangeman - i have done this kind of work with spree before. it is trivial to expose the ‘updated_at’ property in the spree api and to allow you to query it. then you can return only the changed records.