mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #1099 from iliul/enhanced-api-logic
enhanced master api logic
This commit is contained in:
commit
08c83b1a59
|
@ -18,9 +18,10 @@ import (
|
|||
)
|
||||
|
||||
func (ms *MasterServer) collectionDeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
collection, ok := ms.Topo.FindCollection(r.FormValue("collection"))
|
||||
collectionName := r.FormValue("collection")
|
||||
collection, ok := ms.Topo.FindCollection(collectionName)
|
||||
if !ok {
|
||||
writeJsonError(w, r, http.StatusBadRequest, fmt.Errorf("collection %s does not exist", r.FormValue("collection")))
|
||||
writeJsonError(w, r, http.StatusBadRequest, fmt.Errorf("collection %s does not exist", collectionName))
|
||||
return
|
||||
}
|
||||
for _, server := range collection.ListVolumeServers() {
|
||||
|
@ -35,7 +36,10 @@ func (ms *MasterServer) collectionDeleteHandler(w http.ResponseWriter, r *http.R
|
|||
return
|
||||
}
|
||||
}
|
||||
ms.Topo.DeleteCollection(r.FormValue("collection"))
|
||||
ms.Topo.DeleteCollection(collectionName)
|
||||
|
||||
w.WriteHeader(http.StatusNoContent)
|
||||
return
|
||||
}
|
||||
|
||||
func (ms *MasterServer) dirStatusHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -53,6 +57,7 @@ func (ms *MasterServer) volumeVacuumHandler(w http.ResponseWriter, r *http.Reque
|
|||
gcThreshold, err = strconv.ParseFloat(gcString, 32)
|
||||
if err != nil {
|
||||
glog.V(0).Infof("garbageThreshold %s is not a valid float number: %v", gcString, err)
|
||||
writeJsonError(w, r, http.StatusNotAcceptable, fmt.Errorf("garbageThreshold %s is not a valid float number", gcString))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ func (t *Topology) ToMap() interface{} {
|
|||
}
|
||||
}
|
||||
}
|
||||
m["layouts"] = layouts
|
||||
m["Layouts"] = layouts
|
||||
return m
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue