1
0
Fork 0
mirror of https://github.com/chrislusf/seaweedfs synced 2024-07-01 06:40:45 +02:00

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

@ -11,8 +11,8 @@ import (
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"github.com/soheilhy/cmux" "github.com/soheilhy/cmux"
"google.golang.org/grpc/reflection" "google.golang.org/grpc/reflection"
"github.com/chrislusf/seaweedfs/weed/filer"
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
var ( var (
@ -145,7 +145,7 @@ func (fo *FilerOptions) start() {
// Create your protocol servers. // Create your protocol servers.
grpcS := grpc.NewServer() grpcS := grpc.NewServer()
filer.RegisterSeaweedFilerServer(grpcS, fs) filer_pb.RegisterSeaweedFilerServer(grpcS, fs)
reflection.Register(grpcS) reflection.Register(grpcS)
httpS := &http.Server{Handler: defaultMux} httpS := &http.Server{Handler: defaultMux}

View file

@ -5,12 +5,13 @@ import (
"fmt" "fmt"
"os" "os"
"path" "path"
"sync"
"bazil.org/fuse/fs" "bazil.org/fuse/fs"
"bazil.org/fuse" "bazil.org/fuse"
"github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/filer"
"sync"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
type Dir struct { type Dir struct {
@ -50,10 +51,10 @@ func (dir *Dir) Lookup(ctx context.Context, name string) (node fs.Node, err erro
return node, nil return node, nil
} }
var entry *filer.Entry var entry *filer_pb.Entry
err = dir.wfs.withFilerClient(func(client filer.SeaweedFilerClient) error { err = dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
request := &filer.LookupDirectoryEntryRequest{ request := &filer_pb.LookupDirectoryEntryRequest{
Directory: dir.Path, Directory: dir.Path,
Name: name, 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) { 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, Directory: dir.Path,
} }
@ -117,9 +118,9 @@ func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
dir.NodeMapLock.Lock() dir.NodeMapLock.Lock()
defer dir.NodeMapLock.Unlock() 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, Directory: dir.Path,
Name: req.Name, Name: req.Name,
IsDirectory: req.Dir, IsDirectory: req.Dir,

View file

@ -8,6 +8,7 @@ import (
"github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/filer"
"bazil.org/fuse/fs" "bazil.org/fuse/fs"
"github.com/chrislusf/seaweedfs/weed/glog" "github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
var _ = fs.Node(&File{}) var _ = fs.Node(&File{})
@ -26,9 +27,9 @@ type File struct {
func (file *File) Attr(context context.Context, attr *fuse.Attr) error { func (file *File) Attr(context context.Context, attr *fuse.Attr) error {
attr.Mode = 0444 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, Name: file.Name,
ParentDir: "", //TODO add parent folder ParentDir: "", //TODO add parent folder
FileId: string(file.FileId), 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) { 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), FileId: string(file.FileId),
} }

View file

@ -4,7 +4,7 @@ import (
"bazil.org/fuse/fs" "bazil.org/fuse/fs"
"fmt" "fmt"
"google.golang.org/grpc" "google.golang.org/grpc"
"github.com/chrislusf/seaweedfs/weed/filer" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
type WFS struct { type WFS struct {
@ -21,7 +21,7 @@ func (wfs *WFS) Root() (fs.Node, error) {
return &Dir{Path: "/", wfs: wfs}, nil 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()) grpcConnection, err := grpc.Dial(wfs.filer, grpc.WithInsecure())
if err != nil { if err != nil {
@ -29,7 +29,7 @@ func (wfs *WFS) withFilerClient(fn func(filer.SeaweedFilerClient) error) error {
} }
defer grpcConnection.Close() defer grpcConnection.Close()
client := filer.NewSeaweedFilerClient(grpcConnection) client := filer_pb.NewSeaweedFilerClient(grpcConnection)
return fn(client) return fn(client)
} }

View file

@ -4,4 +4,4 @@ all: gen
gen: gen:
protoc seaweed.proto --go_out=plugins=grpc:./master_pb protoc seaweed.proto --go_out=plugins=grpc:./master_pb
protoc filer.proto --go_out=plugins=grpc:../filer protoc filer.proto --go_out=plugins=grpc:./filer_pb

View file

@ -1,6 +1,6 @@
syntax = "proto3"; syntax = "proto3";
package filer; package filer_pb;
////////////////////////////////////////////////// //////////////////////////////////////////////////

View file

@ -3,7 +3,7 @@
// DO NOT EDIT! // DO NOT EDIT!
/* /*
Package filer is a generated protocol buffer package. Package filer_pb is a generated protocol buffer package.
It is generated from these files: It is generated from these files:
filer.proto filer.proto
@ -22,7 +22,7 @@ It has these top-level messages:
DeleteEntryRequest DeleteEntryRequest
DeleteEntryResponse DeleteEntryResponse
*/ */
package filer package filer_pb
import proto "github.com/golang/protobuf/proto" import proto "github.com/golang/protobuf/proto"
import fmt "fmt" import fmt "fmt"
@ -325,18 +325,18 @@ func (*DeleteEntryResponse) ProtoMessage() {}
func (*DeleteEntryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } func (*DeleteEntryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} }
func init() { func init() {
proto.RegisterType((*LookupDirectoryEntryRequest)(nil), "filer.LookupDirectoryEntryRequest") proto.RegisterType((*LookupDirectoryEntryRequest)(nil), "filer_pb.LookupDirectoryEntryRequest")
proto.RegisterType((*LookupDirectoryEntryResponse)(nil), "filer.LookupDirectoryEntryResponse") proto.RegisterType((*LookupDirectoryEntryResponse)(nil), "filer_pb.LookupDirectoryEntryResponse")
proto.RegisterType((*ListEntriesRequest)(nil), "filer.ListEntriesRequest") proto.RegisterType((*ListEntriesRequest)(nil), "filer_pb.ListEntriesRequest")
proto.RegisterType((*ListEntriesResponse)(nil), "filer.ListEntriesResponse") proto.RegisterType((*ListEntriesResponse)(nil), "filer_pb.ListEntriesResponse")
proto.RegisterType((*Entry)(nil), "filer.Entry") proto.RegisterType((*Entry)(nil), "filer_pb.Entry")
proto.RegisterType((*FuseAttributes)(nil), "filer.FuseAttributes") proto.RegisterType((*FuseAttributes)(nil), "filer_pb.FuseAttributes")
proto.RegisterType((*GetFileAttributesRequest)(nil), "filer.GetFileAttributesRequest") proto.RegisterType((*GetFileAttributesRequest)(nil), "filer_pb.GetFileAttributesRequest")
proto.RegisterType((*GetFileAttributesResponse)(nil), "filer.GetFileAttributesResponse") proto.RegisterType((*GetFileAttributesResponse)(nil), "filer_pb.GetFileAttributesResponse")
proto.RegisterType((*GetFileContentRequest)(nil), "filer.GetFileContentRequest") proto.RegisterType((*GetFileContentRequest)(nil), "filer_pb.GetFileContentRequest")
proto.RegisterType((*GetFileContentResponse)(nil), "filer.GetFileContentResponse") proto.RegisterType((*GetFileContentResponse)(nil), "filer_pb.GetFileContentResponse")
proto.RegisterType((*DeleteEntryRequest)(nil), "filer.DeleteEntryRequest") proto.RegisterType((*DeleteEntryRequest)(nil), "filer_pb.DeleteEntryRequest")
proto.RegisterType((*DeleteEntryResponse)(nil), "filer.DeleteEntryResponse") proto.RegisterType((*DeleteEntryResponse)(nil), "filer_pb.DeleteEntryResponse")
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.
@ -367,7 +367,7 @@ func NewSeaweedFilerClient(cc *grpc.ClientConn) SeaweedFilerClient {
func (c *seaweedFilerClient) LookupDirectoryEntry(ctx context.Context, in *LookupDirectoryEntryRequest, opts ...grpc.CallOption) (*LookupDirectoryEntryResponse, error) { func (c *seaweedFilerClient) LookupDirectoryEntry(ctx context.Context, in *LookupDirectoryEntryRequest, opts ...grpc.CallOption) (*LookupDirectoryEntryResponse, error) {
out := new(LookupDirectoryEntryResponse) out := new(LookupDirectoryEntryResponse)
err := grpc.Invoke(ctx, "/filer.SeaweedFiler/LookupDirectoryEntry", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/LookupDirectoryEntry", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -376,7 +376,7 @@ func (c *seaweedFilerClient) LookupDirectoryEntry(ctx context.Context, in *Looku
func (c *seaweedFilerClient) ListEntries(ctx context.Context, in *ListEntriesRequest, opts ...grpc.CallOption) (*ListEntriesResponse, error) { func (c *seaweedFilerClient) ListEntries(ctx context.Context, in *ListEntriesRequest, opts ...grpc.CallOption) (*ListEntriesResponse, error) {
out := new(ListEntriesResponse) out := new(ListEntriesResponse)
err := grpc.Invoke(ctx, "/filer.SeaweedFiler/ListEntries", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/ListEntries", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -385,7 +385,7 @@ func (c *seaweedFilerClient) ListEntries(ctx context.Context, in *ListEntriesReq
func (c *seaweedFilerClient) GetFileAttributes(ctx context.Context, in *GetFileAttributesRequest, opts ...grpc.CallOption) (*GetFileAttributesResponse, error) { func (c *seaweedFilerClient) GetFileAttributes(ctx context.Context, in *GetFileAttributesRequest, opts ...grpc.CallOption) (*GetFileAttributesResponse, error) {
out := new(GetFileAttributesResponse) out := new(GetFileAttributesResponse)
err := grpc.Invoke(ctx, "/filer.SeaweedFiler/GetFileAttributes", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/GetFileAttributes", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -394,7 +394,7 @@ func (c *seaweedFilerClient) GetFileAttributes(ctx context.Context, in *GetFileA
func (c *seaweedFilerClient) GetFileContent(ctx context.Context, in *GetFileContentRequest, opts ...grpc.CallOption) (*GetFileContentResponse, error) { func (c *seaweedFilerClient) GetFileContent(ctx context.Context, in *GetFileContentRequest, opts ...grpc.CallOption) (*GetFileContentResponse, error) {
out := new(GetFileContentResponse) out := new(GetFileContentResponse)
err := grpc.Invoke(ctx, "/filer.SeaweedFiler/GetFileContent", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/GetFileContent", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -403,7 +403,7 @@ func (c *seaweedFilerClient) GetFileContent(ctx context.Context, in *GetFileCont
func (c *seaweedFilerClient) DeleteEntry(ctx context.Context, in *DeleteEntryRequest, opts ...grpc.CallOption) (*DeleteEntryResponse, error) { func (c *seaweedFilerClient) DeleteEntry(ctx context.Context, in *DeleteEntryRequest, opts ...grpc.CallOption) (*DeleteEntryResponse, error) {
out := new(DeleteEntryResponse) out := new(DeleteEntryResponse)
err := grpc.Invoke(ctx, "/filer.SeaweedFiler/DeleteEntry", in, out, c.cc, opts...) err := grpc.Invoke(ctx, "/filer_pb.SeaweedFiler/DeleteEntry", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -434,7 +434,7 @@ func _SeaweedFiler_LookupDirectoryEntry_Handler(srv interface{}, ctx context.Con
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/filer.SeaweedFiler/LookupDirectoryEntry", FullMethod: "/filer_pb.SeaweedFiler/LookupDirectoryEntry",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeaweedFilerServer).LookupDirectoryEntry(ctx, req.(*LookupDirectoryEntryRequest)) return srv.(SeaweedFilerServer).LookupDirectoryEntry(ctx, req.(*LookupDirectoryEntryRequest))
@ -452,7 +452,7 @@ func _SeaweedFiler_ListEntries_Handler(srv interface{}, ctx context.Context, dec
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/filer.SeaweedFiler/ListEntries", FullMethod: "/filer_pb.SeaweedFiler/ListEntries",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeaweedFilerServer).ListEntries(ctx, req.(*ListEntriesRequest)) return srv.(SeaweedFilerServer).ListEntries(ctx, req.(*ListEntriesRequest))
@ -470,7 +470,7 @@ func _SeaweedFiler_GetFileAttributes_Handler(srv interface{}, ctx context.Contex
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/filer.SeaweedFiler/GetFileAttributes", FullMethod: "/filer_pb.SeaweedFiler/GetFileAttributes",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeaweedFilerServer).GetFileAttributes(ctx, req.(*GetFileAttributesRequest)) return srv.(SeaweedFilerServer).GetFileAttributes(ctx, req.(*GetFileAttributesRequest))
@ -488,7 +488,7 @@ func _SeaweedFiler_GetFileContent_Handler(srv interface{}, ctx context.Context,
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/filer.SeaweedFiler/GetFileContent", FullMethod: "/filer_pb.SeaweedFiler/GetFileContent",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeaweedFilerServer).GetFileContent(ctx, req.(*GetFileContentRequest)) return srv.(SeaweedFilerServer).GetFileContent(ctx, req.(*GetFileContentRequest))
@ -506,7 +506,7 @@ func _SeaweedFiler_DeleteEntry_Handler(srv interface{}, ctx context.Context, dec
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/filer.SeaweedFiler/DeleteEntry", FullMethod: "/filer_pb.SeaweedFiler/DeleteEntry",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(SeaweedFilerServer).DeleteEntry(ctx, req.(*DeleteEntryRequest)) return srv.(SeaweedFilerServer).DeleteEntry(ctx, req.(*DeleteEntryRequest))
@ -515,7 +515,7 @@ func _SeaweedFiler_DeleteEntry_Handler(srv interface{}, ctx context.Context, dec
} }
var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
ServiceName: "filer.SeaweedFiler", ServiceName: "filer_pb.SeaweedFiler",
HandlerType: (*SeaweedFilerServer)(nil), HandlerType: (*SeaweedFilerServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {
@ -546,38 +546,39 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("filer.proto", fileDescriptor0) } func init() { proto.RegisterFile("filer.proto", fileDescriptor0) }
var fileDescriptor0 = []byte{ var fileDescriptor0 = []byte{
// 523 bytes of a gzipped FileDescriptorProto // 532 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xa4, 0x54, 0x4d, 0x6f, 0xd3, 0x40,
0x10, 0xad, 0x71, 0xdc, 0x34, 0x93, 0xb4, 0x82, 0x69, 0x03, 0xae, 0x9b, 0x8a, 0xb0, 0x48, 0x88, 0x10, 0xad, 0x71, 0xd2, 0x34, 0x93, 0xb4, 0xc0, 0xb4, 0x05, 0x93, 0xa6, 0x22, 0x2c, 0x2a, 0x82,
0x53, 0x85, 0x82, 0x38, 0x72, 0x00, 0x42, 0x10, 0x52, 0x51, 0x25, 0xf7, 0xc2, 0xad, 0x72, 0xeb, 0x4b, 0x84, 0xc2, 0x85, 0x23, 0x88, 0xb4, 0x08, 0x29, 0x08, 0xc9, 0x55, 0xaf, 0x44, 0x49, 0x3d,
0x69, 0xb5, 0x22, 0xb1, 0x83, 0x77, 0x2d, 0xd4, 0x9e, 0x39, 0xf3, 0x4b, 0xf8, 0x91, 0x68, 0x3f, 0x8d, 0x56, 0x24, 0x76, 0xf0, 0xae, 0x85, 0xda, 0x33, 0x7f, 0x80, 0xbf, 0xc5, 0xaf, 0x42, 0xbb,
0xec, 0xd8, 0xd8, 0xa9, 0x22, 0xf5, 0xe6, 0x7d, 0x33, 0x6f, 0xe6, 0xcd, 0x97, 0x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8, 0x7b, 0x8f, 0x78, 0x52, 0xd8, 0x76, 0xcb, 0x0f, 0xa0, 0xf7, 0xec, 0x4f, 0xd7, 0x4c,
0x87, 0x05, 0xab, 0x71, 0xb6, 0x41, 0xd0, 0x66, 0x2a, 0xe3, 0x7c, 0x87, 0x27, 0x8d, 0xb9, 0xe3, 0x5d, 0xb6, 0x85, 0x13, 0xe8, 0x58, 0xaf, 0x0f, 0xfb, 0x16, 0xb1, 0xf2, 0x90, 0x7b, 0xc7, 0x1b,
0x73, 0x4b, 0x59, 0xb7, 0x79, 0xc1, 0x78, 0xbd, 0x43, 0x19, 0xf9, 0x0c, 0xf6, 0xea, 0xb3, 0xc4, 0xa2, 0x79, 0xb6, 0xcf, 0x70, 0xbf, 0xb2, 0x06, 0xc8, 0x0a, 0xd6, 0xa6, 0x5d, 0xec, 0x3d, 0xbd,
0x51, 0x9d, 0x55, 0x5f, 0x8a, 0xe0, 0x78, 0x8d, 0xb5, 0x5a, 0x72, 0xa5, 0xfb, 0x65, 0xc9, 0xcd, 0xf5, 0x4e, 0x9e, 0xff, 0x02, 0xf6, 0xca, 0xd3, 0xc5, 0xc7, 0x15, 0x62, 0x79, 0x53, 0x7a, 0x83,
0xe1, 0x97, 0x25, 0xb7, 0x0c, 0x8b, 0x6d, 0x5d, 0x6e, 0xeb, 0x1f, 0xf0, 0xdb, 0x7f, 0x01, 0x00, 0xcd, 0x17, 0x6c, 0x13, 0xac, 0xa9, 0xd8, 0x26, 0x54, 0xf7, 0xc2, 0x36, 0xa1, 0x66, 0x94, 0x6c,
0x00, 0xff, 0xff, 0x6f, 0xb3, 0x14, 0x9b, 0x8f, 0x05, 0x00, 0x00, 0x6b, 0xbe, 0xad, 0xff, 0xd6, 0xaf, 0x7e, 0x05, 0x00, 0x00, 0xff, 0xff, 0x6a, 0x83, 0x8a, 0x32,
0xbc, 0x05, 0x00, 0x00,
} }

View file

@ -2,14 +2,15 @@ package weed_server
import ( import (
"context" "context"
"github.com/chrislusf/seaweedfs/weed/filer" "strconv"
"bazil.org/fuse" "bazil.org/fuse"
"github.com/chrislusf/seaweedfs/weed/operation" "github.com/chrislusf/seaweedfs/weed/operation"
"github.com/chrislusf/seaweedfs/weed/util" "github.com/chrislusf/seaweedfs/weed/util"
"strconv" "github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer.LookupDirectoryEntryRequest) (*filer.LookupDirectoryEntryResponse, error) { func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) {
found, fileId, err := fs.filer.LookupDirectoryEntry(req.Directory, req.Name) found, fileId, err := fs.filer.LookupDirectoryEntry(req.Directory, req.Name)
if err != nil { if err != nil {
@ -19,8 +20,8 @@ func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer.Look
return nil, fuse.ENOENT return nil, fuse.ENOENT
} }
return &filer.LookupDirectoryEntryResponse{ return &filer_pb.LookupDirectoryEntryResponse{
Entry: &filer.Entry{ Entry: &filer_pb.Entry{
Name: req.Name, Name: req.Name,
IsDirectory: fileId == "", IsDirectory: fileId == "",
FileId: fileId, FileId: fileId,
@ -28,7 +29,7 @@ func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer.Look
}, nil }, nil
} }
func (fs *FilerServer) ListEntries(ctx context.Context, req *filer.ListEntriesRequest) (*filer.ListEntriesResponse, error) { func (fs *FilerServer) ListEntries(ctx context.Context, req *filer_pb.ListEntriesRequest) (*filer_pb.ListEntriesResponse, error) {
directoryNames, err := fs.filer.ListDirectories(req.Directory) directoryNames, err := fs.filer.ListDirectories(req.Directory)
if err != nil { if err != nil {
@ -39,15 +40,15 @@ func (fs *FilerServer) ListEntries(ctx context.Context, req *filer.ListEntriesRe
return nil, err return nil, err
} }
resp := &filer.ListEntriesResponse{} resp := &filer_pb.ListEntriesResponse{}
for _, dir := range directoryNames { for _, dir := range directoryNames {
resp.Entries = append(resp.Entries, &filer.Entry{ resp.Entries = append(resp.Entries, &filer_pb.Entry{
Name: string(dir), Name: string(dir),
IsDirectory: true, IsDirectory: true,
}) })
} }
for _, fileEntry := range files { for _, fileEntry := range files {
resp.Entries = append(resp.Entries, &filer.Entry{ resp.Entries = append(resp.Entries, &filer_pb.Entry{
Name: fileEntry.Name, Name: fileEntry.Name,
IsDirectory: false, IsDirectory: false,
FileId: string(fileEntry.Id), FileId: string(fileEntry.Id),
@ -57,9 +58,9 @@ func (fs *FilerServer) ListEntries(ctx context.Context, req *filer.ListEntriesRe
return resp, nil return resp, nil
} }
func (fs *FilerServer) GetFileAttributes(ctx context.Context, req *filer.GetFileAttributesRequest) (*filer.GetFileAttributesResponse, error) { func (fs *FilerServer) GetFileAttributes(ctx context.Context, req *filer_pb.GetFileAttributesRequest) (*filer_pb.GetFileAttributesResponse, error) {
attributes := &filer.FuseAttributes{} attributes := &filer_pb.FuseAttributes{}
server, err := operation.LookupFileId(fs.getMasterNode(), req.FileId) server, err := operation.LookupFileId(fs.getMasterNode(), req.FileId)
if err != nil { if err != nil {
@ -74,12 +75,12 @@ func (fs *FilerServer) GetFileAttributes(ctx context.Context, req *filer.GetFile
return nil, err return nil, err
} }
return &filer.GetFileAttributesResponse{ return &filer_pb.GetFileAttributesResponse{
Attributes: attributes, Attributes: attributes,
}, nil }, nil
} }
func (fs *FilerServer) GetFileContent(ctx context.Context, req *filer.GetFileContentRequest) (*filer.GetFileContentResponse, error) { func (fs *FilerServer) GetFileContent(ctx context.Context, req *filer_pb.GetFileContentRequest) (*filer_pb.GetFileContentResponse, error) {
server, err := operation.LookupFileId(fs.getMasterNode(), req.FileId) server, err := operation.LookupFileId(fs.getMasterNode(), req.FileId)
if err != nil { if err != nil {
@ -90,12 +91,12 @@ func (fs *FilerServer) GetFileContent(ctx context.Context, req *filer.GetFileCon
return nil, err return nil, err
} }
return &filer.GetFileContentResponse{ return &filer_pb.GetFileContentResponse{
Content: content, Content: content,
}, nil }, nil
} }
func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer.DeleteEntryRequest) (resp *filer.DeleteEntryResponse, err error) { func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntryRequest) (resp *filer_pb.DeleteEntryResponse, err error) {
if req.IsDirectory { if req.IsDirectory {
err = fs.filer.DeleteDirectory(req.Directory+req.Name, false) err = fs.filer.DeleteDirectory(req.Directory+req.Name, false)
} else { } else {