feat: introduce InflightProtocolDataQueue#4834
Closed
thomaseizinger wants to merge 6 commits intomasterfrom
Closed
feat: introduce InflightProtocolDataQueue#4834thomaseizinger wants to merge 6 commits intomasterfrom
InflightProtocolDataQueue#4834thomaseizinger wants to merge 6 commits intomasterfrom
Conversation
Contributor
Author
|
@mxinden Ready for review. Only has draft status because I want to adapt more protocols if we agree on the design. |
Contributor
Author
|
Adding |
ec2bbea to
549a9d6
Compare
af9f93c to
f600aa1
Compare
Contributor
Author
|
cc @dgarus You might enjoy this change :) |
Contributor
|
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
Contributor
Author
|
@mxinden The last commit experiments with a |
thomaseizinger
commented
Nov 15, 2023
Comment on lines
+182
to
+191
| async move { | ||
| let stream = receiver | ||
| .await | ||
| .map_err(|_| io::Error::from(io::ErrorKind::BrokenPipe))? | ||
| .map_err(into_reserve_error)?; | ||
|
|
||
| let reservation = outbound_hop::make_reservation(stream).await?; | ||
|
|
||
| Ok(reservation) | ||
| }, |
Contributor
Author
There was a problem hiding this comment.
As an added benefit, the timeout of FuturesTupleSet now also applies to the entire stream opening.
Contributor
Author
4 tasks
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.
Description
This PR prototypes what I termed an
InflightProtocolDataQueue. It is essentially a replacement forConnectionHandler::OutboundOpenInfo, just slightly more generic. In essence, it allows users to submit a request to the queue, together with a piece of data and later submit responses.Internally, the responses are matched with a pending piece of data and later returned. Assuming the functions are called in the right order (which is an invariant that
libp2p-swarmshould uphold), this frees users from having to worry about tracking state separately.Resolves: #4510.
Related: #3268.
Notes & open questions
Opening this PR for early feedback. In a follow-up PR, I'd then deprecate
InboundOpenInfoandOutboundOpenInfoand point users towards the newlibp2p-protocol-utilscrate and theInflightProtocolDataQueue.Change checklist