Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

feat(protocol): Brotli Compression #14

Closed
wants to merge 1 commit into 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.

@refcell
Copy link
Contributor Author

refcell commented Feb 5, 2025

Closing since this is tracked in #176. This PR can be used as a reference.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
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