diff options
| author | Chris Lu <chris.lu@gmail.com> | 2020-03-23 00:01:34 -0700 |
|---|---|---|
| committer | Chris Lu <chris.lu@gmail.com> | 2020-03-23 00:01:34 -0700 |
| commit | c0f0fdb3baeb6e9852c6876b23c1404b2c5e833d (patch) | |
| tree | b52ffd7ac51e5c0472f0d0e2a8f5b1338cbf270c /weed/filesys/wfs.go | |
| parent | fbca6b29bd48eeed54511a9b53b937597eee5d19 (diff) | |
| download | seaweedfs-c0f0fdb3baeb6e9852c6876b23c1404b2c5e833d.tar.xz seaweedfs-c0f0fdb3baeb6e9852c6876b23c1404b2c5e833d.zip | |
refactoring
Diffstat (limited to 'weed/filesys/wfs.go')
| -rw-r--r-- | weed/filesys/wfs.go | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 382617384..a7475da56 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -12,10 +12,10 @@ import ( "github.com/karlseguin/ccache" "google.golang.org/grpc" - "github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/pb" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" + "github.com/chrislusf/seaweedfs/weed/util" "github.com/seaweedfs/fuse" "github.com/seaweedfs/fuse/fs" ) @@ -54,7 +54,7 @@ type WFS struct { // contains all open handles, protected by handlesLock handlesLock sync.Mutex handles []*FileHandle - pathToHandleIndex map[filer2.FullPath]int + pathToHandleIndex map[util.FullPath]int bufPool sync.Pool @@ -74,7 +74,7 @@ func NewSeaweedFileSystem(option *Option) *WFS { wfs := &WFS{ option: option, listDirectoryEntriesCache: ccache.New(ccache.Configure().MaxSize(option.DirListCacheLimit * 3).ItemsToPrune(100)), - pathToHandleIndex: make(map[filer2.FullPath]int), + pathToHandleIndex: make(map[util.FullPath]int), bufPool: sync.Pool{ New: func() interface{} { return make([]byte, option.ChunkSizeLimit) @@ -84,7 +84,7 @@ func NewSeaweedFileSystem(option *Option) *WFS { } wfs.root = &Dir{Path: wfs.option.FilerMountRootPath, wfs: wfs} - wfs.getNode(filer2.FullPath(wfs.option.FilerMountRootPath), func() fs.Node { + wfs.getNode(util.FullPath(wfs.option.FilerMountRootPath), func() fs.Node { return wfs.root }) @@ -142,7 +142,7 @@ func (wfs *WFS) AcquireHandle(file *File, uid, gid uint32) (fileHandle *FileHand return } -func (wfs *WFS) ReleaseHandle(fullpath filer2.FullPath, handleId fuse.HandleID) { +func (wfs *WFS) ReleaseHandle(fullpath util.FullPath, handleId fuse.HandleID) { wfs.handlesLock.Lock() defer wfs.handlesLock.Unlock() @@ -217,25 +217,25 @@ func (wfs *WFS) Statfs(ctx context.Context, req *fuse.StatfsRequest, resp *fuse. return nil } -func (wfs *WFS) cacheGet(path filer2.FullPath) *filer_pb.Entry { +func (wfs *WFS) cacheGet(path util.FullPath) *filer_pb.Entry { item := wfs.listDirectoryEntriesCache.Get(string(path)) if item != nil && !item.Expired() { return item.Value().(*filer_pb.Entry) } return nil } -func (wfs *WFS) cacheSet(path filer2.FullPath, entry *filer_pb.Entry, ttl time.Duration) { +func (wfs *WFS) cacheSet(path util.FullPath, entry *filer_pb.Entry, ttl time.Duration) { if entry == nil { wfs.listDirectoryEntriesCache.Delete(string(path)) } else { wfs.listDirectoryEntriesCache.Set(string(path), entry, ttl) } } -func (wfs *WFS) cacheDelete(path filer2.FullPath) { +func (wfs *WFS) cacheDelete(path util.FullPath) { wfs.listDirectoryEntriesCache.Delete(string(path)) } -func (wfs *WFS) getNode(fullpath filer2.FullPath, fn func() fs.Node) fs.Node { +func (wfs *WFS) getNode(fullpath util.FullPath, fn func() fs.Node) fs.Node { wfs.nodesLock.Lock() defer wfs.nodesLock.Unlock() @@ -250,7 +250,7 @@ func (wfs *WFS) getNode(fullpath filer2.FullPath, fn func() fs.Node) fs.Node { return node } -func (wfs *WFS) forgetNode(fullpath filer2.FullPath) { +func (wfs *WFS) forgetNode(fullpath util.FullPath) { wfs.nodesLock.Lock() defer wfs.nodesLock.Unlock() |
