aboutsummaryrefslogtreecommitdiff
path: root/weed/filesys/wfs.go
diff options
context:
space:
mode:
authorChris Lu <chris.lu@gmail.com>2018-07-14 21:09:21 -0700
committerChris Lu <chris.lu@gmail.com>2018-07-14 21:09:21 -0700
commit7abfab8e77275f97cbc04e048e7d6b6a5ab7b140 (patch)
tree99d824138c77f7c56d8adeb8302ed4a5ba976c46 /weed/filesys/wfs.go
parent3edfe1d28f6cfa9f33fd591b1a4e40c9c592604a (diff)
downloadseaweedfs-7abfab8e77275f97cbc04e048e7d6b6a5ab7b140.tar.xz
seaweedfs-7abfab8e77275f97cbc04e048e7d6b6a5ab7b140.zip
add feature to mount a specific filer path to local directory
Diffstat (limited to 'weed/filesys/wfs.go')
-rw-r--r--weed/filesys/wfs.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go
index 56b69a8ac..2f885d0af 100644
--- a/weed/filesys/wfs.go
+++ b/weed/filesys/wfs.go
@@ -9,10 +9,12 @@ import (
"bazil.org/fuse"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
+ "strings"
)
type WFS struct {
filerGrpcAddress string
+ filerMountRootPath string
listDirectoryEntriesCache *ccache.Cache
collection string
replication string
@@ -26,9 +28,13 @@ type WFS struct {
pathToHandleLock sync.Mutex
}
-func NewSeaweedFileSystem(filerGrpcAddress string, collection string, replication string, ttlSec int32, chunkSizeLimitMB int, dataCenter string) *WFS {
+func NewSeaweedFileSystem(filerGrpcAddress string, filerMountRootPath string, collection string, replication string, ttlSec int32, chunkSizeLimitMB int, dataCenter string) *WFS {
+ if filerMountRootPath != "/" && strings.HasSuffix(filerMountRootPath, "/") {
+ filerMountRootPath = filerMountRootPath[0:len(filerMountRootPath)-1]
+ }
return &WFS{
filerGrpcAddress: filerGrpcAddress,
+ filerMountRootPath: filerMountRootPath,
listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(6000).ItemsToPrune(100)),
collection: collection,
replication: replication,
@@ -40,7 +46,7 @@ func NewSeaweedFileSystem(filerGrpcAddress string, collection string, replicatio
}
func (wfs *WFS) Root() (fs.Node, error) {
- return &Dir{Path: "/", wfs: wfs}, nil
+ return &Dir{Path: wfs.filerMountRootPath, wfs: wfs}, nil
}
func (wfs *WFS) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error {