3 ms·
There is no way this can work. Merging data changes can inherently not be automated in the general case. Deciding if a change from foo to bar should win over a
by danbruc 12y ago
There is no way this can work. Merging data changes can inherently not be automated in the general case. Deciding if a change from foo to bar should win over a change from foo to baz depends on the semantics of those strings. There are some cases, for example counters, with simple and clear semantics where you can build reusable and robust solutions for. You can also handle the general case with simple policies like last write wins. But there is no way any algorithm will ever be able to figure out whether to choose bar or baz, not at last because I could arbitrarily declare any of the two outcomes correct.
- marknadal 12y agoEvery change can be preserved in a history/append-only/log/stream. So you don't have to "lose" data from another "winning". However, the algorithm will by default select one, you can then code it at the app level for the user to select a new winner. The general case here is very UUID based key/value pairs. Anything beyond that, you should be using CRDTs and OT like algorithms, which I will be building on top of GUN. However, in the meanwhile, I challenge you to try running the example folder from the GitHub ReadMe and seeing if you can break the automated sync and cause data divergence! Edit: This person (in the comments below, please upvote him), and my reply, best addresses the most important questions: https://news.ycombinator.com/item?id=9077969 https://news.ycombinator.com/item?id=9077969