SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
remove unused register file function
Chris Luebf58709d3c0
diff --git a/weed/operation/filer/register.go b/weed/operation/filer/register.godeleted file mode 100644index 655fee1ffa..0000000000--- a/weed/operation/filer/register.go+++ /dev/null@@ -1,36 +0,0 @@-package filer--import (- "fmt"- "net/url"-- "github.com/chrislusf/seaweedfs/weed/security"- "github.com/chrislusf/seaweedfs/weed/util"- "strconv"-)--type SubmitResult struct {- FileName string `json:"fileName,omitempty"`- FileUrl string `json:"fileUrl,omitempty"`- Fid string `json:"fid,omitempty"`- Size uint32 `json:"size,omitempty"`- Error string `json:"error,omitempty"`-}--func RegisterFile(filer string, path string, fileId string, fileSize int64, mime string, uid, gid int, secret security.Secret) error {- // TODO: jwt need to be used- _ = security.GenJwt(secret, fileId)-- values := make(url.Values)- values.Add("path", path)- values.Add("fileId", fileId)- values.Add("fileSize", strconv.FormatInt(fileSize, 10))- values.Add("uid", strconv.Itoa(uid))- values.Add("gid", strconv.Itoa(gid))- values.Add("mime", mime)- _, err := util.Post("http://"+filer+"/admin/register", values)- if err != nil {- return fmt.Errorf("Failed to register path %s on filer %s to file id %s : %v", path, filer, fileId, err)- }- return nil-}diff --git a/weed/server/filer_server.go b/weed/server/filer_server.goindex 827971a0d0..6da6b5561a 100644--- a/weed/server/filer_server.go+++ b/weed/server/filer_server.go@@ -51,7 +51,6 @@ func NewFilerServer(defaultMux, readonlyMux *http.ServeMux, ip string, port int,fs.filer.LoadConfiguration()- defaultMux.HandleFunc("/admin/register", fs.registerHandler)defaultMux.HandleFunc("/favicon.ico", faviconHandler)defaultMux.HandleFunc("/", fs.filerHandler)if defaultMux != readonlyMux {diff --git a/weed/server/filer_server_handlers_admin.go b/weed/server/filer_server_handlers_admin.godeleted file mode 100644index 93a2ab883a..0000000000--- a/weed/server/filer_server_handlers_admin.go+++ /dev/null@@ -1,60 +0,0 @@-package weed_server--import (- "net/http"-- "github.com/chrislusf/seaweedfs/weed/filer2"- "github.com/chrislusf/seaweedfs/weed/glog"- "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"- "strconv"- "time"- "fmt"-)--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(0).Infof("register %s to %s parse fileSize %s: %v", fileId, path, r.FormValue("fileSize"), err)- writeJsonError(w, r, http.StatusInternalServerError, fmt.Errorf("parsing fileSize: %v", err))- return- }- uid, err := strconv.ParseUint(r.FormValue("uid"), 10, 64)- if err != nil && r.FormValue("uid") != "" {- glog.V(0).Infof("register %s to %s parse uid %s: %v", fileId, path, r.FormValue("uid"), err)- writeJsonError(w, r, http.StatusInternalServerError, fmt.Errorf("parsing uid: %v", err))- return- }- gid, err := strconv.ParseUint(r.FormValue("gid"), 10, 64)- if err != nil && r.FormValue("gid") != "" {- glog.V(0).Infof("register %s to %s parse gid %s: %v", fileId, path, r.FormValue("gid"), err)- writeJsonError(w, r, http.StatusInternalServerError, fmt.Errorf("parsing gid: %v", err))- return- }- mime := r.FormValue("mime")- entry := &filer2.Entry{- FullPath: filer2.FullPath(path),- Attr: filer2.Attr{- Mode: 0660,- Crtime: time.Now(),- Mtime: time.Now(),- Uid: uint32(uid),- Gid: uint32(gid),- Mime: mime,- },- Chunks: []*filer_pb.FileChunk{{- FileId: fileId,- Size: fileSize,- Mtime: time.Now().UnixNano(),- }},- }- glog.V(2).Infof("register %s to %s parse fileSize %s", fileId, path, r.FormValue("fileSize"))- err = fs.filer.CreateEntry(entry)- if err != nil {- glog.V(0).Infof("register %s to %s error: %v", fileId, path, err)- writeJsonError(w, r, http.StatusInternalServerError, fmt.Errorf("create %s: %v", path, err))- } else {- w.WriteHeader(http.StatusOK)- }-}