Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper to generate OTs between two states? #17

Closed
ronag opened this issue Mar 1, 2016 · 4 comments
Closed

Helper to generate OTs between two states? #17

ronag opened this issue Mar 1, 2016 · 4 comments

Comments

@ronag
Copy link

ronag commented Mar 1, 2016

Are there any available helpers for e.g. calculating the required OTs between two strings?

@ronag ronag closed this as completed Mar 1, 2016
@ronag ronag reopened this Mar 1, 2016
@curran
Copy link

curran commented Aug 31, 2016

@curran
Copy link

curran commented Jul 14, 2018

@ronag This library does exactly what you describe, and more https://github.com/kbadk/json0-ot-diff

@josephg
Copy link
Member

josephg commented Jul 14, 2018

Its also a bad idea in my opinion.

The problem is that there are often multiple ways you could transform one object into another - for example, the list [1,2,3] could be transformed into the list [1,3,2] either by replacing the list, moving the 3 backwards, moving the 2 forwards, deleting the 2 and reinserting it or deleting the 3 and reinserting it. The OT code will do slightly different things in the face of concurrent edits in all of these cases, to preserve the intent of the user. Eg, if I concurrently insert something between the 2 and the 3 while you make your change, what do you think the resulting list should look like? The answer often differs based on the intent of your edit!

@josephg josephg closed this as completed Jul 14, 2018
@curran
Copy link

curran commented Jul 16, 2018

@josephg Here's a context where this feature would be useful - generating "meta-ops" that bounce across distant versions for computing a snapshot of a desired version efficiently - See share/sharedb#223 .

image

In this context, it doesn't matter which of the possible ways of transforming one object into another is used. As long as they do transform correctly when applied.

The concerns you raise relate only to the case of concurrent edits, which is IMO not where this feature would be used.

Anyway it's great to hear your voice here! Thanks for your work around ShareDB and OT, it's a great foundation for lots if interesting product features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants