-
Notifications
You must be signed in to change notification settings - Fork 1k
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
The future of development_transport
#3657
Comments
I'm in favor of the |
A different option might be to activate all transports that are compiled into the application, i.e. activated through the cargo features. This might need some |
I am not sure that is a good idea. Functions shouldn't change their behaviour when features are activated or deactivated as features are unified across the dependency graph. It would be very surprising to users if suddenly they are exposing a transport because they are pulling in a different library that happens to activate another feature. |
Started a PoC here: #3792 |
Documenting an out-of-band discussion: The issue with the
In addition, the problem with composing the transports manually is that you have to know the nitty-gritty details about the order of composing noise/tls, multiplexer etc. We can fix both issues by providing something like the following (type-safe) builder pattern on SwarmBuilder::new(behaviour, identity)
.with_tokio_executor()
.with_default_tcp() # or .with_tcp(|config| config.no_delay(true))
.with_noise()
.with_tls()
.with_yamux()
.build() A few things that are interesting about this API:
What we need to solve are:
|
what is the status of this issue? I am trying to run the file sharing example and I am getting that there is no development_transport in libp2p! |
The status is that we need to figure out a flexible yet easy to use design that serves several usecases. The above discussion is my latest thinking with the only addition being that the new |
Due to cargo's feature unification, a full build of our workspace doesn't actually check whether the examples compile as standalone projects. We add a new CI check that iterates through all crates in the `examples/` directory and runs a plain `cargo check` on them. Any failure is bubbled up via `set -e`, thus failing CI in case one of the `cargo check` commands fails. To fix the current failures, we construct a simple TCP transport everywhere where we were previously using `development_transport`. That is because `development_transport` requires `mplex` which is now deprecated. Related #3657. Related #3809. Pull-Request: #3811.
I tried to tackle this over the weekend, that is an interactive
I have to give this more thought. Maybe someone has a neat trick. Hope this is not too much discouragement. |
Maybe the following works:
This may help with the cardinality because it results in a single Only issue could be the configs of the various transports / upgrades. Those types are not available when the features are off. Perhaps we need to change that? |
Motivation
In the early days of
rust-libp2p
, adevelopment_transport
was added to make it easier on getting started with development. There are multiple issues with it:async-std
flavor is calleddevelopment_transport
and thetokio
flavor is calledtokio_development_transport
. Those are not aligned.Swarm
.In my opinion, it is useful to have a "default" transport that contains a recommended set of transports and muxers. In my eyes, those are:
Websocket as well as relay are purposely left out as I'd consider those too niche. WebRTC and QUIC are still in alpha state. Mplex is considered deprecated and we shouldn't encourage it.
Suggestion
There are multiple ways of fixing this problem. In #3635 (comment), I sketched a feature that incorporates a
default_transport
into theSwarmBuilder
. This would be very easy to discover but it would also mean that we would require optional dependencies fromlibp2p-swarm
to the various transport and muxer crates.Alternatively, we might be able to attach functions via an extension trait that lives in
libp2p
but I am not sure if we can create a good, type-system driven builder then.Are you planning to do it yourself in a pull request?
No.
The text was updated successfully, but these errors were encountered: