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

fix: public cbor/json codec module #5830

Merged
merged 8 commits into from
Jan 28, 2025
Merged

Conversation

mosure
Copy link
Contributor

@mosure mosure commented Jan 27, 2025

Description

follow-up to #5792

configuring a request_response behavior with generic codec does not allow for setting request/response size limits.

e.g. the following fails to compile since request_response::cbor::codec is private:

let non_default_codec = request_response::cbor::codec::Codec::<CustomRequest, CustomLargeResponse>::default()
    .set_response_size_maximum(large_response_size_max);
let request_response = request_response::Behaviour::with_codec(
    non_default_codec,
    std::iter::once((
        StreamProtocol::new("/request-response/1"),
        request_response::ProtocolSupport::Full,
    )),
    request_response::Config::default(),
);

Notes & open questions

  • is there an alternative to making the codec module public?

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

@mosure mosure changed the title Fix/public cbor codec fix: public cbor/json codec module Jan 27, 2025
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

LGTM thanks!

@jxs jxs requested a review from dariusc93 January 27, 2025 11:18
Copy link
Member

@dariusc93 dariusc93 left a comment

Choose a reason for hiding this comment

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

LGTM. Left some suggestions and can you update Cargo.toml in both request-response and in the workspace? :)

protocols/request-response/CHANGELOG.md Outdated Show resolved Hide resolved
Copy link
Member

@dariusc93 dariusc93 left a comment

Choose a reason for hiding this comment

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

Thanks!

@jxs
Copy link
Member

jxs commented Jan 27, 2025

Everything looks good @mosure! Only Cargo.lock updating left

@mergify mergify bot merged commit 3ce976d into libp2p:master Jan 28, 2025
71 checks passed
@mosure mosure deleted the fix/public-cbor-codec branch January 28, 2025 03:58
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.

4 participants