4 ms·
Lexical comparison is only used when 2 writes happen at the exact same time. Yes, it is a very basic hybrid vector/lexical/timestamp CRDT. The naive-ness of it
by marknadal 10y ago
Lexical comparison is only used when 2 writes happen at the exact same time.
Yes, it is a very basic hybrid vector/lexical/timestamp CRDT. The naive-ness of it is also its power, because it has strong eventually consistent guarantees.
However, it is intended to be the base case. You can build your own custom CRDTs on top to handle more specific business logic. For instance adding a DAG, a ledger, a simple linked list, etc. gun's default algorithm is not a silver bullet but it does "just work" out of the box for many web cases. See more here: https://github.com/amark/gun/wiki/Conflict-Resolution-with-Guns https://github.com/amark/gun/wiki/Conflict-Resolution-with-G... .
Please especially read about our CAP tradeoffs (see the sidebar on the wiki).
Finally, it should be noted that because gun uses a graph data structure, JSON.stringify only ever applies to atomic primitive values (not complex/compound objects). So it is safe to apply (it is NOT safe to apply to complex objects).
- sagichmal 10y ago> Lexical comparison is only used when 2 writes happen at the exact same time. But you take time from the system. Your writes may converge, but to an nondeterministic state.
- marknadal 10y agoNo, because we then offset it with a vector relative to the machine, even the great Kyle Kingsbury (Aphyr of Call Me Maybe Jepsen tests) tweeted about us about this fact (that we assume/treat time as being loose/unsafe): https://twitter.com/aphyr/status/646302398575587332 https://twitter.com/aphyr/status/646302398575587332 .