aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys
diff options
context:
space:
mode:
Diffstat (limited to 'weed/filesys')
-rw-r--r--weed/filesys/wfs.go10
-rw-r--r--weed/filesys/wfs_filer_client.go4
-rw-r--r--weed/filesys/wfs_write.go5
3 files changed, 8 insertions, 11 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 84d4bdfa2..92f6bae38 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -3,6 +3,7 @@ package filesys
import (
"context"
"fmt"
+ "github.com/chrislusf/seaweedfs/weed/pb"
"math"
"math/rand"
"os"
@@ -31,9 +32,8 @@ import (
type Option struct {
MountDirectory string
- FilerAddresses []string
+ FilerAddresses []pb.ServerAddress
filerIndex int
- FilerGrpcAddresses []string
GrpcDialOption grpc.DialOption
FilerMountRootPath string
Collection string
@@ -270,17 +270,17 @@ func (wfs *WFS) mapPbIdFromLocalToFiler(entry *filer_pb.Entry) {
func (wfs *WFS) LookupFn() wdclient.LookupFileIdFunctionType {
if wfs.option.VolumeServerAccess == "filerProxy" {
return func(fileId string) (targetUrls []string, err error) {
- return []string{"http://" + wfs.getCurrentFiler() + "/?proxyChunkId=" + fileId}, nil
+ return []string{"http://" + wfs.getCurrentFiler().ToHttpAddress() + "/?proxyChunkId=" + fileId}, nil
}
}
return filer.LookupFn(wfs)
}
-func (wfs *WFS) getCurrentFiler() string {
+func (wfs *WFS) getCurrentFiler() pb.ServerAddress {
return wfs.option.FilerAddresses[wfs.option.filerIndex]
}
func (option *Option) setupUniqueCacheDirectory() {
- cacheUniqueId := util.Md5String([]byte(option.MountDirectory + option.FilerGrpcAddresses[0] + option.FilerMountRootPath + util.Version()))[0:8]
+ cacheUniqueId := util.Md5String([]byte(option.MountDirectory + string(option.FilerAddresses[0]) + option.FilerMountRootPath + util.Version()))[0:8]
option.uniqueCacheDir = path.Join(option.CacheDir, cacheUniqueId)
option.uniqueCacheTempPageDir = filepath.Join(option.uniqueCacheDir, "sw")
os.MkdirAll(option.uniqueCacheTempPageDir, os.FileMode(0777)&^option.Umask)
diff --git a/weed/filesys/wfs_filer_client.go b/weed/filesys/wfs_filer_client.go
index 95ebdb9b8..cce6aa1a1 100644
--- a/weed/filesys/wfs_filer_client.go
+++ b/weed/filesys/wfs_filer_client.go
@@ -16,10 +16,10 @@ func (wfs *WFS) WithFilerClient(fn func(filer_pb.SeaweedFilerClient) error) (err
return util.Retry("filer grpc", func() error {
i := wfs.option.filerIndex
- n := len(wfs.option.FilerGrpcAddresses)
+ n := len(wfs.option.FilerAddresses)
for x := 0; x < n; x++ {
- filerGrpcAddress := wfs.option.FilerGrpcAddresses[i]
+ filerGrpcAddress := wfs.option.FilerAddresses[i].ToGrpcAddress()
err = pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
return fn(client)
diff --git a/weed/filesys/wfs_write.go b/weed/filesys/wfs_write.go
index ea8de24d5..3d08cb5e2 100644
--- a/weed/filesys/wfs_write.go
+++ b/weed/filesys/wfs_write.go
@@ -41,10 +41,7 @@ func (wfs *WFS) saveDataAsChunk(fullPath util.FullPath, writeOnly bool) filer.Sa
}
fileId, auth = resp.FileId, security.EncodedJwt(resp.Auth)
- loc := &filer_pb.Location{
- Url: resp.Url,
- PublicUrl: resp.PublicUrl,
- }
+ loc := resp.Location
host = wfs.AdjustedUrl(loc)
collection, replication = resp.Collection, resp.Replication