Did you meet Torben at the wave summit? He took me through his way to
mitigate this problem. He describes it briefly here:
https://github.com/josephg/lightwave/blob/master/ot/README

In short, give every operation a unique hash. Each peer stores its own
(transformed) history list.

When two peers sync with each other, they need to figure out which
operations they are each missing (still not sure what the best way to
do this is). They send missing operations to one another, with some
context.

Locally, imagine I've applied:
X A' B' C
and I want to sync with a peer which has ops:
A B D
... Obviously, I need to apply D locally. But I don't have an X' that
I can transform D by! We can solve this by rewriting our history.

So Torben came up with the idea of a prune function (inverse
transform). Then we can define:

swap = (a, b) ->
  b' = prune(b, a)
  a' = transform(a, b')

I can use that to take my local history:
X A' B' C
and swap X past A B to get:
A B X' C
Then I can transform D by X' C to get D', that I can apply locally.

I don't need to re-save the new operation history if I don't want to -
A B X' C D' is just as valid as X A B C D'. I think there's some
clever decisions we can make there to decrease the number of
transforms that the network will need to perform.

I made a proof-of-implementation last week, and it works & converges.
(It was really exciting, even though Torben beat me to the punch a
couple of years ago):
https://github.com/josephg/tp2stuff/blob/master/node.coffee

-J


On Wed, Jun 12, 2013 at 9:38 AM, Michael MacFadden
<michael.macfad...@gmail.com> wrote:
> Other ways to mitigate this are interesting areas of research.
>
>
> ~Michael

Reply via email to