diff options
Diffstat (limited to 'weed/filesys')
| -rw-r--r-- | weed/filesys/dir.go | 17 | ||||
| -rw-r--r-- | weed/filesys/file.go | 9 | ||||
| -rw-r--r-- | weed/filesys/wfs.go | 6 |
3 files changed, 17 insertions, 15 deletions
diff --git a/weed/filesys/dir.go b/weed/filesys/dir.go index fa4b81eba..c1c6afe9c 100644 --- a/weed/filesys/dir.go +++ b/weed/filesys/dir.go @@ -5,12 +5,13 @@ import ( "fmt" "os" "path" + "sync" "bazil.org/fuse/fs" "bazil.org/fuse" "github.com/chrislusf/seaweedfs/weed/filer" - "sync" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" ) type Dir struct { @@ -50,10 +51,10 @@ func (dir *Dir) Lookup(ctx context.Context, name string) (node fs.Node, err erro return node, nil } - var entry *filer.Entry - err = dir.wfs.withFilerClient(func(client filer.SeaweedFilerClient) error { + var entry *filer_pb.Entry + err = dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { - request := &filer.LookupDirectoryEntryRequest{ + request := &filer_pb.LookupDirectoryEntryRequest{ Directory: dir.Path, Name: name, } @@ -84,9 +85,9 @@ func (dir *Dir) Lookup(ctx context.Context, name string) (node fs.Node, err erro func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) { - err = dir.wfs.withFilerClient(func(client filer.SeaweedFilerClient) error { + err = dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { - request := &filer.ListEntriesRequest{ + request := &filer_pb.ListEntriesRequest{ Directory: dir.Path, } @@ -117,9 +118,9 @@ func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error { dir.NodeMapLock.Lock() defer dir.NodeMapLock.Unlock() - return dir.wfs.withFilerClient(func(client filer.SeaweedFilerClient) error { + return dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { - request := &filer.DeleteEntryRequest{ + request := &filer_pb.DeleteEntryRequest{ Directory: dir.Path, Name: req.Name, IsDirectory: req.Dir, diff --git a/weed/filesys/file.go b/weed/filesys/file.go index e743509e9..e4c79c055 100644 --- a/weed/filesys/file.go +++ b/weed/filesys/file.go @@ -8,6 +8,7 @@ import ( "github.com/chrislusf/seaweedfs/weed/filer" "bazil.org/fuse/fs" "github.com/chrislusf/seaweedfs/weed/glog" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" ) var _ = fs.Node(&File{}) @@ -26,9 +27,9 @@ type File struct { func (file *File) Attr(context context.Context, attr *fuse.Attr) error { attr.Mode = 0444 - return file.wfs.withFilerClient(func(client filer.SeaweedFilerClient) error { + return file.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { - request := &filer.GetFileAttributesRequest{ + request := &filer_pb.GetFileAttributesRequest{ Name: file.Name, ParentDir: "", //TODO add parent folder FileId: string(file.FileId), @@ -48,9 +49,9 @@ func (file *File) Attr(context context.Context, attr *fuse.Attr) error { func (file *File) ReadAll(ctx context.Context) (content []byte, err error) { - err = file.wfs.withFilerClient(func(client filer.SeaweedFilerClient) error { + err = file.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { - request := &filer.GetFileContentRequest{ + request := &filer_pb.GetFileContentRequest{ FileId: string(file.FileId), } diff --git a/weed/filesys/wfs.go b/weed/filesys/wfs.go index 583cd34f3..da50ae4a4 100644 --- a/weed/filesys/wfs.go +++ b/weed/filesys/wfs.go @@ -4,7 +4,7 @@ import ( "bazil.org/fuse/fs" "fmt" "google.golang.org/grpc" - "github.com/chrislusf/seaweedfs/weed/filer" + "github.com/chrislusf/seaweedfs/weed/pb/filer_pb" ) type WFS struct { @@ -21,7 +21,7 @@ func (wfs *WFS) Root() (fs.Node, error) { return &Dir{Path: "/", wfs: wfs}, nil } -func (wfs *WFS) withFilerClient(fn func(filer.SeaweedFilerClient) error) error { +func (wfs *WFS) withFilerClient(fn func(filer_pb.SeaweedFilerClient) error) error { grpcConnection, err := grpc.Dial(wfs.filer, grpc.WithInsecure()) if err != nil { @@ -29,7 +29,7 @@ func (wfs *WFS) withFilerClient(fn func(filer.SeaweedFilerClient) error) error { } defer grpcConnection.Close() - client := filer.NewSeaweedFilerClient(grpcConnection) + client := filer_pb.NewSeaweedFilerClient(grpcConnection) return fn(client) } |
