haubur commented on code in PR #2529:
URL: https://github.com/apache/iggy/pull/2529#discussion_r2673466152
##########
core/sdk/src/clients/consumer.rs:
##########
@@ -980,6 +977,48 @@ impl Stream for IggyConsumer {
message.payload = Bytes::from(payload);
message.header.payload_length =
message.payload.len() as u32;
}
+
+ // maybe decompress
+ if let Ok(Some(algorithm_value)) = message
+
.get_user_header(&HeaderKey::from_str("iggy-compression").unwrap())
+ {
+ let algorithm_name =
algorithm_value.as_str().unwrap();
+ let algorithm =
+
CompressionAlgorithm::from_str(algorithm_name).unwrap();
Review Comment:
Its needed because it returns a Result, no?
```rust
impl FromStr for CompressionAlgorithm {
type Err = String;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s.to_lowercase().as_str() {
"gzip" => Ok(CompressionAlgorithm::Gzip),
"zstd" => Ok(CompressionAlgorithm::Zstd),
"lz4" => Ok(CompressionAlgorithm::Lz4),
"snappy" => Ok(CompressionAlgorithm::Snappy),
"none" => Ok(CompressionAlgorithm::None),
_ => Err(format!("Unknown compression type: {s}")),
}
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]