-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
chore: Move compression utilities into separate package #14167
Conversation
01ef96d
to
2f061c9
Compare
Compression tooling has been part of the chunkenc (chunk encoding) package in the past for legacy reasons. Since more components use this now, it's easier to keep it in a separate package. This also eliminates the confusion around "encoding", since this has been incorrectly used synonymously with "compression" in the past. Signed-off-by: Christian Haudum <[email protected]>
2f061c9
to
f224d78
Compare
pkg/compression/pool.go
Outdated
switch enc { | ||
case EncGZIP: | ||
return &Gzip | ||
case EncLZ4_64k: | ||
return &Lz4_64k | ||
case EncLZ4_256k: | ||
return &Lz4_256k | ||
case EncLZ4_1M: | ||
return &Lz4_1M | ||
case EncLZ4_4M: | ||
return &Lz4_4M | ||
case EncSnappy: | ||
return &Snappy | ||
case EncNone: | ||
return &Noop | ||
case EncFlate: | ||
return &Flate | ||
case EncZstd: | ||
return &Zstd | ||
default: | ||
panic("unknown encoding") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: None* of the pools are referenced directly outside of this package, so it's safe to unexport all of them and just leave GetReaderPool
/GetWriterPool
as the public API for pools.
Personally I'm normally a fan of unexporting as much as possible as it reduces the surface where good API documentation is necessary. I don't feel too strongly about this at the moment, so I don't mind if this doesn't get changed.
*: compression.Gzip
is referenced a few times, but all references can be replaced with compression.GetReaderPool(compression.EncGZIP)
or compression.GetWriterPool(compression.EncGZIP)
.
pkg/compression/pool.go
Outdated
} | ||
} | ||
|
||
// GzipPool is a gun zip compression pool |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is gun zip a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(two small extra comments)
Signed-off-by: Christian Haudum <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
Co-authored-by: Robert Fratto <[email protected]>
Signed-off-by: Christian Haudum <[email protected]>
What this PR does / why we need it:
Compression tooling has been part of the
chunkenc
(chunk encoding)package in the past for legacy reasons.
Since more components use this now, it's easier to keep it in a separate
package. This also eliminates the confusion around "encoding", since
this has been incorrectly used synonymously with "compression" in the past.
Checklist
CONTRIBUTING.md
guide (required)feat
PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.docs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PRSigned-off-by: Christian Haudum [email protected]