-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add room storage for Django Channels Consumers #94
base: main
Are you sure you want to change the base?
Conversation
…ss for clarity and consistency docs(yroom_storage.py): clarify comments regarding YRoomStorage instances and document updates for Django Channels Consumers
…class as load_snapshot
Add room storage for Django Channels Consumers
@davidbrochart FYI: @cacosandon has been working on this as a big upgrade to #84 that I worked on a while ago. It is a significant improvement to usability and functionality of using all of this with Django/Channels in my opinion. It does introduce some breaking changes to the Channels interface (moved the class to a folder, removed one method), but nothing too serious. I already reviewed the work and it works well for our case at Dart. Would love to support getting this merged however possible, just let me/us know! |
Thanks @cacosandon and @zswaff for working on this. |
Makes sense to me! I think this PR will be just as good for that repo. I didn't know about the change. Are you planning to archive these repos and update the docs to point people to the new ones? |
I don't think so, ypy is looking for maintainers. |
Thanks @zswaff! @davidbrochart, I've just created this same PR in your repository following the library changes. It works perfect too! jupyter-server/pycrdt-websocket#25 |
This PR introduces a shared storage for consumers within Django Channels.
Initially, each YjsConsumer had its unique YDoc, updating only from its client. This approach caused issues, such as consumers having different YDoc versions that made difficult to update to a persistent storage.
Now, by inheriting from
BaseYRoomStorage
, a unified storage can be utilized across all consumers and server-wide (e.g., in a Django Celery Job).The storage's function, detailed in the documentation, is to manage document changes—fetching, updating, and saving them to a single source. An implementation example features Redis for ephemeral and Postgres for permanent storage.
Each user can define their own storage. Maybe using Django Cache, custom Redis or no storage at all (and just use it to broadcast updates from their connected clients). We just define the interface.
I would like to add some tests too 🤔 but not sure how.