-
Notifications
You must be signed in to change notification settings - Fork 456
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
API for history management #12
Comments
This would be fantastic. |
Any proposed API? The MongoDB discussion made me wonder if keeping the ops is such a great way to keep history. Wouldn't it be better to keep some snapshots of historical versions and remove ops between snapshots? Alternatively, have an OT optimizer comb through ancient ops and combine them intelligently. (e.g. ops submitted by a single client in a short period of time could be combined into a single diff op) |
@rileydutton said:
|
So I guess it is currently not possible to a snapshot of a document at a given version? :-/ My use case is as follows: |
In your case that's exactly how I would do it, but I'd keep a snapshot of a while ago to use as a starting point in the auth function. On Jun 2, 2013, at 22:09 , mluto notifications@github.com wrote:
|
I'm using ShareJS for a social science study and need to view past revisions of a document. Even without a history API, what's the easiest way to replay a sequence of ops to view a past revision of a document? Are there any demo apps where one can just pull a slider and view the document over time? Is it possible to apply ops "backwards"? |
https://github.com/shownotes/show-pad/blob/asyncnoter/src/documenttypes/asyncnoter.js#L258 |
@luto That's super useful! Thanks a million times. |
Let me know when you built something nice :) |
I've been integrating ShareJS into Meteor: http://documents.meteor.com/. If you haven't heard of Meteor yet, it's a crazy efficient framework for making real-time web apps. However it doesn't support OT yet so I needed to cook something together so people could do real-time docs. I also need to view the history of those docs later. My package https://github.com/mizzao/meteor-sharejs currently supports ShareJS editors in meteor apps and will support history scrubbing as well once I get your code integrated! |
Thats cool! Yeah what @luto did is about right - just grab the operations and apply them one at a time from the start. (Or in his case, invert them and apply them in reverse order). |
@josephg and @luto, I'm not that familiar with the ShareJS code so maybe you can answer a quick question for me. If I am using redis as a datastore for ShareJS, does it store all the ops starting from version 0, or does it combine ops into snapshots for faster playback later? The latter would clearly be faster from an implementation perspective but would cause history to be lost and not be viewable. I guess the optimal implementation would be to store occasional snapshots along with all ops which would allow any revision to be accessed in O(log n) time and O(log n) space...but not sure if that's what you guys did. |
It stores every op starting at version 0. And yeah - if you want to be able to efficiently see any version, keyframes is the right answer. But if you don't want them, they will blow out your database size significantly. Also please ask questions like that on the mailing list. |
Related discussion on the mailing list: accessing version history (for read-only timeslider functionality). |
getOps should be exposed in the REST and socket.io interfaces, so the client can request historical operations for timeline views and things like that.
The text was updated successfully, but these errors were encountered: