not working now

need to add file handler
This commit is contained in:
Chris Lu 2018-05-22 04:31:44 -07:00
parent 7362de9a18
commit 873868cc10
6 changed files with 80 additions and 66 deletions

View file

@ -3,7 +3,6 @@ package embedded
import ( import (
"github.com/syndtr/goleveldb/leveldb" "github.com/syndtr/goleveldb/leveldb"
"github.com/chrislusf/seaweedfs/weed/filer2" "github.com/chrislusf/seaweedfs/weed/filer2"
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
) )
type EmbeddedStore struct { type EmbeddedStore struct {

View file

@ -181,7 +181,7 @@ func (dir *Dir) Lookup(ctx context.Context, name string) (node fs.Node, err erro
Name: name, Name: name,
} }
glog.V(1).Infof("lookup directory entry: %v", request) glog.V(4).Infof("lookup directory entry: %v", request)
resp, err := client.LookupDirectoryEntry(ctx, request) resp, err := client.LookupDirectoryEntry(ctx, request)
if err != nil { if err != nil {
return err return err
@ -213,7 +213,7 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
Directory: dir.Path, Directory: dir.Path,
} }
glog.V(1).Infof("read directory: %v", request) glog.V(4).Infof("read directory: %v", request)
resp, err := client.ListEntries(ctx, request) resp, err := client.ListEntries(ctx, request)
if err != nil { if err != nil {
return err return err
@ -226,7 +226,7 @@ func (dir *Dir) ReadDirAll(ctx context.Context) (ret []fuse.Dirent, err error) {
} else { } else {
dirent := fuse.Dirent{Name: entry.Name, Type: fuse.DT_File} dirent := fuse.Dirent{Name: entry.Name, Type: fuse.DT_File}
ret = append(ret, dirent) ret = append(ret, dirent)
dir.wfs.listDirectoryEntriesCache.Set(dir.Path+"/"+entry.Name, entry.Attributes, 300*time.Millisecond) dir.wfs.listDirectoryEntriesCache.Set(dir.Path+"/"+entry.Name, entry, 300*time.Millisecond)
} }
} }

View file

@ -38,11 +38,13 @@ 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 {
if !file.isOpened || file.attributes == nil { if !file.isOpened {
fullPath := filepath.Join(file.dir.Path, file.Name) fullPath := filepath.Join(file.dir.Path, file.Name)
item := file.wfs.listDirectoryEntriesCache.Get(fullPath) item := file.wfs.listDirectoryEntriesCache.Get(fullPath)
if item != nil { if item != nil {
file.attributes = item.Value().(*filer_pb.FuseAttributes) entry := item.Value().(*filer_pb.Entry)
file.Chunks = entry.Chunks
file.attributes = entry.Attributes
glog.V(1).Infof("read cached file %v attributes", file.Name) glog.V(1).Infof("read cached file %v attributes", file.Name)
} else { } else {
err := file.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error { err := file.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
@ -52,14 +54,15 @@ func (file *File) Attr(context context.Context, attr *fuse.Attr) error {
ParentDir: file.dir.Path, ParentDir: file.dir.Path,
} }
glog.V(1).Infof("read file size: %v", request) glog.V(1).Infof("read file: %v", request)
resp, err := client.GetEntryAttributes(context, request) resp, err := client.GetEntryAttributes(context, request)
if err != nil { if err != nil {
glog.V(0).Infof("read file attributes %v: %v", request, err) glog.V(0).Infof("read file %v: %v", request, err)
return err return err
} }
file.attributes = resp.Attributes file.attributes = resp.Attributes
file.Chunks = resp.Chunks
return nil return nil
}) })
@ -169,7 +172,7 @@ func (file *File) Flush(ctx context.Context, req *fuse.FlushRequest) error {
glog.V(3).Infof("file flush %v", req) glog.V(3).Infof("file flush %v", req)
if len(file.Chunks) == 0 { if len(file.Chunks) == 0 {
glog.V(2).Infof("file flush skipping empty %v", req) glog.V(2).Infof("%x file %s/%s flush skipping empty: %v", file, file.dir.Path, file.Name, req)
return nil return nil
} }
@ -184,9 +187,9 @@ func (file *File) Flush(ctx context.Context, req *fuse.FlushRequest) error {
}, },
} }
glog.V(1).Infof("append chunks: %v", request) glog.V(1).Infof("%s/%s set chunks: %v", file.dir.Path, file.Name, len(file.Chunks))
if _, err := client.UpdateEntry(ctx, request); err != nil { if _, err := client.UpdateEntry(ctx, request); err != nil {
return fmt.Errorf("create file: %v", err) return fmt.Errorf("update file: %v", err)
} }
return nil return nil

View file

@ -81,6 +81,7 @@ message GetEntryAttributesRequest {
message GetEntryAttributesResponse { message GetEntryAttributesResponse {
FuseAttributes attributes = 1; FuseAttributes attributes = 1;
repeated FileChunk chunks = 2;
} }
message GetFileContentRequest { message GetFileContentRequest {

View file

@ -285,6 +285,7 @@ func (m *GetEntryAttributesRequest) GetFileId() string {
type GetEntryAttributesResponse struct { type GetEntryAttributesResponse struct {
Attributes *FuseAttributes `protobuf:"bytes,1,opt,name=attributes" json:"attributes,omitempty"` Attributes *FuseAttributes `protobuf:"bytes,1,opt,name=attributes" json:"attributes,omitempty"`
Chunks []*FileChunk `protobuf:"bytes,2,rep,name=chunks" json:"chunks,omitempty"`
} }
func (m *GetEntryAttributesResponse) Reset() { *m = GetEntryAttributesResponse{} } func (m *GetEntryAttributesResponse) Reset() { *m = GetEntryAttributesResponse{} }
@ -299,6 +300,13 @@ func (m *GetEntryAttributesResponse) GetAttributes() *FuseAttributes {
return nil return nil
} }
func (m *GetEntryAttributesResponse) GetChunks() []*FileChunk {
if m != nil {
return m.Chunks
}
return nil
}
type GetFileContentRequest struct { type GetFileContentRequest struct {
FileId string `protobuf:"bytes,1,opt,name=file_id,json=fileId" json:"file_id,omitempty"` FileId string `protobuf:"bytes,1,opt,name=file_id,json=fileId" json:"file_id,omitempty"`
} }
@ -835,53 +843,53 @@ 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{
// 754 bytes of a gzipped FileDescriptorProto // 763 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xd3, 0x4a, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0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x23, 0x09, 0x00, 0x00,
} }

View file

@ -71,18 +71,20 @@ func (fs *FilerServer) GetEntryAttributes(ctx context.Context, req *filer_pb.Get
} }
if !found { if !found {
attributes.FileSize = 0 attributes.FileSize = 0
} else { return nil, fmt.Errorf("file %s not found", fullpath)
attributes.FileSize = filer2.TotalSize(entry.Chunks)
attributes.FileMode = uint32(entry.Mode)
attributes.Uid = entry.Uid
attributes.Gid = entry.Gid
attributes.Mtime = entry.Mtime.Unix()
} }
glog.V(0).Infof("GetEntryAttributes %v: %+v", fullpath, attributes) attributes.FileSize = filer2.TotalSize(entry.Chunks)
attributes.FileMode = uint32(entry.Mode)
attributes.Uid = entry.Uid
attributes.Gid = entry.Gid
attributes.Mtime = entry.Mtime.Unix()
glog.V(0).Infof("GetEntryAttributes %v size %d chunks %d: %+v", fullpath, attributes.FileSize, len(entry.Chunks), attributes)
return &filer_pb.GetEntryAttributesResponse{ return &filer_pb.GetEntryAttributesResponse{
Attributes: attributes, Attributes: attributes,
Chunks: entry.Chunks,
}, nil }, nil
} }
@ -112,6 +114,7 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr
Uid: req.Entry.Attributes.Uid, Uid: req.Entry.Attributes.Uid,
Gid: req.Entry.Attributes.Gid, Gid: req.Entry.Attributes.Gid,
}, },
Chunks: req.Entry.Chunks,
}) })
if err == nil { if err == nil {