|
@ -19,7 +19,7 @@ import ( |
|
|
|
|
|
|
|
|
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) { |
|
|
func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.LookupDirectoryEntryRequest) (*filer_pb.LookupDirectoryEntryResponse, error) { |
|
|
|
|
|
|
|
|
entry, err := fs.filer.FindEntry(ctx, util.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Name)))) |
|
|
|
|
|
|
|
|
entry, err := fs.filer.FindEntry(ctx, util.JoinPath(req.Directory, req.Name)) |
|
|
if err == filer_pb.ErrNotFound { |
|
|
if err == filer_pb.ErrNotFound { |
|
|
return &filer_pb.LookupDirectoryEntryResponse{}, nil |
|
|
return &filer_pb.LookupDirectoryEntryResponse{}, nil |
|
|
} |
|
|
} |
|
@ -137,7 +137,6 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr |
|
|
|
|
|
|
|
|
resp = &filer_pb.CreateEntryResponse{} |
|
|
resp = &filer_pb.CreateEntryResponse{} |
|
|
|
|
|
|
|
|
fullpath := util.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name))) |
|
|
|
|
|
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks) |
|
|
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks) |
|
|
|
|
|
|
|
|
if req.Entry.Attributes == nil { |
|
|
if req.Entry.Attributes == nil { |
|
@ -147,7 +146,7 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
createErr := fs.filer.CreateEntry(ctx, &filer2.Entry{ |
|
|
createErr := fs.filer.CreateEntry(ctx, &filer2.Entry{ |
|
|
FullPath: fullpath, |
|
|
|
|
|
|
|
|
FullPath: util.JoinPath(req.Directory, req.Entry.Name), |
|
|
Attr: filer2.PbToEntryAttribute(req.Entry.Attributes), |
|
|
Attr: filer2.PbToEntryAttribute(req.Entry.Attributes), |
|
|
Chunks: chunks, |
|
|
Chunks: chunks, |
|
|
}, req.OExcl) |
|
|
}, req.OExcl) |
|
@ -164,7 +163,7 @@ func (fs *FilerServer) CreateEntry(ctx context.Context, req *filer_pb.CreateEntr |
|
|
|
|
|
|
|
|
func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntryRequest) (*filer_pb.UpdateEntryResponse, error) { |
|
|
func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntryRequest) (*filer_pb.UpdateEntryResponse, error) { |
|
|
|
|
|
|
|
|
fullpath := filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name)) |
|
|
|
|
|
|
|
|
fullpath := util.Join(req.Directory, req.Entry.Name) |
|
|
entry, err := fs.filer.FindEntry(ctx, util.FullPath(fullpath)) |
|
|
entry, err := fs.filer.FindEntry(ctx, util.FullPath(fullpath)) |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
return &filer_pb.UpdateEntryResponse{}, fmt.Errorf("not found %s: %v", fullpath, err) |
|
|
return &filer_pb.UpdateEntryResponse{}, fmt.Errorf("not found %s: %v", fullpath, err) |
|
@ -176,7 +175,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr |
|
|
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks) |
|
|
chunks, garbages := filer2.CompactFileChunks(req.Entry.Chunks) |
|
|
|
|
|
|
|
|
newEntry := &filer2.Entry{ |
|
|
newEntry := &filer2.Entry{ |
|
|
FullPath: util.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Entry.Name))), |
|
|
|
|
|
|
|
|
FullPath: util.JoinPath(req.Directory, req.Entry.Name), |
|
|
Attr: entry.Attr, |
|
|
Attr: entry.Attr, |
|
|
Extended: req.Entry.Extended, |
|
|
Extended: req.Entry.Extended, |
|
|
Chunks: chunks, |
|
|
Chunks: chunks, |
|
@ -219,7 +218,7 @@ func (fs *FilerServer) UpdateEntry(ctx context.Context, req *filer_pb.UpdateEntr |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntryRequest) (resp *filer_pb.DeleteEntryResponse, err error) { |
|
|
func (fs *FilerServer) DeleteEntry(ctx context.Context, req *filer_pb.DeleteEntryRequest) (resp *filer_pb.DeleteEntryResponse, err error) { |
|
|
err = fs.filer.DeleteEntryMetaAndData(ctx, util.FullPath(filepath.ToSlash(filepath.Join(req.Directory, req.Name))), req.IsRecursive, req.IgnoreRecursiveError, req.IsDeleteData) |
|
|
|
|
|
|
|
|
err = fs.filer.DeleteEntryMetaAndData(ctx, util.JoinPath(req.Directory, req.Name), req.IsRecursive, req.IgnoreRecursiveError, req.IsDeleteData) |
|
|
resp = &filer_pb.DeleteEntryResponse{} |
|
|
resp = &filer_pb.DeleteEntryResponse{} |
|
|
if err != nil { |
|
|
if err != nil { |
|
|
resp.Error = err.Error() |
|
|
resp.Error = err.Error() |
|
|