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
Feature: compress before encryption (#6013)
Eugeniy E. Mikhailov0da9e40abb96
diff --git a/weed/operation/upload_content.go b/weed/operation/upload_content.goindex 8b223e769d..a8e8a85b0e 100644--- a/weed/operation/upload_content.go+++ b/weed/operation/upload_content.go@@ -221,7 +221,7 @@ func (uploader *Uploader) doUploadData(data []byte, option *UploadOption) (uploa// this could be double copyingclearDataLen = len(data)clearData := data- if shouldGzipNow && !option.Cipher {+ if shouldGzipNow {compressed, compressErr := util.GzipData(data)// fmt.Printf("data is compressed from %d ==> %d\n", len(data), len(compressed))if compressErr == nil {@@ -241,7 +241,7 @@ func (uploader *Uploader) doUploadData(data []byte, option *UploadOption) (uploa// encryptcipherKey := util.GenCipherKey()- encryptedData, encryptionErr := util.Encrypt(clearData, cipherKey)+ encryptedData, encryptionErr := util.Encrypt(data, cipherKey)if encryptionErr != nil {err = fmt.Errorf("encrypt input: %v", encryptionErr)return@@ -267,6 +267,9 @@ func (uploader *Uploader) doUploadData(data []byte, option *UploadOption) (uploauploadResult.Mime = option.MimeTypeuploadResult.CipherKey = cipherKeyuploadResult.Size = uint32(clearDataLen)+ if contentIsGzipped {+ uploadResult.Gzip = 1+ }} else {// upload datauploadResult, err = uploader.upload_content(func(w io.Writer) (err error) {