Towards API stability #3072
Replies: 4 comments 12 replies
-
In my eyes it is viable to maintain a Examples of things I maintain outside of this repository building on top of rust-libp2p:
For me a 1.0 is first and foremost a statement that this is production ready. API stability might be a byproduct of that. I am in favor of releasing a 1.0. I am not in favor of increasing our commitment to API stability. In my eyes, as long as we provide easy upgrade paths, it is fine to do breaking changes, i.e. release 2.0, 3.0, 4.0 etc. |
Beta Was this translation helpful? Give feedback.
-
That comparison isn't quite adequate because those are applications, not libraries and thus don't get released to crates.io themselves. For a 3rd party
I am aware that this part of the semver spec and I agree that it should have weight when we make the decision on when to release 1.0. "Production readiness" however is just another way of saying "You can rely on this library". But relying on a library also means not creating excess amounts of churn in the form of release cycles.
I don't think it is that simple. For applications, a version bump from 0.49 -> 0.50 might be no different than 1.0 -> 2.0 assuming an easy upgrade path. The problem starts to arise once you have other libraries building on top of yours. Every major semver bump causes a cascade in bumps unless you wrap all types. I am not saying we can never release a 2.0. I am just saying that I'd want us to be conscious of the churn that comes out of a major semver bump and thus avoid them for as long as possible once we decide to to 1.0. |
Beta Was this translation helpful? Give feedback.
-
Yesterday, @mxinden and I discussed something that is relevant to this post. We talked about the idea of re-arranging the contents of our crates such that they only depend on the stuff they need and thus breaking changes to one part are less intrusive. Most prominently, the idea was to separate Whilst this doesn't change the number of breaking changes, it at least isolates them. For example, we are changing the |
Beta Was this translation helpful? Give feedback.
-
Go online, find a blog with an example, it doesn't work. Do a search for libp2p, find an archived repo. The documentation and example drift from the API changes makes it seem like libp2p doesn't work except for the few people developing it. API stability would go a long way towards fixing that reputational damage. |
Beta Was this translation helpful? Give feedback.
-
Libp2p is a modular networking library. One benefit of this modularity is that community members should be able to maintain their own transports. See the recent discussion in #2899 for an example.
Maintaining such crates out-of-tree is only really viable if we provide a commitment towards API stability. In my opinion, releasing a 1.0 should come with such a commitment.
Currently, there are many things in the works in
rust-libp2p
and breaking changes in certain interfaces likeNetworkBehaviour
are still frequent. Consequently, I'd like to focus this discussion on theTransport
API.Everything in
libp2p
is driven by aTransport
, thus I think it makes sense to try and stabilize this API first. I believe it will take something like #2829 to pull this off.Overall, the approach I'd take is:
libp2p-swarm
to work.StreamMuxer
would become an implementation detail of thelibp2p-core
API.StreamMuxer
into a different crate.Transport
trait? It is quite an OOP-influenced design1. Perhaps this trait should be split into multiple smaller ones?Swarm
) should give us a good indication on whatlibp2p-core
should provide.Transport
API is pretty generic. It allows for "stacking" ofTransport
s which makes it very flexible. However, at the same time, this makes it harder to provide more discoverable interfaces or implement functionality like Consider verifying expectedPeerId
as part of auth upgrades #2946.Transport
s likelibp2p-deflate
should be treated.Footnotes
This isn't necessarily bad but I've found it useful in the past to split larger traits into more focused ones when it comes to optimising for modularity. ↩
Beta Was this translation helpful? Give feedback.
All reactions