aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--weed/filer/filer_conf_test.go2
-rw-r--r--weed/operation/needle_parse_test.go40
-rw-r--r--weed/server/volume_server_handlers_read.go4
-rw-r--r--weed/shell/command_fs_configure.go2
-rw-r--r--weed/storage/needle/needle_parse_upload.go10
-rw-r--r--weed/util/compression.go7
6 files changed, 32 insertions, 33 deletions
diff --git a/weed/filer/filer_conf_test.go b/weed/filer/filer_conf_test.go
index 91f006cda..ff868a3ec 100644
--- a/weed/filer/filer_conf_test.go
+++ b/weed/filer/filer_conf_test.go
@@ -22,7 +22,7 @@ func TestFilerConf(t *testing.T) {
},
{
LocationPrefix: "/buckets/",
- Replication: "001",
+ Replication: "001",
},
}}
fc.doLoadConf(conf)
diff --git a/weed/operation/needle_parse_test.go b/weed/operation/needle_parse_test.go
index aba89616e..202374e1b 100644
--- a/weed/operation/needle_parse_test.go
+++ b/weed/operation/needle_parse_test.go
@@ -76,29 +76,29 @@ func TestCreateNeedleFromRequest(t *testing.T) {
}
/*
- {
- mc.needleHandling = func(n *needle.Needle, originalSize int, err error) {
- assert.Equal(t, nil, err, "upload: %v", err)
- assert.Equal(t, "text/plain", string(n.Mime), "mime detection failed: %v", string(n.Mime))
- assert.Equal(t, true, n.IsCompressed(), "this should be compressed")
- assert.Equal(t, true, util.IsZstdContent(n.Data), "this should be zstd")
- fmt.Printf("needle: %v, dataSize:%d originalSize:%d\n", n, len(n.Data), originalSize)
+ {
+ mc.needleHandling = func(n *needle.Needle, originalSize int, err error) {
+ assert.Equal(t, nil, err, "upload: %v", err)
+ assert.Equal(t, "text/plain", string(n.Mime), "mime detection failed: %v", string(n.Mime))
+ assert.Equal(t, true, n.IsCompressed(), "this should be compressed")
+ assert.Equal(t, true, util.IsZstdContent(n.Data), "this should be zstd")
+ fmt.Printf("needle: %v, dataSize:%d originalSize:%d\n", n, len(n.Data), originalSize)
+ }
+ zstdData, _ := util.ZstdData([]byte(textContent))
+ Upload("http://localhost:8080/389,0f084d17353afda0", "t.txt", false, bytes.NewReader(zstdData), true, "text/plain", nil, "")
}
- zstdData, _ := util.ZstdData([]byte(textContent))
- Upload("http://localhost:8080/389,0f084d17353afda0", "t.txt", false, bytes.NewReader(zstdData), true, "text/plain", nil, "")
- }
- {
- mc.needleHandling = func(n *needle.Needle, originalSize int, err error) {
- assert.Equal(t, nil, err, "upload: %v", err)
- assert.Equal(t, "application/zstd", string(n.Mime), "mime detection failed: %v", string(n.Mime))
- assert.Equal(t, false, n.IsCompressed(), "this should not be compressed")
- assert.Equal(t, true, util.IsZstdContent(n.Data), "this should still be zstd")
- fmt.Printf("needle: %v, dataSize:%d originalSize:%d\n", n, len(n.Data), originalSize)
+ {
+ mc.needleHandling = func(n *needle.Needle, originalSize int, err error) {
+ assert.Equal(t, nil, err, "upload: %v", err)
+ assert.Equal(t, "application/zstd", string(n.Mime), "mime detection failed: %v", string(n.Mime))
+ assert.Equal(t, false, n.IsCompressed(), "this should not be compressed")
+ assert.Equal(t, true, util.IsZstdContent(n.Data), "this should still be zstd")
+ fmt.Printf("needle: %v, dataSize:%d originalSize:%d\n", n, len(n.Data), originalSize)
+ }
+ zstdData, _ := util.ZstdData([]byte(textContent))
+ Upload("http://localhost:8080/389,0f084d17353afda0", "t.txt", false, bytes.NewReader(zstdData), false, "application/zstd", nil, "")
}
- zstdData, _ := util.ZstdData([]byte(textContent))
- Upload("http://localhost:8080/389,0f084d17353afda0", "t.txt", false, bytes.NewReader(zstdData), false, "application/zstd", nil, "")
- }
*/
}
diff --git a/weed/server/volume_server_handlers_read.go b/weed/server/volume_server_handlers_read.go
index 5a5495df6..1c963b39c 100644
--- a/weed/server/volume_server_handlers_read.go
+++ b/weed/server/volume_server_handlers_read.go
@@ -159,8 +159,8 @@ func (vs *VolumeServer) GetOrHeadHandler(w http.ResponseWriter, r *http.Request)
if n.Data, err = util.DecompressData(n.Data); err != nil {
glog.V(0).Infoln("ungzip error:", err, r.URL.Path)
}
- // } else if strings.Contains(r.Header.Get("Accept-Encoding"), "zstd") && util.IsZstdContent(n.Data) {
- // w.Header().Set("Content-Encoding", "zstd")
+ // } else if strings.Contains(r.Header.Get("Accept-Encoding"), "zstd") && util.IsZstdContent(n.Data) {
+ // w.Header().Set("Content-Encoding", "zstd")
} else if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") && util.IsGzippedContent(n.Data) {
w.Header().Set("Content-Encoding", "gzip")
} else {
diff --git a/weed/shell/command_fs_configure.go b/weed/shell/command_fs_configure.go
index 8def10d03..d530b2585 100644
--- a/weed/shell/command_fs_configure.go
+++ b/weed/shell/command_fs_configure.go
@@ -107,7 +107,7 @@ func (c *commandFsConfigure) Do(args []string, commandEnv *CommandEnv, writer io
if err != nil {
return fmt.Errorf("parse replication %s: %v", *replication, err)
}
- if *volumeGrowthCount % rp.GetCopyCount() != 0 {
+ if *volumeGrowthCount%rp.GetCopyCount() != 0 {
return fmt.Errorf("volumeGrowthCount %d should be devided by replication copy count %d", *volumeGrowthCount, rp.GetCopyCount())
}
}
diff --git a/weed/storage/needle/needle_parse_upload.go b/weed/storage/needle/needle_parse_upload.go
index 84e69c73e..8f457be1d 100644
--- a/weed/storage/needle/needle_parse_upload.go
+++ b/weed/storage/needle/needle_parse_upload.go
@@ -18,11 +18,11 @@ import (
)
type ParsedUpload struct {
- FileName string
- Data []byte
- MimeType string
- PairMap map[string]string
- IsGzipped bool
+ FileName string
+ Data []byte
+ MimeType string
+ PairMap map[string]string
+ IsGzipped bool
// IsZstd bool
OriginalDataSize int
ModifiedTime uint64
diff --git a/weed/util/compression.go b/weed/util/compression.go
index 33506834b..9d52810cb 100644
--- a/weed/util/compression.go
+++ b/weed/util/compression.go
@@ -55,15 +55,14 @@ func GzipData(input []byte) ([]byte, error) {
return buf.Bytes(), nil
}
-
func DecompressData(input []byte) ([]byte, error) {
if IsGzippedContent(input) {
return ungzipData(input)
}
/*
- if IsZstdContent(input) {
- return unzstdData(input)
- }
+ if IsZstdContent(input) {
+ return unzstdData(input)
+ }
*/
return input, UnsupportedCompression
}