top | item 33823278

(no title)

nathansobo | 3 years ago

We honestly don’t solve it yet, but haven’t found it that big of an issue in practice. Would be curious to see the best resource on it.

discuss

order

josephg|3 years ago

I remember reading about it in one of Martin Kleppmann’s papers, though I can’t remember which one.

It’s an ordering problem that comes from some of the simpler ordering algorithms. For Diamond types I’m using a variant of Yjs’s ordering. But even RGA doesn’t have this problem because each character’s insert location is specified by naming the character immediately to the left when that character was typed.

This repository implements a few different list CRDTs using an insertion sort approach, where the algorithm scans for the appropriate location every time an insert happens. This is the scanning function for RGA (automerge’s algorithm):

https://github.com/josephg/reference-crdts/blob/fed747255df9...

And this is an interactive visualisation of how diamond types works (which uses Yjs’s algorithm instead), complete with run-length encoding: https://home.seph.codes/public/diamond-vis/