mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
delete file return needle size
This commit is contained in:
parent
34963de458
commit
a9a336fdff
|
@ -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 := make(map[string]int64)
|
||||||
m["size"] = uint32(count)
|
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…
Reference in a new issue