SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
zstd fix
Chris Lu5be12eea37b8
diff --git a/weed/util/compression.go b/weed/util/compression.goindex de6bf0800a..b526f47c9a 100644--- a/weed/util/compression.go+++ b/weed/util/compression.go@@ -25,6 +25,13 @@ 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)@@ -46,10 +53,9 @@ func ungzipData(input []byte) ([]byte, error) {return output, err}-var zstdEncoder, _ = zstd.NewWriter(nil)-+var decoder, _ = zstd.NewReader(nil)func unzstdData(input []byte) ([]byte, error) {- return zstdEncoder.EncodeAll(input, nil), nil+ return decoder.DecodeAll(input, nil)}func IsGzippedContent(data []byte) bool {@@ -63,7 +69,7 @@ func IsZstdContent(data []byte) bool {if len(data) < 4 {return false}- return data[0] == 0xFD && data[1] == 0x2F && data[2] == 0xB5 && data[3] == 0x28+ return data[3] == 0xFD && data[2] == 0x2F && data[1] == 0xB5 && data[0] == 0x28}/*