Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See jupyterlab/jupyterlab#16008.
This PR adds an
ISharedDocument.provider
attribute, which is anIDocumentProvider
and which represents the current provider for the document. TheIDocumentProvider
interface is moved fromjupyter-collaboration
tojupyter_ydoc
(see jupyterlab/jupyter-collaboration#239). I think this is fine sincejupyter-collaboration
depends onjupyter_ydoc
. AYDocument
can only have one provider at a time (as before), but the provider can change over time. This is typically done when forking a document: the initial provider (set by theYDrive
) connects to the root document, and the new provider connects to the forked document.An
ISharedDocument
has a root room IDrootRoomId
which is set when first connecting to the root room, and a current room IDcurrentRoomId
which can be the root room ID or any other fork of the root room. This way we can say if the document is currently on a fork or on the root, and we know to which (root) room to merge when on a fork.An
ISharedDocument
has anaddFork(forkId)
method that sets a keyfork_{forkId}
on the Y document'sstate
when the provider is asked to fork. This is a way to advertise all the forks of this document, so that any client viewing the document can be notified of a new fork and can connect to it.