Browse Source

delete file return needle size

pull/224/head
tnextday 9 years ago
parent
commit
a9a336fdff
  1. 10
      go/weed/weed_server/volume_server_handlers_write.go

10
go/weed/weed_server/volume_server_handlers_write.go

@ -53,9 +53,8 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
glog.V(2).Infoln("deleting", n) glog.V(2).Infoln("deleting", n)
cookie := n.Cookie cookie := n.Cookie
count, ok := vs.store.ReadVolumeNeedle(volumeId, n)
if ok != nil {
if _, ok := vs.store.ReadVolumeNeedle(volumeId, n); ok != nil {
m := make(map[string]uint32) m := make(map[string]uint32)
m["size"] = 0 m["size"] = 0
writeJsonQuiet(w, r, http.StatusNotFound, m) writeJsonQuiet(w, r, http.StatusNotFound, m)
@ -66,6 +65,9 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
glog.V(0).Infoln("delete", r.URL.Path, "with unmaching cookie from ", r.RemoteAddr, "agent", r.UserAgent()) glog.V(0).Infoln("delete", r.URL.Path, "with unmaching cookie from ", r.RemoteAddr, "agent", r.UserAgent())
return return
} }
count := int64(n.Size)
if n.IsChunkedManifest(){ if n.IsChunkedManifest(){
chunkManifest, e := operation.LoadChunkManifest(n.Data, n.IsGzipped()) chunkManifest, e := operation.LoadChunkManifest(n.Data, n.IsGzipped())
if e != nil { if e != nil {
@ -82,8 +84,8 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
ret := topology.ReplicatedDelete(vs.GetMasterNode(), vs.store, volumeId, n, r) ret := topology.ReplicatedDelete(vs.GetMasterNode(), vs.store, volumeId, n, r)
if ret != 0 { if ret != 0 {
m := make(map[string]uint32)
m["size"] = uint32(count)
m := make(map[string]int64)
m["size"] = count
writeJsonQuiet(w, r, http.StatusAccepted, m) writeJsonQuiet(w, r, http.StatusAccepted, m)
} else { } else {
writeJsonError(w, r, http.StatusInternalServerError, errors.New("Deletion Failed.")) writeJsonError(w, r, http.StatusInternalServerError, errors.New("Deletion Failed."))

Loading…
Cancel
Save