func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) { n := new(storage.Needle) vid, fid, _, _, _ := parseURLPath(r.URL.Path) volumeId, _ := storage.NewVolumeId(vid) n.ParsePath(fid) glog.V(2).Infoln("deleting", n) cookie := n.Cookie count, ok := vs.store.Read(volumeId, n) if ok != nil { m := make(map[string]uint32) m["size"] = 0 writeJsonQuiet(w, r, m) return } if n.Cookie != cookie { glog.V(0).Infoln("delete", r.URL.Path, "with unmaching cookie from ", r.RemoteAddr, "agent", r.UserAgent()) return } //级联删除 n.Size = 0 ret := topology.ReplicatedDelete(vs.masterNode, vs.store, volumeId, n, r) if ret != 0 { w.WriteHeader(http.StatusAccepted) } else { w.WriteHeader(http.StatusInternalServerError) } m := make(map[string]uint32) m["size"] = uint32(count) writeJsonQuiet(w, r, m) }