You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
package weed_server
import ( "net/http"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/filer2" "strconv" )
func (fs *FilerServer) registerHandler(w http.ResponseWriter, r *http.Request) { path := r.FormValue("path") fileId := r.FormValue("fileId") fileSize, err := strconv.ParseUint(r.FormValue("fileSize"), 10, 64) if err != nil { glog.V(4).Infof("register %s to %s parse fileSize %s: %v", fileId, path, r.FormValue("fileSize"), err) writeJsonError(w, r, http.StatusInternalServerError, err) return } entry := &filer2.Entry{ FullPath: filer2.FullPath(path), Attr: filer2.Attr{ Mode: 0660, }, Chunks: []filer2.FileChunk{{ Fid: filer2.FileId(fileId), Size: fileSize, }}, } err = fs.filer.CreateEntry(entry) if err != nil { glog.V(4).Infof("register %s to %s error: %v", fileId, path, err) writeJsonError(w, r, http.StatusInternalServerError, err) } else { w.WriteHeader(http.StatusOK) } }
|