| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
原始链接: https://news.ycombinator.com/item?id=44053560
Hacker News 的讨论围绕着一种协同文本编辑算法展开,该算法避免了传统的 CRDT 和 OT。其核心思想是为每个字符分配全局唯一的 ID,并使用中心服务器根据这些 ID 来序列化“插入到之后”的操作。删除操作通过隐藏字符来处理,保留字符以用于定位。 一些评论者认为,由于中心服务器在解决冲突中的作用,这是一种简化了的或“退化的”CRDT,而另一些人则认为它与 CRDT 不同,因为它缺乏离线保证收敛的能力。关于性能、可扩展性和使用客户端 ID 或时间排序的 UUID 来解决冲突的潜力展开了辩论。讨论还探讨了撤销/重做的复杂性,以及当中心服务器已经提供排序时,CRDT 或 OT 是否真正必要。还提到了将其扩展到其他数据结构(如映射和数组)的可能性。一些网友认为这种方法并不新颖,只是一种简单的方案,并且存在单点故障的隐患。
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
- Label each text character with a globally unique ID (e.g., a UUID), so that we can refer to it in a consistent way across time - instead of using an array index that changes constantly.
- Clients send the server “insert after” operations that reference an existing ID. The server looks up the target ID and inserts the new characters immediately after it.
- Deletion hides a character for display purposes, but it is still kept for "insert after" position purposes.
This might have potential outside text editing. Game world synchronization, maybe.
reply