当浏览器重新上线时,可以合并单独客户端 IndexedDB 数据库中的离线更改吗?
Firefox 4 中的 IndexedDB 为我们开发应用程序提供了新的潜力客户端数据库查询和存储,离线和在线均可。这是一个非常新的选择,也非常有趣,因为我的组织分布在许多在线网络服务较差的国家/地区。
大局: “IndexedDB 允许 Web 应用程序存储大量数据本地系统上的数据(当然需要您的明确许可),以便稍后快速离线检索。”
我的问题:
我不明白以下内容。
如何将客户端数据库(例如海地)中的离线更改与华盛顿特区的中央数据库合并?
甚至,海地 3 个客户端上的 3 个独立数据库更改如何相互同步?也许这是不可能的?
这样的客户端数据库有什么好处和限制?
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:
I don't understand the following.
How off-line changes in a client-side database, say in Haiti, can then be merged with a central Washington DC database?
Or even, how would 3 separate database changes on 3 clients in Haiti get synced with one another? Perhaps it is impossible?
What are the benefits and limits of such a client-side database?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题很切题,总结了数据协调的一些挑战。总而言之,这是可能的,但我不建议单独尝试。在数据库领域,像 CouchDB 这样的应用程序正在致力于解决这个问题,并表明这是一项艰巨的任务。
跨对象存储合并数据意味着您将需要大量应用程序逻辑来优雅地完成它。例如,当两个离线应用程序更新同一行时会发生什么?你会遇到“合并冲突”,这种情况就是为什么像 Git 这样的源代码控制应用程序如此复杂。
为了实现这个想法,您可以使用 Git 块的一部分并使用“事件源”作为滚动更改的方法。我正在使用IDB 中的类似概念,而且效果非常好。值得注意的是,我并不是尝试合并跨对象存储的更改,而是管理单个对象存储中的修订,因此您的任务将被认为更加复杂。
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.