diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-11-21 13:06:35 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-11-21 13:06:45 -0800 |
| commit | 92f906b6fcce2ef72661bb825075e2826b8f3aa1 (patch) | |
| tree | cb8b27ad90dd6afa83e3e34033db9bbd551477e1 /weed/util/compression.go | |
| parent | 025bd8d447e147643173f369afcd7cc29b04e4d8 (diff) | |
| download | seaweedfs-92f906b6fcce2ef72661bb825075e2826b8f3aa1.tar.xz seaweedfs-92f906b6fcce2ef72661bb825075e2826b8f3aa1.zip | |
remove zstd
fix https://github.com/chrislusf/seaweedfs/issues/1629
Diffstat (limited to 'weed/util/compression.go')
| -rw-r--r-- | weed/util/compression.go | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/weed/util/compression.go b/weed/util/compression.go index cf3ac7c57..33506834b 100644 --- a/weed/util/compression.go +++ b/weed/util/compression.go @@ -9,7 +9,7 @@ import ( "strings" "github.com/chrislusf/seaweedfs/weed/glog" - "github.com/klauspost/compress/zstd" + // "github.com/klauspost/compress/zstd" ) var ( @@ -55,19 +55,16 @@ func GzipData(input []byte) ([]byte, error) { return buf.Bytes(), nil } -var zstdEncoder, _ = zstd.NewWriter(nil) - -func ZstdData(input []byte) ([]byte, error) { - return zstdEncoder.EncodeAll(input, nil), nil -} func DecompressData(input []byte) ([]byte, error) { if IsGzippedContent(input) { return ungzipData(input) } + /* if IsZstdContent(input) { return unzstdData(input) } + */ return input, UnsupportedCompression } @@ -82,12 +79,6 @@ func ungzipData(input []byte) ([]byte, error) { return output, err } -var decoder, _ = zstd.NewReader(nil) - -func unzstdData(input []byte) ([]byte, error) { - return decoder.DecodeAll(input, nil) -} - func IsGzippedContent(data []byte) bool { if len(data) < 2 { return false @@ -95,12 +86,26 @@ func IsGzippedContent(data []byte) bool { return data[0] == 31 && data[1] == 139 } +/* +var zstdEncoder, _ = zstd.NewWriter(nil) + +func ZstdData(input []byte) ([]byte, error) { + return zstdEncoder.EncodeAll(input, nil), nil +} + +var decoder, _ = zstd.NewReader(nil) + +func unzstdData(input []byte) ([]byte, error) { + return decoder.DecodeAll(input, nil) +} + func IsZstdContent(data []byte) bool { if len(data) < 4 { return false } return data[3] == 0xFD && data[2] == 0x2F && data[1] == 0xB5 && data[0] == 0x28 } +*/ /* * Default not to compressed since compression can be done on client side. |
