开发者

Can off-line changes in seperate client-side IndexedDB databases be merged when the browsers get back on-line?

开发者 https://www.devze.com 2023-02-06 16:49 出处:网络
IndexedDB in Firefox 4 allows us new potential for making apps for client-side database querying and storage, while both off-line and on-line. This is a very new alternative and very interesting, sinc

IndexedDB in Firefox 4 allows us new potential for making apps for client-side database querying and storage, while both off-line and on-line. This is a very new alternative and very interesting, since my organization is split across many countries with poor on-line web service.

Big picture: “IndexedDB allows web apps to store large amounts of data on your local system (with your explicit permission, of course) for fast offline retrieval at a later time.”

My problem:开发者_如何学Python

I don't understand the following.

  1. How off-line changes in a client-side database, say in Haiti, can then be merged with a central Washington DC database?

  2. Or even, how would 3 separate database changes on 3 clients in Haiti get synced with one another? Perhaps it is impossible?

  3. What are the benefits and limits of such a client-side database?


Your questions are spot on and sum up some of the challenges of data reconciliation. All in all, this is possible but I wouldn't recommend attempting it alone. In the database space, apps like CouchDB are working on this and show that it's somewhat of a Hurculean task.

Merging data across object stores means you're going to need a lot of application logic to pull it off elegantly. For example, what happens when two offline apps update the same row? You'd have a "merge conflict" and this kind of situation is why source control applications like Git are so complex.

To implement this idea, you might take a chip of the Git block and use "event sourcing" as a way to roll through changes. I'm working with a similar concept in IDB and it works quite nicely. Worth noting, I am not trying to merge changes across object stores but rather manage revisions in a single object store, so your task would be considered significantly more complex.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号