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: Further implement ls-qpack, especially around stream data in/out #12

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Ousret
Copy link

@Ousret Ousret commented May 6, 2024

Hello,

This PR supersede #11
The story remain identical on the goals. The crate you started is really useful, and I would like to contribute
in order to make this further usable in various use cases.

  • Retrieve stream data on all decoders methods
  • Add feed method for the encoder.

FYI: In this state, the PR introduce backward incompatible changes. I am willing to discuss it further to find a solution that would fit both our interests. Of course.

regards,

Copy link
Owner

@BiagioFesta BiagioFesta left a comment

Choose a reason for hiding this comment

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

Just quick glance. I need to find some spare time to review deeply.

In the meanwhile, I am going to leave a few comments.
I'd suggest to squash some commits to keep the history clean.

Moreover, if it is possible I would improve the code (and this entire library actually) with more unit tests. Very much unsafe code, without deep unit testing it is scaring :D
This is kinda out of scope of your PR in particular, but maybe we can leverage this refinement to ensure the behavior with unit tests.

Thank you for the contribution!

@@ -37,16 +37,36 @@ use std::pin::Pin;
/// Error during decoding operations.
pub struct DecoderError;

/// The result of the encoding operation.
///
/// This is the result of [`Encoder::encode_all`] or [`EncodingBlock::encode`].
Copy link
Owner

Choose a reason for hiding this comment

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

This is called BuffersDecoded but doc mentions encode_all?

stream: Box<[u8]>,
}

impl BuffersDecoded {
Copy link
Owner

Choose a reason for hiding this comment

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

I would improve this `impl.

Before it was possible to obtain ownership of data. With BuffersDecoded is not possible anymore.

I'd start adding a take method to consume the object and get the memory ownership:

@@ -339,6 +362,11 @@ mod callbacks {
this.blocked = blocked;
}

pub(super) fn set_stream_data(self: Pin<&mut Self>, data: &Vec<u8>) {
Copy link
Owner

Choose a reason for hiding this comment

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

Why passing &Vec<u8>? If you need ownership, just pass Vec<u8>

@@ -353,8 +381,12 @@ mod callbacks {
self.error
}

pub(super) fn decoded_headers(self) -> Vec<Header> {
self.decoded_headers
pub(super) fn decoded_headers(&self) -> Vec<Header> {
Copy link
Owner

Choose a reason for hiding this comment

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

why the change self -> &self?

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

Successfully merging this pull request may close these issues.

2 participants