Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

That's why relative positions are not used in CRDTs in the absolute sense. Entities are added via IDs and operations are recorded via IDs. If user one deletes line 3 and user 2 deletes line 4, user one will see lines 1, 2 and 5 and onwards. The commands that are captured by CRDTs only operate on the state of the document as the user sees it at the time, their own changes might be overwritten later during a merge, but their changes won't interfere with parts they were not destined to interfere with.


You seem to still not be getting it. Here’s the original online document:

> 1. Please delete line 3.

> 2. Blank line

> 3. This is line 3

> 4. This is line 4.

User 1 is accessing the document offline, sees the instruction on line 1 and changes their local copy to:

> 1. Please delete line 3

> 2. Blank line

> 3. This is line 4

User 2 concurrently changes the document to update the instruction:

> 1. Please delete line 4

> 2. Blank line

> 3. This is line 3

> 4. This is line 4

When user 1 & user 2 merge their documents, they’ll get:

> 1. Please delete line 4

> 2. Blank line

> 3. This is line 4

You can also split this into two documents with a similar effect (one contains instructions, the other contents). The point is that it’s not about how changes are represented. It’s that the logical and semantic structure isn’t represented in the CRDT and thus while some eventually consistent result is attained by all nodes, the logical and semantic structure may end up broken. That’s why you generally don’t see CRDTs for code editors - the merge conflicts still need to be resolved by hand and doing it automatically can result in worse and harder to understand results than normal.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: