mv filer proto to filer_pb

This commit is contained in:
Chris Lu
2018-05-09 23:18:02 -07:00
parent 942c2cbd7b
commit 9f345da20f
8 changed files with 96 additions and 92 deletions

View File

@@ -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,

View File

@@ -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),
}

View File

@@ -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)
}