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

feat(yamux): future-proof public API #3908

Merged
merged 5 commits into from
May 12, 2023
Merged

feat(yamux): future-proof public API #3908

merged 5 commits into from
May 12, 2023

Conversation

thomaseizinger
Copy link
Contributor

Description

With this set of changes, we prepare the public API of libp2p-yamux to be as minimal as possible and allow for upgrades of the underlying yamux library in patch releases.

Related: #3013.

Notes & open questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

@thomaseizinger thomaseizinger added this to the v0.52.0 milestone May 10, 2023
Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool. Looks good to me overall. Just one suggestion.

/// The [`futures::stream::Stream`] of incoming substreams.
incoming: S,
incoming: BoxStream<'static, Result<yamux::Stream, yamux::ConnectionError>>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why Box the stream of streams? Not boxing would also resolve the need for PhantomData, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just inlined what we had before.

This and the phantom data will go away once update to latest yamux. I only added it to make sure it is a compatible API change later :)

into_stream returns an impl Trait. I guess we could inline the unfold operation and store an Unfold type?

Do you feel strongly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure the Unfold type is nameable at all because it contains an async block.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the phantom data will go away once update to latest yamux.

Great. Don't feel strongly. Let's keep as is.

@mergify mergify bot merged commit 234a0d2 into master May 12, 2023
@mergify mergify bot deleted the feat/harden-yamux-api branch May 12, 2023 03:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants