This is a tracking issue/roadmap/plan for how I'm going to proceed with adding the ability to synchronize documents. The tasks below correspond approximately to PRs I plan on writing and the order I plan on doing them.
Edit 2017/05/04: Add more detail.
Edit 2017/05/04: Add ideas for optimizing
Edit 2017/07/12: Heavily refactored list to reflect what actually happened, include links to more PRs, and update plan
cc @raphlinus
xi-rope refactoring
Prior to starting this project, the rope and mini-CRDT data structures were mostly undocumented, lightly tested and used some representations that didn't have good time complexity or didn't fit well with turning the mini-CRDT into a full CRDT. The first step of the project was to refactor and replace some of the existing data structures and algorithms and comment and test them.
Fuchsia last-write-wins prototype
As an initial use case of this functionality, implement syncing using ledger for fuchsia/xi.
CRDT Merge operation
Implement the merge function on Engine for histories not involving undo.
Integrate CRDT into Fuchsia
You can now open Xi on two Fuchsia devices and type into both of them concurrently and they will synchronize and reach a consistent state shortly afterward.
Documentation
Improve CRDT robustness and functionality
Make it fast
The above will have terrible awful scaling properties and will slow to a crawl in many use cases. The next step is to figure out ways to improve the CRDT representation and operations to have better time and space complexity. Some of these ideas are well thought out and are clear wins, others are more speculative half-baked ideas (marked by a "馃 ").
This is a tracking issue/roadmap/plan for how I'm going to proceed with adding the ability to synchronize documents. The tasks below correspond approximately to PRs I plan on writing and the order I plan on doing them.
Edit 2017/08/04: 馃摑 馃憗 I wrote a detailed document describing the CRDT
Edit 2017/05/04: Add more detail.
Edit 2017/05/04: Add ideas for optimizing
Edit 2017/07/12: Heavily refactored list to reflect what actually happened, include links to more PRs, and update plan
cc @raphlinus
xi-roperefactoringPrior to starting this project, the rope and mini-CRDT data structures were mostly undocumented, lightly tested and used some representations that didn't have good time complexity or didn't fit well with turning the mini-CRDT into a full CRDT. The first step of the project was to refactor and replace some of the existing data structures and algorithms and comment and test them.
from_unionin a multiset so that it can be computed both forward and backwards in the revision history. Switch to multi-set representation of Subset聽#304 Only store deletes_from_union in Engine聽#312Revision, possiblyEngineand transitive dependencies. Implement serde traits for Engine, Subset, Rope, Revision聽#316Vec<Revision>, I think I may also need aRopelikeEnginebut I haven't readengine.rsyet so I don't quite know how things fit together.Rope, might need a custom serializer to make it serialize as a string or something, serializing the tree structure like a derive would do seems unnecessary.Fuchsia last-write-wins prototype
As an initial use case of this functionality, implement syncing using ledger for fuchsia/xi.
fidlinterface for ledger. Gerrit CL Synchronize Editor state to the Ledger on Fuchsia聽#339CRDT Merge operation
Implement the
mergefunction onEnginefor histories not involving undo.Integrate CRDT into Fuchsia
You can now open Xi on two Fuchsia devices and type into both of them concurrently and they will synchronize and reach a consistent state shortly afterward.
Documentation
Improve CRDT robustness and functionality
Make it fast
The above will have terrible awful scaling properties and will slow to a crawl in many use cases. The next step is to figure out ways to improve the CRDT representation and operations to have better time and space complexity. Some of these ideas are well thought out and are clear wins, others are more speculative half-baked ideas (marked by a "馃 ").
PageWatcherupdate case.Subsets in a rope with an aggregation on number of inserted and deleted characters so that calculations can do things in the middle of the text without being O(n).Enginebeing put in, that will guarantee things are only appended.nis the size of the history after the undo/common prefix. This would definitely be useful for undo because it would allow an arbitrarily long undo history without significant performance degradation, and would effectively allow us to remove the garbage collector.Subsetso that there are lessSubsets to rebase and transform repeatedly inmerge. Like Combine sequential edits with same priority in merge聽#351 but more extreme.