-
Notifications
You must be signed in to change notification settings - Fork 1
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
Discover and subscribe to documents based on short code #17
base: main
Are you sure you want to change the base?
Conversation
while let Some(message) = rx.recv().await { | ||
match message { | ||
ToApp::NewDocument(text_document) => { | ||
// @TODO: get the short code for this document into the share UI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to load a new document into the UI here. This event occurs when the app starts, and also after a preceding request from the frontend to subscribe to a document based on it's short code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another approach (maybe nicer) for this messaging channel would be to still only have one message variant, but always include the document id as well as the message bytes. Then when a change in document id is detected we interpret this as a change of document.
Doesn't change anything about how the frontend would react, just how this change is communicated to the front end.
aardvark-app/src/window.rs
Outdated
@@ -67,6 +67,8 @@ mod imp { | |||
let window = self.obj().clone(); | |||
let dialog = self.open_document_dialog.clone(); | |||
self.open_document_button.connect_clicked(move |_| { | |||
// @TODO: Send `FromApp::Subscribe` message to network containing the share code |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to send the short code to the backend here.
This PR implements the logic required for discovering documents by their short code and then subscribing to them. To do this we introduce a new "document discovery" overlay network which allows peers to resolve a short code to the full document topic (which can then be used for subscribing to document events).
AardvarkTopic
which has one variant for document discovery, and one for document message gossip and syncShortCode
based on theTextDocument
hashTextDocument
to contain the public key of the author who created it and a timestampNode
struct which wraps all networking and persistence objects and exposes new API forTODO
TextDocument
in the app/UI