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

Reverse dependencies with asynchronous-codec #69

Closed
thomaseizinger opened this issue Sep 28, 2023 · 3 comments
Closed

Reverse dependencies with asynchronous-codec #69

thomaseizinger opened this issue Sep 28, 2023 · 3 comments

Comments

@thomaseizinger
Copy link
Contributor

The asynchronous-codec crate defines the Encoder and Decoder traits, some utility codecs AND several that are feature-flagged: https://github.com/mxinden/asynchronous-codec

I think it would be cleaner if unsigned-varint would not depend on asynchronous-codec and we instead add a feature-gated codec to asynchronous-codec.

Thoughts?

@mxinden
Copy link
Contributor

mxinden commented Oct 13, 2023

No opinion. Off the top of my head, cleaner but not a high impact.

@thomaseizinger
Copy link
Contributor Author

I thought some more about this and came to the conclusion that whilst asynchronous-codec is < 1.0, it is much easier to have the codec within that crate as they can be all upgraded in one version. Once the interface is mature and 1.0 is being released, it actually makes more sense to have the codecs in external crates.

For example, serde also only provides the interface and the actual formats are implemented externally, in e.g. serde_json etc.

I don't know how far we are from 1.0 in asynchronous-codec but instead of moving the codecs now, it might be worth maturing that crate.

All of this obviously only applies if 1.0 comes with a certain stability guarantee, i.e. no major version bump in the foreseeable future.

@thomaseizinger
Copy link
Contributor Author

After working on libp2p/rust-libp2p#4782, I came to the conclusion that likely, there shouldn't even be a codec for length-prefixing with unsigned-varint because it can easily lead to lots of temporary allocations.

Thus, I am going to close this issue as a "won't fix". I think it is worth considering removing the impl from this repo to avoid similar inefficiencies on other usage sites.

@thomaseizinger thomaseizinger closed this as not planned Won't fix, can't repro, duplicate, stale Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants