LawrencePeng's Blog

专注收集代码小精灵

TreeDoc 好用的CRDT For String

TreeDoc是CRDT。不熟悉CRDT的可以看我之前的文章。

TreeDoc解决了CRDT中常见的atomid的开销问题,其创新式的用BinaryTree表示一个任意一个有序的atomic。方法就不多赘述了,传统的BT编码模式+一些Tricks。

TreeDoc最有贡献的就是实现了explode/flatten的操作,对于没有并发冲突的部分,flatten为没有atomid 的数组,减少了Overhead。当有并发冲突的时候再explode为BinaryTree。

当然最后的Related work对于OT的描述很解毒。

Operational transformation (OT) considers collaborative
editing based on non-commutative operations. To
this end, OT transforms the arguments of remote operations
to take into account the effects of concurrent executions. OT
requires two correctness conditions : the transformation
should enable concurrent operations to execute in either
order, and furthermore, transformation functions themselves
must commute. The former is relatively easy. The latter is
more complex, and Oster et al. prove that all previously
proposed transformations violate it. Later solutions [14–16]
are complex, and their correctness is hard to verify.
OT attempts to make non-commuting operations commute
after the fact. We believe that a better approach is to design
operations to commute in the first place. This is more
elegant, and avoids the complexities of OT.

blog要发展为morning paper的感觉了。