diff options
| author | Chris Lu <chris.lu@gmail.com> | 2013-07-15 21:34:04 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2013-07-15 21:34:04 -0700 |
| commit | b409ccc5ab4bbf46a8b465aa5b374dc2a09036b3 (patch) | |
| tree | 2b0f77c2d17c856c40d88ff27a5acbc6825dbe50 | |
| parent | 5e3b6e968a930a735fcb208bfeda372fe9ba7efc (diff) | |
| download | seaweedfs-b409ccc5ab4bbf46a8b465aa5b374dc2a09036b3.tar.xz seaweedfs-b409ccc5ab4bbf46a8b465aa5b374dc2a09036b3.zip | |
upload respect master default replication setting
| -rw-r--r-- | go/weed/upload.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/go/weed/upload.go b/go/weed/upload.go index 7256093cf..5ecbd7803 100644 --- a/go/weed/upload.go +++ b/go/weed/upload.go @@ -25,7 +25,7 @@ func init() { server = cmdUpload.Flag.String("server", "localhost:9333", "weedfs master location") uploadDir = cmdUpload.Flag.String("dir", "", "Upload the whole folder recursively if specified.") include = cmdUpload.Flag.String("include", "", "pattens of files to upload, e.g., *.pdf, *.html, ab?d.txt, works together with -dir") - uploadReplication = cmdUpload.Flag.String("replication", "000", "replication type(000,001,010,100,110,200)") + uploadReplication = cmdUpload.Flag.String("replication", "", "replication type(000,001,010,100,110,200)") } var cmdUpload = &Command{ @@ -49,7 +49,9 @@ type AssignResult struct { func assign(count int) (*AssignResult, error) { values := make(url.Values) values.Add("count", strconv.Itoa(count)) - values.Add("replication", *uploadReplication) + if *uploadReplication != "" { + values.Add("replication", *uploadReplication) + } jsonBlob, err := util.Post("http://"+*server+"/dir/assign", values) debug("assign result :", string(jsonBlob)) if err != nil { @@ -81,7 +83,7 @@ func upload(filename string, server string, fid string) (int, error) { filename = path.Base(filename) isGzipped := path.Ext(filename) == ".gz" if isGzipped { - filename = filename[0:len(filename)-3] + filename = filename[0 : len(filename)-3] } ret, e := operation.Upload("http://"+server+"/"+fid+"?ts="+strconv.Itoa(int(fi.ModTime().Unix())), filename, fh, isGzipped) if e != nil { |
