diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-08-15 12:09:54 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-08-15 12:09:54 -0700 |
| commit | a539d6489639217c1b2fded6ff7238b2d5e7b5da (patch) | |
| tree | 8ba759ebc75b6da4706d93849eb807d75892238d /weed/shell/command_remote_meta_sync.go | |
| parent | 8f7d2d317f7a5b30068e429adcdb9e00bc01d0e4 (diff) | |
| download | seaweedfs-a539d6489639217c1b2fded6ff7238b2d5e7b5da.tar.xz seaweedfs-a539d6489639217c1b2fded6ff7238b2d5e7b5da.zip | |
refactor
Diffstat (limited to 'weed/shell/command_remote_meta_sync.go')
| -rw-r--r-- | weed/shell/command_remote_meta_sync.go | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/weed/shell/command_remote_meta_sync.go b/weed/shell/command_remote_meta_sync.go index b6fb15a62..d2b88ec16 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, writer return 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, writer return 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 configuration remoteStorageConf, 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 } /* |
