ottypes / json0

Version 0 of the JSON OT type
447 stars 64 forks source link

Interesting Cursor Transform Work by Robert Lord #27

Open curran opened 5 years ago

curran commented 5 years ago

Faced with the challenge of implementing presence for text0 strings embedded deep within json0 documents, I was perusing the json0 forks network and stumbled upon this quite interesting work by @lord.

I don't fully understand what the changes here are really doing, but I have a suspicion it may be an interesting lead. I'm creating a PR so it's easy to see the changes, and any interested parties can discuss here.

Related:

houshuang commented 5 years ago

Amazing find, looks like this handles all the built-in json0 functionality, including text0, and sub-paths (and tests)!... However it doesn't delegate to subtypes... I'll try to merge my work with this to get the best of both.

On Tue, Apr 9, 2019 at 3:02 PM Curran Kelleher notifications@github.com wrote:

Faced with the challenge of implementing presence for text0 strings embedded deep within json0 documents, I was perusing the json0 forks network https://github.com/ottypes/json0/network and stumbled upon this quite interesting work by @lord https://github.com/lord.

I don't fully understand what the changes here are really doing, but I have a suspicion it may be an interesting lead. I'm creating a PR so it's easy to see the changes, and any interested parties can discuss here.

Related:


You can view, comment on, or merge this pull request online at:

https://github.com/ottypes/json0/pull/27 Commit Summary

  • Add cursor movement tests
  • Pass string cursor transform operations
  • Pass object cursor transform operations
  • Add list insert delete and movement
  • Fix transformCursor to point to correct transformPosition
  • Remove subtype test
  • Update package to be json00
  • Add logo to readme
  • v2 add e key on ops for event data

File Changes

Patch Links:

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ottypes/json0/pull/27, or mute the thread https://github.com/notifications/unsubscribe-auth/AADwhzGFKL-oHrMweRu6MJQjAT2ujRsqks5vfI96gaJpZM4ckcci .

-- http://reganmian.net/blog -- Random Stuff that Matters

lord commented 5 years ago

Oh jeez, this was from a long time ago! Happy to answer whatever questions I can about it, but honestly considering how little I remember, you're basically reading the code with the same eyes that I am.

houshuang commented 5 years ago

@lord Thanks for sharing. Do you have any code, or even snippets, of where you were using these functions (generating events etc, displaying in the UI etc)? I'm trying to wrap my head around how this interacts with the ideas from the @teamwork approach to shared cursors/presence, they also use transformCursors, but they had to fork ShareDB to add a concept of presence, which you did not (I'm assuming?).

Thanks!

lord commented 5 years ago

Yeeea, I can try to find some code, but no promises. IIRC my concept of presence was represented as JSON objects in the doc itself, which were automatically added and removed when clients joined and left by some Feathers.js hook?