mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 01:17:56 +08:00
change server address from string to a type
This commit is contained in:
@@ -27,8 +27,7 @@ import (
|
||||
)
|
||||
|
||||
type WebDavOption struct {
|
||||
Filer string
|
||||
FilerGrpcAddress string
|
||||
Filer pb.ServerAddress
|
||||
DomainName string
|
||||
BucketsPath string
|
||||
GrpcDialOption grpc.DialOption
|
||||
@@ -107,7 +106,7 @@ type WebDavFile struct {
|
||||
|
||||
func NewWebDavFileSystem(option *WebDavOption) (webdav.FileSystem, error) {
|
||||
|
||||
cacheUniqueId := util.Md5String([]byte("webdav" + option.FilerGrpcAddress + util.Version()))[0:8]
|
||||
cacheUniqueId := util.Md5String([]byte("webdav" + string(option.Filer) + util.Version()))[0:8]
|
||||
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
|
||||
|
||||
os.MkdirAll(cacheDir, os.FileMode(0755))
|
||||
@@ -126,7 +125,7 @@ func (fs *WebDavFileSystem) WithFilerClient(fn func(filer_pb.SeaweedFilerClient)
|
||||
return pb.WithCachedGrpcClient(func(grpcConnection *grpc.ClientConn) error {
|
||||
client := filer_pb.NewSeaweedFilerClient(grpcConnection)
|
||||
return fn(client)
|
||||
}, fs.option.FilerGrpcAddress, fs.option.GrpcDialOption)
|
||||
}, fs.option.Filer.ToGrpcAddress(), fs.option.GrpcDialOption)
|
||||
|
||||
}
|
||||
func (fs *WebDavFileSystem) AdjustedUrl(location *filer_pb.Location) string {
|
||||
@@ -398,7 +397,7 @@ func (f *WebDavFile) saveDataAsChunk(reader io.Reader, name string, offset int64
|
||||
return fmt.Errorf("assign volume failure %v: %v", request, resp.Error)
|
||||
}
|
||||
|
||||
fileId, host, auth = resp.FileId, resp.Url, security.EncodedJwt(resp.Auth)
|
||||
fileId, host, auth = resp.FileId, resp.Location.Url, security.EncodedJwt(resp.Auth)
|
||||
f.collection, f.replication = resp.Collection, resp.Replication
|
||||
|
||||
return nil
|
||||
|
Reference in New Issue
Block a user