Skip to content

Commit 8b6f8f3

Browse files
committed
chore: remove todos
1 parent 46399c8 commit 8b6f8f3

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

lib/codecs/src/decoding/framing/chunked_gelf.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ use vector_config::configurable_component;
1818
const GELF_MAGIC: &[u8] = &[0x1e, 0x0f];
1919
const GZIP_MAGIC: &[u8] = &[0x1f, 0x8b];
2020
const ZLIB_MAGIC: &[u8] = &[0x78];
21-
// TODO: add lz4 compression detection?
22-
// TODO: add zstd compression detect?
2321
const GELF_MAX_TOTAL_CHUNKS: u8 = 128;
2422
const DEFAULT_TIMEOUT_SECS: f64 = 5.0;
2523

@@ -173,7 +171,6 @@ pub enum ChunkedGelfDecompression {
173171
}
174172

175173
impl ChunkedGelfDecompression {
176-
// TODO: add tests for compression detection
177174
pub fn from_magic(data: &Bytes) -> Self {
178175
if data.starts_with(GZIP_MAGIC) {
179176
debug!("Detected Gzip compression");
@@ -182,17 +179,11 @@ impl ChunkedGelfDecompression {
182179

183180
if data.starts_with(ZLIB_MAGIC) {
184181
if let Some([first_byte, second_byte]) = data.get(0..2) {
185-
// TODO: add inspired from https://github.com/grafana/go-gelf/blob/25db8704bcf3f484c958312cd0cc49e5c768dcf1/gelf/reader.go#L120
186-
// and https://github.com/Graylog2/graylog2-server/blob/1bdeca5f8ad3d31ff0c1c7981978ae8c4d300ebc/graylog2-server/src/main/java/org/graylog2/inputs/codecs/gelf/GELFMessage.java#L157
187182
if (*first_byte as u16 * 256 + *second_byte as u16) % 31 == 0 {
188183
debug!("Detected Zlib compression");
189184
return Self::Zlib;
190185
}
191186
};
192-
// TODO: should we return and error if the data starts with de ZLIB MAGIC
193-
// but does not match the previous branches?
194-
// for example, take a look to the graylog2server implementation
195-
// https://github.com/Graylog2/graylog2-server/blob/1bdeca5f8ad3d31ff0c1c7981978ae8c4d300ebc/graylog2-server/src/main/java/org/graylog2/inputs/codecs/gelf/GELFMessage.java#L160
196187
};
197188

198189
debug!("No compression detected",);
@@ -231,9 +222,6 @@ pub enum ChunkedGelfDecompressionError {
231222
ZlibDecompression { source: std::io::Error },
232223
}
233224

234-
// TODO: add a comment that I removed the PartialEq and Eq derive due to
235-
// std::io::Error not implementing them. I had to refactor assert_eq to
236-
// assert!(matches!(..)) in tests due to this.
237225
#[derive(Debug, Snafu)]
238226
pub enum ChunkedGelfDecoderError {
239227
#[snafu(display("Invalid chunk header with less than 10 bytes: 0x{header:0x}"))]
@@ -516,8 +504,6 @@ impl Decoder for ChunkedGelfDecoder {
516504
}
517505
}
518506

519-
// TODO: should I add compression tests in the UDP socket module tests?
520-
// as we did with the initial chunked gelf implementation.
521507
#[cfg(test)]
522508
mod tests {
523509

0 commit comments

Comments
 (0)