aboutsummaryrefslogtreecommitdiff
path: root/weed/shell/command_remote_meta_sync.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2021-08-15 12:38:26 -0700
committerChris Lu <chris.lu@gmail.com>2021-08-15 12:38:26 -0700
commit49b5e47bd13032a720e0236e65f92eb96933838b (patch)
tree22242a51add017df6191ce885e078089b0f802f7 /weed/shell/command_remote_meta_sync.go
parentfda2fc47b1bed30b606539c8caad5e289376382f (diff)
downloadseaweedfs-49b5e47bd13032a720e0236e65f92eb96933838b.tar.xz
seaweedfs-49b5e47bd13032a720e0236e65f92eb96933838b.zip
retry forever with filer.remote.sync, and some refactoring
Diffstat (limited to 'weed/shell/command_remote_meta_sync.go')
-rw-r--r--weed/shell/command_remote_meta_sync.go28
1 files changed, 1 insertions, 27 deletions
diff --git a/weed/shell/command_remote_meta_sync.go b/weed/shell/command_remote_meta_sync.go
index d2b88ec16..08d08a46d 100644
--- a/weed/shell/command_remote_meta_sync.go
+++ b/weed/shell/command_remote_meta_sync.go
@@ -9,7 +9,6 @@ import (
"github.com/chrislusf/seaweedfs/weed/remote_storage"
"github.com/chrislusf/seaweedfs/weed/util"
"io"
- "strings"
)
func init() {
@@ -69,32 +68,7 @@ func (c *commandRemoteMetaSync) Do(args []string, commandEnv *CommandEnv, writer
}
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, nil, listErr
- }
- if dir == "" {
- return mappings, "", nil, nil, fmt.Errorf("need to specify '-dir' option")
- }
-
- var localMountedDir string
- var remoteStorageMountedLocation *filer_pb.RemoteStorageLocation
- for k, loc := range mappings.Mappings {
- if strings.HasPrefix(dir, k) {
- localMountedDir, remoteStorageMountedLocation = k, loc
- }
- }
- if localMountedDir == "" {
- 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 mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, err
- }
-
- return mappings, localMountedDir, remoteStorageMountedLocation, remoteStorageConf, nil
+ return filer.DetectMountInfo(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress, dir)
}
/*