Conversation
Problem: the current Repo::find API is timing sensitive. If the returned future completes with `None` then there's no way to hear about changes which cause the document to become available (such as a peer who has the document connecting late). This forces applications who want to be oblivious to the order in which network events occur to poll `Repo::find`. Solution: Introduce a `Repo::search` API, which returns a query state representing the current knowledge of the state of the document, plus a stream of future updates. When the document is found the stream returns an item which has the `DocHandle` in it. This allows applications to listen to the search stream indefinitely. Introducing the "search" API also significantly simplified the internal logic of the document actor as it no longer needs to track pending dialers - the logic of "a document is unavailable if there are no pending dialers and no connected peers have it" can now live in the `find()` call.
Owner
Author
|
@shikokuchuo this is the new search API I was talking about. |
Contributor
|
Likely won't need |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem: the current Repo::find API is timing sensitive. If the returned future completes with
Nonethen there's no way to hear about changes which cause the document to become available (such as a peer who has the document connecting late). This forces applications who want to be oblivious to the order in which network events occur to pollRepo::find.Solution: Introduce a
Repo::searchAPI, which returns a query state representing the current knowledge of the state of the document, plus a stream of future updates. When the document is found the stream returns an item which has theDocHandlein it. This allows applications to listen to the search stream indefinitely.Introducing the "search" API also significantly simplified the internal logic of the document actor as it no longer needs to track pending dialers - the logic of "a document is unavailable if there are no pending dialers and no connected peers have it" can now live in the
find()call.