format changes

This commit is contained in:
chrislusf
2015-12-14 22:38:58 -08:00
parent df5e54e02a
commit e921cb1a9d
9 changed files with 30 additions and 34 deletions

View File

@@ -3,11 +3,9 @@ package main
import (
"fmt"
"io"
"io/ioutil"
"os"
"path"
"io/ioutil"
"strings"
"github.com/chrislusf/seaweedfs/go/operation"

View File

@@ -1,18 +1,16 @@
package weed_server
import (
"bytes"
"io"
"mime"
"mime/multipart"
"net/http"
"path"
"strconv"
"strings"
"time"
"path"
"bytes"
"github.com/chrislusf/seaweedfs/go/glog"
"github.com/chrislusf/seaweedfs/go/images"
"github.com/chrislusf/seaweedfs/go/operation"
@@ -135,15 +133,10 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *storage.Needle, fileName string,
if !n.IsChunkedManifest() {
return false
}
raw, _ := strconv.ParseBool(r.FormValue("raw"))
if raw {
return false
}
processed = true
chunkManifest, e := operation.LoadChunkManifest(n.Data, n.IsGzipped())
if e != nil {
glog.V(0).Infof("load chunked manifest (%s) error: %s", r.URL.Path, e.Error())
glog.V(0).Infof("load chunked manifest (%s) error: %v", r.URL.Path, e)
return false
}
if fileName == "" && chunkManifest.Name != "" {
@@ -167,7 +160,7 @@ func (vs *VolumeServer) tryHandleChunkedFile(n *storage.Needle, fileName string,
if e := writeResponseContent(fileName, mType, chunkedFileReader, w, r); e != nil {
glog.V(2).Infoln("response write error:", e)
}
return
return true
}
func writeResponseContent(filename, mimeType string, rs io.ReadSeeker, w http.ResponseWriter, r *http.Request) error {

View File

@@ -2,6 +2,7 @@ package weed_server
import (
"errors"
"fmt"
"net/http"
"github.com/chrislusf/seaweedfs/go/glog"
@@ -72,12 +73,12 @@ func (vs *VolumeServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
if n.IsChunkedManifest() {
chunkManifest, e := operation.LoadChunkManifest(n.Data, n.IsGzipped())
if e != nil {
writeJsonError(w, r, http.StatusInternalServerError, errors.New("Load chunks manifest error: "+e.Error()))
writeJsonError(w, r, http.StatusInternalServerError, fmt.Errorf("Load chunks manifest error: %v", e))
return
}
// make sure all chunks had deleted before delete manifest
if e := chunkManifest.DeleteChunks(vs.GetMasterNode()); e != nil {
writeJsonError(w, r, http.StatusInternalServerError, errors.New("Delete chunks error: "+e.Error()))
writeJsonError(w, r, http.StatusInternalServerError, fmt.Errorf("Delete chunks error: %v", e))
return
}
count = chunkManifest.Size
@@ -123,11 +124,10 @@ func (vs *VolumeServer) batchDeleteHandler(w http.ResponseWriter, r *http.Reques
}
if n.IsChunkedManifest() {
//Don't allow delete manifest in batch delete mode
ret = append(ret, operation.DeleteResult{
Fid: fid,
Status: http.StatusNotAcceptable,
Error: "ChunkManifest: not allow.",
Error: "ChunkManifest: not allowed in batch delete mode.",
})
continue
}