mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-10-21 14:47:24 +08:00
refactoring
This commit is contained in:
@@ -79,20 +79,9 @@ func (c *commandRemoteMount) Do(args []string, commandEnv *CommandEnv, writer io
|
||||
func (c *commandRemoteMount) listExistingRemoteStorageMounts(commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||
|
||||
// read current mapping
|
||||
var oldContent []byte
|
||||
err = commandEnv.WithFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
oldContent, err = filer.ReadInsideFiler(client, filer.DirectoryEtcRemote, filer.REMOTE_STORAGE_MOUNT_FILE)
|
||||
return err
|
||||
})
|
||||
if err != nil {
|
||||
if err != filer_pb.ErrNotFound {
|
||||
return fmt.Errorf("read existing mapping: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
mappings, unmarshalErr := filer.UnmarshalRemoteStorageMappings(oldContent)
|
||||
if unmarshalErr != nil {
|
||||
return unmarshalErr
|
||||
mappings, readErr := remote_storage.ReadMountMappings(commandEnv.option.GrpcDialOption, commandEnv.option.FilerAddress)
|
||||
if readErr != nil {
|
||||
return readErr
|
||||
}
|
||||
|
||||
m := jsonpb.Marshaler{
|
||||
|
@@ -20,9 +20,10 @@ type ShellOptions struct {
|
||||
Masters *string
|
||||
GrpcDialOption grpc.DialOption
|
||||
// shell transient context
|
||||
FilerHost string
|
||||
FilerPort int64
|
||||
Directory string
|
||||
FilerHost string
|
||||
FilerPort int64
|
||||
FilerAddress string
|
||||
Directory string
|
||||
}
|
||||
|
||||
type CommandEnv struct {
|
||||
|
Reference in New Issue
Block a user