mirror of
https://github.com/chrislusf/seaweedfs
synced 2024-09-16 22:10:42 +02:00
refactoring
This commit is contained in:
parent
38e73463f1
commit
782d776d2a
|
@ -5,7 +5,6 @@ import (
|
||||||
"io"
|
"io"
|
||||||
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/filer2"
|
"github.com/chrislusf/seaweedfs/weed/filer2"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb"
|
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
)
|
)
|
||||||
|
@ -82,14 +81,3 @@ func duTraverseDirectory(writer io.Writer, filerClient filer_pb.FilerClient, dir
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (env *CommandEnv) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {
|
|
||||||
|
|
||||||
filerGrpcAddress := fmt.Sprintf("%s:%d", env.option.FilerHost, env.option.FilerPort+10000)
|
|
||||||
return pb.WithGrpcFilerClient(filerGrpcAddress, env.option.GrpcDialOption, fn)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func (env *CommandEnv) AdjustedUrl(hostAndPort string) string {
|
|
||||||
return hostAndPort
|
|
||||||
}
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import (
|
||||||
|
|
||||||
"google.golang.org/grpc"
|
"google.golang.org/grpc"
|
||||||
|
|
||||||
|
"github.com/chrislusf/seaweedfs/weed/pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
|
||||||
"github.com/chrislusf/seaweedfs/weed/util"
|
"github.com/chrislusf/seaweedfs/weed/util"
|
||||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||||
|
@ -79,6 +80,18 @@ func (ce *CommandEnv) checkDirectory(path string) error {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ce *CommandEnv) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {
|
||||||
|
|
||||||
|
filerGrpcAddress := fmt.Sprintf("%s:%d", ce.option.FilerHost, ce.option.FilerPort+10000)
|
||||||
|
return pb.WithGrpcFilerClient(filerGrpcAddress, ce.option.GrpcDialOption, fn)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
func (ce *CommandEnv) AdjustedUrl(hostAndPort string) string {
|
||||||
|
return hostAndPort
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
func parseFilerUrl(entryPath string) (filerServer string, filerPort int64, path string, err error) {
|
func parseFilerUrl(entryPath string) (filerServer string, filerPort int64, path string, err error) {
|
||||||
if strings.HasPrefix(entryPath, "http") {
|
if strings.HasPrefix(entryPath, "http") {
|
||||||
var u *url.URL
|
var u *url.URL
|
||||||
|
|
Loading…
Reference in a new issue