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

Linked documents #262

Open
mweidner037 opened this issue Jul 16, 2023 · 0 comments
Open

Linked documents #262

mweidner037 opened this issue Jul 16, 2023 · 0 comments
Labels

Comments

@mweidner037
Copy link
Collaborator

Many apps require multiple documents (CRuntimes), so that different parts of the app can have different permissions, be loaded independently, be stored in different places, etc.

Sometimes these documents are linked to each other. E.g.:

  1. A main document could store a CPresence for shared cursors in a separate document, so that CPresence heartbeats don't cause the main document to re-save constantly.
  2. A large text CRDT could be split into sub-documents for different sections so that they don't all have to load at once. It's easiest if the sub-documents all use Positions from a single CPositionSource, which would live in a separate always-loaded document.
  3. One text document hyperlinks to a section in another text document.

To make 1 & 2 possible, we would need a way to link documents' causal orders. In case 1, a shared cursor movement in the CPresence doesn't make sense until you receive causally prior operations that created the cursor's Position. In case 2, each text CRDT depends on causally prior operations in the CPositionSource to understand the list order.

Specifically, we need the ability to have one CRuntime buffer messages until causally prior messages are received by another CRuntime. This seems like a neat and relatively easy feature to add.

We could also make it possible to implement case 3 without keeping both documents in memory simultaneously. E.g., store the reference as a CollabID + Position, and add fallback code in case the user clicks on a link to a section that you haven't received yet. This mostly requires an example in the docs, but we also need a way to safely ask whether a Position exists. (Currently, asking a list about a not-yet-existent Position will throw an error.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant