4 ms·
Do you have any document that explain what resolution algorithm uses in what cases? For example, one peer change a property value and the other peer deletes it
by josemaenzo 7y ago
Do you have any document that explain what resolution algorithm uses in what cases?
For example, one peer change a property value and the other peer deletes it.
- marknadal 7y agoSame algorithm for everything. This cartoon explains it: https://gun.eco/distributed/matters.html https://gun.eco/distributed/matters.html It is a vector + timestamp + lexical sort. A delete is changing a value to `null`, it would lose (I assume you are asking if/when these 2 changes happen at the exact same microsecond time, conflicting?) as is it has a lower lexical rank.
- josemaenzo 7y agoCan you refer me to a document where you explain the "lexical rank" that you are referring to? The cartoon explanation do not tackle those terms.
- marknadal 7y agoJSON.stringify('a') < JSON.stringify('z') https://en.wikipedia.org/wiki/Lexicographical_order https://en.wikipedia.org/wiki/Lexicographical_order
- josemaenzo 7y agoCool! Make sense. Let's say our state have an array like ['a','b']. What about if Peer-A splice the first element (0) which results in ['b'] and Peer-B wants to mutate 'a' to 'A' which results in ['A','b'] and they both make the mutation at the same millisecond?
- marknadal 7y agoYou have to choose which type of Array: 1. An atomic Array 2. Fixed index Array 3. Linked list Now rather than not knowing what magic is going to happen, app developers know what to expect in advance. So atomic would choose one or the other, not a combined result. Fixed array 2nd item to 1st which nulls 2nd and makes 1st b, simultaneously also makes 1st A. Cause lower case b is lexically larger than A, you'd get [b, null]. Linked list theoretically could handle it as you suggest.
- josemaenzo 7y agoDoes gun have a built-in "Linked list" in the API? If so, where are the docs? Could not find them. If not, any paper or doc that explain how to implement it with gun?
- marknadal 7y agoStarted, but never finished. :( @nmaro has some pretty good stuff. The cartoon explainers gives an overview. But you'd probably want to do RGA algorithm or one of the newer ones. Martin Kleppmann has a pretty good talk with bunch of paper references: https://youtu.be/yCcWpzY8dIA https://youtu.be/yCcWpzY8dIA
- josemaenzo 7y agoOh, I see. Just wondering, How GUN handle a situation like described above when working with Arrays?