diff options
| author | Chris Lu <chris.lu@gmail.com> | 2021-01-24 01:41:38 -0800 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2021-01-24 01:41:38 -0800 |
| commit | 096e088d7bb2a5dce7573b24c2d3006d1cb6f9ec (patch) | |
| tree | 888668ade913d7e8b912fd73b781c52ae3a700a1 /weed/filesys/wfs.go | |
| parent | ccbdb38c89a79a482c46faaa9b0dd53e3dacb822 (diff) | |
| download | seaweedfs-096e088d7bb2a5dce7573b24c2d3006d1cb6f9ec.tar.xz seaweedfs-096e088d7bb2a5dce7573b24c2d3006d1cb6f9ec.zip | |
mount: when outside cluster network, use filer as proxy to access volume servers
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) + +} |
