haubur commented on code in PR #2529:
URL: https://github.com/apache/iggy/pull/2529#discussion_r2673487229
##########
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
Review Comment:
That's what I did now. I also liked your codec approach.
However, for decompression the config does not need to be provided as it is
read from the user-headers so in order to not unnecessarily instantiate a
pseudo or placeholder config in maybe_decompress the maybe_decompress method
```rust
// core/common/src/types/compression/codec.rs
pub struct MessageCodec {
config: ClientCompressionConfig,
}
impl MessageCodec {
pub fn maybe_compress(&self, message: &mut IggyMessage) -> Result<(),
IggyError> { ... }
pub fn maybe_decompress(&self, message: &mut IggyMessage) ->
Result<(), IggyError> { ... }
}
```
would be actually be a static method
```rust
// core/common/src/types/compression/codec.rs
pub struct MessageCodec {
config: ClientCompressionConfig,
}
impl MessageCodec {
pub fn maybe_compress(&self, message: &mut IggyMessage) -> Result<(),
IggyError> { ... }
pub fn maybe_decompress(message: &mut IggyMessage) -> Result<(),
IggyError> { ... }
}
```
So since, the consumer reads inherently and does not need any configuration
I left it as is (while having a separate method now).
Still open for other preferences or arguments, though in case I missed
something.
--
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]