Git Product home page Git Product logo

Comments (15)

aribn avatar aribn commented on August 22, 2024

This would be fantastic.

from sharejs.

wmertens avatar wmertens commented on August 22, 2024

I guess this means #62 and #63 are dupes and should be closed?

from sharejs.

wmertens avatar wmertens commented on August 22, 2024

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)

from sharejs.

wmertens avatar wmertens commented on August 22, 2024

@rileydutton said:

It would be especially useful if along with each version I could get the date/time it was created and the person who modified it (based on the new agent_id information), although those are certainly not necessary.

from sharejs.

luto avatar luto commented on August 22, 2024

So I guess it is currently not possible to a snapshot of a document at a given version? :-/
How would one do this internally? Calling getOps to get everything from revision 0 to x and then applying all the ops seems to be stupid from a performance point of view (or the other way around if x > currentVersion / 2).

My use case is as follows:
A client wants submit an op, it depends on the state of the document whether they are allowed to do so. A op is not yet transformed when auth is called, so I need to get the document at the version action.v.

from sharejs.

wmertens avatar wmertens commented on August 22, 2024

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 [email protected] wrote:

So I guess it is currently not possible to a snapshot of a document at a given version? :-/
How would one do this internally? Calling getOps to get everything from revision 0 to x and then applying all the ops seems to be stupid from a performance point of view (or the other way around if x > currentVersion / 2).

My use case is as follows:
A client wants submit an op, it depends on the state of the document whether they are allowed to do so. A op is not yet transformed when auth is called, so I need to get the document at the version action.v.


Reply to this email directly or view it on GitHub.

from sharejs.

mizzao avatar mizzao commented on August 22, 2024

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"?

from sharejs.

luto avatar luto commented on August 22, 2024

https://github.com/shownotes/show-pad/blob/asyncnoter/src/documenttypes/asyncnoter.js#L258
My dirty solution. There is no demo and it won't run without the rest of the app, though. Feel free to copy.

from sharejs.

mizzao avatar mizzao commented on August 22, 2024

@luto That's super useful! Thanks a million times.

from sharejs.

luto avatar luto commented on August 22, 2024

Let me know when you built something nice :)

from sharejs.

mizzao avatar mizzao commented on August 22, 2024

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!

from sharejs.

josephg avatar josephg commented on August 22, 2024

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).

from sharejs.

mizzao avatar mizzao commented on August 22, 2024

@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.

from sharejs.

josephg avatar josephg commented on August 22, 2024

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.

from sharejs.

curran avatar curran commented on August 22, 2024

Related discussion on the mailing list: accessing version history (for read-only timeslider functionality).

from sharejs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.