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
Consistent result format when error happens
Chris Lu72490bc00fcb
diff --git a/go/weed/upload.go b/go/weed/upload.goindex 9d5ab6186b..d05930165e 100644--- a/go/weed/upload.go+++ b/go/weed/upload.go@@ -92,11 +92,17 @@ type SubmitResult struct {}func submit(files []string) ([]SubmitResult, error) {+ results := make([]SubmitResult, len(files))+ for index, file := range files {+ results[index].FileName = file+ }ret, err := assign(len(files))if err != nil {- return nil, err+ for index, _ := range files {+ results[index].Error = err.Error()+ }+ return results, err}- results := make([]SubmitResult, len(files))for index, file := range files {fid := ret.Fidif index > 0 {@@ -107,7 +113,6 @@ func submit(files []string) ([]SubmitResult, error) {fid = ""results[index].Error = err.Error()}- results[index].FileName = fileresults[index].Fid = fidresults[index].FileUrl = ret.PublicUrl + "/" + fid}@@ -121,25 +126,19 @@ func runUpload(cmd *Command, args []string) bool {}filepath.Walk(*uploadDir, func(path string, info os.FileInfo, err error) error {if !info.IsDir() {- if results, err := submit([]string{path}); err == nil {- bytes, _ := json.Marshal(results)- if bytes != nil {- fmt.Println(string(bytes))- }- } else {- fmt.Println(err, "when uploading", path)- return err+ results, e := submit([]string{path})+ bytes, _ := json.Marshal(results)+ fmt.Println(string(bytes))+ if e != nil {+ return e}}return err})} else {- if results, err := submit(args); err == nil {- bytes, _ := json.Marshal(results)- fmt.Println(string(bytes))- } else {- fmt.Println(err)- }+ results, _ := submit(args)+ bytes, _ := json.Marshal(results)+ fmt.Println(string(bytes))}return true}