forked from TrueCloudLab/frostfs-node
[#1060] blobstor: allow to disable compression based on content-type
For some data compression makes little sense, as it is already compressed. This commit allows to leave such data unchanged based on `Content-Type` attribute. Currently exact, prefix and suffix matching are supported. Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
0f1eb743af
commit
0d969d7a06
11 changed files with 133 additions and 8 deletions
|
@ -28,6 +28,8 @@ type cfg struct {
|
|||
|
||||
compressionEnabled bool
|
||||
|
||||
uncompressableContentTypes []string
|
||||
|
||||
compressor func([]byte) []byte
|
||||
|
||||
decompressor func([]byte) ([]byte, error)
|
||||
|
@ -117,6 +119,14 @@ func WithCompressObjects(comp bool) Option {
|
|||
}
|
||||
}
|
||||
|
||||
// WithUncompressableContentTypes returns option to disable decompression
|
||||
// for specific content types as seen by object.AttributeContentType attribute.
|
||||
func WithUncompressableContentTypes(values []string) Option {
|
||||
return func(c *cfg) {
|
||||
c.uncompressableContentTypes = values
|
||||
}
|
||||
}
|
||||
|
||||
// WithRootPath returns option to set path to root directory
|
||||
// of the fs tree to write the objects.
|
||||
func WithRootPath(rootDir string) Option {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue