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

Yjs Electric provider example #1508

Merged
merged 47 commits into from
Dec 9, 2024
Merged

Yjs Electric provider example #1508

merged 47 commits into from
Dec 9, 2024

Conversation

balegas
Copy link
Contributor

@balegas balegas commented Aug 10, 2024

A basic codemirror example with Yjs using Electric for sync.

I have removed a lot of stuff I've done in this example to just have the bare minimum. The provider shall work with persistence backend and broadcasting, but right now I removed all that code to keep the ElectricProvider to the bare minimum. I'll add back support for that when I publish the provider.

TODO

  • Readme
  • Review and publish ElectricProvider
  • Better App
  • Deployment: Provide the pooled url; fix issues with serverless deployment or setup a NextJs server

@balegas balegas force-pushed the balegas/yjs-electric branch from bf6c572 to 64e62a6 Compare August 10, 2024 01:00
Copy link
Contributor

@KyleAMathews KyleAMathews left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work!

examples/nextjs-yjs-codemirror/README.md Outdated Show resolved Hide resolved
examples/nextjs-yjs-codemirror/app/y-electric.js Outdated Show resolved Hide resolved
@balegas balegas force-pushed the balegas/yjs-electric branch from 551382b to af02df3 Compare August 13, 2024 16:53

This comment was marked as outdated.

This comment was marked as outdated.

@balegas balegas force-pushed the balegas/yjs-electric branch 7 times, most recently from 6164404 to 1faec98 Compare August 15, 2024 00:51
@balegas balegas changed the title WIP: Yjs-Electric Codemirror demo WIP: Yjs-Electric provider example Aug 15, 2024
@balegas balegas changed the title WIP: Yjs-Electric provider example Yjs Electric provider example Aug 15, 2024
@balegas balegas requested a review from samwillis August 20, 2024 08:25
@balegas balegas self-assigned this Aug 20, 2024
@balegas balegas marked this pull request as ready for review August 20, 2024 08:26
@balegas
Copy link
Contributor Author

balegas commented Aug 20, 2024

Experimental compaction of YDoc
I've implemented compaction on the server by creating a new Ydoc, truncating the table and storing the new Ydoc. The truncation causes a shape rotation that will essentially clear the shape and start fresh from the Ydoc checkpoint.

This obviously isn't a complete implementation as the TRUNCATE also deletes all other Ydocs that we might be storing :D. The idea was to demonstrate the use of shape rotation to clear the log of operations. We should think if we want to expose the delete shape endpoint on the backend or not. The proxy could disallow any requests coming from the user.

EDIT: reflecting a bit more, maybe the best is to leave this out because we'll be able to do compaction a lot better in the future.

@balegas balegas force-pushed the balegas/yjs-electric branch 2 times, most recently from 7f083e3 to 567c81d Compare August 23, 2024 08:07
@balegas balegas force-pushed the balegas/yjs-electric branch 2 times, most recently from 71ff836 to aa1c46b Compare November 18, 2024 11:25
@balegas balegas force-pushed the balegas/yjs-electric branch from 232fcbf to ea1be12 Compare December 3, 2024 00:08
@balegas balegas force-pushed the balegas/yjs-electric branch from ea1be12 to b53d87b Compare December 3, 2024 23:38
@balegas balegas force-pushed the balegas/yjs-electric branch from 239ae2f to 564cded Compare December 3, 2024 23:54
@balegas balegas force-pushed the balegas/yjs-electric branch from 4df734b to 88b4920 Compare December 9, 2024 13:10
@balegas balegas merged commit 35006dd into main Dec 9, 2024
30 of 32 checks passed
@balegas balegas deleted the balegas/yjs-electric branch December 9, 2024 13:31
thruflo pushed a commit that referenced this pull request Dec 9, 2024
A codemirror example with Yjs using Electric for sync

Contains an Y-Electric connection provider that we will extract and ship as a separate package.
thruflo pushed a commit that referenced this pull request Dec 9, 2024
A codemirror example with Yjs using Electric for sync

Contains an Y-Electric connection provider that we will extract and ship as a separate package.
thruflo pushed a commit that referenced this pull request Dec 10, 2024
A codemirror example with Yjs using Electric for sync

Contains an Y-Electric connection provider that we will extract and ship as a separate package.
thruflo pushed a commit that referenced this pull request Dec 10, 2024
A codemirror example with Yjs using Electric for sync

Contains an Y-Electric connection provider that we will extract and ship as a separate package.
samwillis pushed a commit that referenced this pull request Dec 10, 2024
A codemirror example with Yjs using Electric for sync

Contains an Y-Electric connection provider that we will extract and ship as a separate package.
thruflo pushed a commit that referenced this pull request Dec 10, 2024
A codemirror example with Yjs using Electric for sync

Contains an Y-Electric connection provider that we will extract and ship as a separate package.
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

Successfully merging this pull request may close these issues.

3 participants