diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-01-24 19:03:02 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-01-24 19:03:02 -0800 |
| commit | 17f7c1c43f8adc1d1e4d795f23cdf60aa0e57c95 (patch) | |
| tree | 16817aa710170550530543e7b1c0f0effd2b2400 /weed/filesys/wfs.go | |
| parent | 9bcb28a3eabcb2c869afc52da6b0341e8e2d8427 (diff) | |
| parent | 00707ec00fb8016ac9ef8858a01a9784a6aee1a0 (diff) | |
| download | seaweedfs-17f7c1c43f8adc1d1e4d795f23cdf60aa0e57c95.tar.xz seaweedfs-17f7c1c43f8adc1d1e4d795f23cdf60aa0e57c95.zip | |
Merge branch 'mount_from_outside_cluster'
Diffstat (limited to 'weed/filesys/wfs.go')
| -rw-r--r-- | weed/filesys/wfs.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index cd14e8032..236ecdacb 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -3,6 +3,8 @@ package filesys import ( "context" "fmt" + "github.com/chrislusf/seaweedfs/weed/filer" + "github.com/chrislusf/seaweedfs/weed/wdclient" "math" "os" "path" @@ -24,6 +26,7 @@ import ( ) type Option struct { + FilerAddress string FilerGrpcAddress string GrpcDialOption grpc.DialOption FilerMountRootPath string @@ -237,3 +240,13 @@ func (wfs *WFS) mapPbIdFromLocalToFiler(entry *filer_pb.Entry) { } entry.Attributes.Uid, entry.Attributes.Gid = wfs.option.UidGidMapper.LocalToFiler(entry.Attributes.Uid, entry.Attributes.Gid) } + +func (wfs *WFS) LookupFn() wdclient.LookupFileIdFunctionType { + if wfs.option.OutsideContainerClusterMode { + return func(fileId string) (targetUrls []string, err error) { + return []string{"http://" + wfs.option.FilerAddress + "/?proxyChunkId=" + fileId}, nil + } + } + return filer.LookupFn(wfs) + +} |
