aboutsummaryrefslogtreecommitdiff
path: root/weed/server
diff options
context:
space:
mode:
author霍晓栋 <huoxd@jiedaibao.com>2016-06-26 10:50:18 +0800
committer霍晓栋 <huoxd@jiedaibao.com>2016-06-26 10:50:18 +0800
commit1f630945422953429eff852a6b6a03b9c004e9ca (patch)
treee966a0a726f77ab52c8c25c4bba4252368abb913 /weed/server
parentc601ef03b15d30e726ea86c070a2cb79035c37c9 (diff)
downloadseaweedfs-1f630945422953429eff852a6b6a03b9c004e9ca.tar.xz
seaweedfs-1f630945422953429eff852a6b6a03b9c004e9ca.zip
refactor Volume Assign function
Diffstat (limited to 'weed/server')
-rw-r--r--weed/server/common.go8
-rw-r--r--weed/server/filer_server_handlers_write.go8
2 files changed, 14 insertions, 2 deletions
diff --git a/weed/server/common.go b/weed/server/common.go
index 312bcea14..dcd31f823 100644
--- a/weed/server/common.go
+++ b/weed/server/common.go
@@ -94,7 +94,13 @@ func submitForClientHandler(w http.ResponseWriter, r *http.Request, masterUrl st
debug("assigning file id for", fname)
r.ParseForm()
- assignResult, ae := operation.Assign(masterUrl, 1, r.FormValue("replication"), r.FormValue("collection"), r.FormValue("ttl"))
+ ar := &operation.VolumeAssignRequest{
+ Count: 1,
+ Replication: r.FormValue("replication"),
+ Collection: r.FormValue("collection"),
+ Ttl: r.FormValue("ttl"),
+ }
+ assignResult, ae := operation.Assign(masterUrl, ar)
if ae != nil {
writeJsonError(w, r, http.StatusInternalServerError, ae)
return
diff --git a/weed/server/filer_server_handlers_write.go b/weed/server/filer_server_handlers_write.go
index 597004f7d..e2d40f532 100644
--- a/weed/server/filer_server_handlers_write.go
+++ b/weed/server/filer_server_handlers_write.go
@@ -87,7 +87,13 @@ func (fs *FilerServer) queryFileInfoByPath(w http.ResponseWriter, r *http.Reques
}
func (fs *FilerServer) assignNewFileInfo(w http.ResponseWriter, r *http.Request, replication, collection string) (fileId, urlLocation string, err error) {
- assignResult, ae := operation.Assign(fs.getMasterNode(), 1, replication, collection, r.URL.Query().Get("ttl"))
+ ar := &operation.VolumeAssignRequest{
+ Count: 1,
+ Replication: replication,
+ Collection: collection,
+ Ttl: r.URL.Query().Get("ttl"),
+ }
+ assignResult, ae := operation.Assign(fs.getMasterNode(), ar)
if ae != nil {
glog.V(0).Infoln("failing to assign a file id", ae.Error())
writeJsonError(w, r, http.StatusInternalServerError, ae)