mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-12-17 09:42:29 +08:00
support renaming files
This commit is contained in:
@@ -24,7 +24,14 @@ func (fs *FilerServer) LookupDirectoryEntry(ctx context.Context, req *filer_pb.L
|
||||
Entry: &filer_pb.Entry{
|
||||
Name: req.Name,
|
||||
IsDirectory: entry.IsDirectory(),
|
||||
Chunks: entry.Chunks,
|
||||
Attributes: &filer_pb.FuseAttributes{
|
||||
Mtime: entry.Attr.Mtime.Unix(),
|
||||
Crtime: entry.Attr.Crtime.Unix(),
|
||||
FileMode: uint32(entry.Attr.Mode),
|
||||
Uid: entry.Attr.Uid,
|
||||
Gid: entry.Attr.Gid,
|
||||
},
|
||||
Chunks: entry.Chunks,
|
||||
},
|
||||
}, nil
|
||||
}
|
||||
@@ -184,7 +191,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) {
|
||||
err = fs.filer.DeleteEntryMetaAndData(filer2.FullPath(filepath.Join(req.Directory, req.Name)))
|
||||
err = fs.filer.DeleteEntryMetaAndData(filer2.FullPath(filepath.Join(req.Directory, req.Name)), req.IsDeleteData)
|
||||
return &filer_pb.DeleteEntryResponse{}, err
|
||||
}
|
||||
|
||||
|
||||
@@ -195,7 +195,7 @@ func (fs *FilerServer) PostHandler(w http.ResponseWriter, r *http.Request) {
|
||||
// curl -X DELETE http://localhost:8888/path/to
|
||||
func (fs *FilerServer) DeleteHandler(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
err := fs.filer.DeleteEntryMetaAndData(filer2.FullPath(r.URL.Path))
|
||||
err := fs.filer.DeleteEntryMetaAndData(filer2.FullPath(r.URL.Path), true)
|
||||
if err != nil {
|
||||
glog.V(4).Infoln("deleting", r.URL.Path, ":", err.Error())
|
||||
writeJsonError(w, r, http.StatusInternalServerError, err)
|
||||
|
||||
Reference in New Issue
Block a user