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(protocol): Brotli Compression #14

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

refcell
Copy link
Contributor

@refcell refcell commented Jan 8, 2025

Description

Updates brotli compression to use the lib.

Replaces alloy-rs/op-alloy#305

@refcell refcell self-assigned this Jan 8, 2025
@refcell
Copy link
Contributor Author

refcell commented Jan 8, 2025

📚 $\text{Stack Overview}$

Pulls submitted in this stack:

This comment was automatically generated by st.

@refcell refcell added A-protocol Area: protocol crate C-feat Category: new feature or request labels Jan 8, 2025
@refcell refcell marked this pull request as draft January 8, 2025 19:41
Comment on lines 123 to 129
fn write(&mut self, data: &[u8]) -> CompressorResult<usize> {
if self.closed {
return Err(CompressorError::Brotli);
}

// First append the new data to the raw buffer.
self.raw.extend_from_slice(data);

// Compress the raw buffer.
self.compressed =
compress_brotli(&self.raw, self.level).map_err(|_| CompressorError::Brotli)?;

Ok(data.len())
let written = self.writer.write(data).map_err(|_| CompressorError::Brotli)?;
Ok(written)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is broken and it's not clear to me why.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-protocol Area: protocol crate C-feat Category: new feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant