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
refactor
Chris Lua539d6489639
diff --git a/weed/shell/command_remote_cache.go b/weed/shell/command_remote_cache.goindex 21c479258e..f032239f3c 100644--- a/weed/shell/command_remote_cache.go+++ b/weed/shell/command_remote_cache.go@@ -52,8 +52,9 @@ func (c *commandRemoteCache) Do(args []string, commandEnv *CommandEnv, writer ioreturn nil}- localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, *dir)+ mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, *dir)if detectErr != nil{+ jsonPrintln(writer, mappings)return detectErr}diff --git a/weed/shell/command_remote_meta_sync.go b/weed/shell/command_remote_meta_sync.goindex b6fb15a62e..d2b88ec161 100644--- a/weed/shell/command_remote_meta_sync.go+++ b/weed/shell/command_remote_meta_sync.go@@ -54,8 +54,9 @@ func (c *commandRemoteMetaSync) Do(args []string, commandEnv *CommandEnv, writerreturn nil}- localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, *dir)+ mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, detectErr := detectMountInfo(commandEnv, writer, *dir)if detectErr != nil{+ jsonPrintln(writer, mappings)return detectErr}@@ -67,14 +68,13 @@ func (c *commandRemoteMetaSync) Do(args []string, commandEnv *CommandEnv, writerreturn nil}-func detectMountInfo(commandEnv *CommandEnv, writer io.Writer, dir string) (string, *filer_pb.RemoteStorageLocation, *filer_pb.RemoteConf, error) {+func detectMountInfo(commandEnv *CommandEnv, writer io.Writer, dir string) (*filer_pb.RemoteStorageMapping, string, *filer_pb.RemoteStorageLocation, *filer_pb.RemoteConf, error) {mappings, listErr := filer.ReadMountMappings(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress)if listErr != nil {- return "", nil, nil, listErr+ return nil, "", nil, nil, listErr}if dir == "" {- jsonPrintln(writer, mappings)- return "", nil, nil, fmt.Errorf("need to specify '-dir' option")+ return mappings, "", nil, nil, fmt.Errorf("need to specify '-dir' option")}var localMountedDir string@@ -85,17 +85,16 @@ func detectMountInfo(commandEnv *CommandEnv, writer io.Writer, dir string) (stri}}if localMountedDir == "" {- jsonPrintln(writer, mappings)- return "", nil, nil, fmt.Errorf("%s is not mounted", dir)+ return mappings, localMountedDir, remoteStorageMountedLocation, nil, fmt.Errorf("%s is not mounted", dir)}// find remote storage configurationremoteStorageConf, err := filer.ReadRemoteStorageConf(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress, remoteStorageMountedLocation.Name)if err != nil {- return "", nil, nil, err+ return mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, err}- return localMountedDir, remoteStorageMountedLocation, remoteStorageConf, nil+ return mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, nil}/*diff --git a/weed/shell/command_remote_mount.go b/weed/shell/command_remote_mount.goindex 077c64e94c..f675d706ed 100644--- a/weed/shell/command_remote_mount.go+++ b/weed/shell/command_remote_mount.go@@ -95,6 +95,9 @@ func listExistingRemoteStorageMounts(commandEnv *CommandEnv, writer io.Writer) (}func jsonPrintln(writer io.Writer, message proto.Message) error {+ if message == nil {+ return nil+ }m := jsonpb.Marshaler{EmitDefaults: false,Indent: " ",