mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-04-05 20:52:50 +08:00
support renaming files
This commit is contained in:
parent
b3447f4375
commit
5c25d29272
@ -123,7 +123,7 @@ func (f *Filer) FindEntry(p FullPath) (entry *Entry, err error) {
|
||||
return f.store.FindEntry(p)
|
||||
}
|
||||
|
||||
func (f *Filer) DeleteEntryMetaAndData(p FullPath) (err error) {
|
||||
func (f *Filer) DeleteEntryMetaAndData(p FullPath, shouldDeleteChunks bool) (err error) {
|
||||
entry, err := f.FindEntry(p)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -139,7 +139,9 @@ func (f *Filer) DeleteEntryMetaAndData(p FullPath) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
f.deleteChunks(entry)
|
||||
if shouldDeleteChunks {
|
||||
f.deleteChunks(entry)
|
||||
}
|
||||
|
||||
return f.store.DeleteEntry(p)
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ func TestCreateFileAndList(t *testing.T) {
|
||||
}
|
||||
|
||||
// delete file and count
|
||||
filer.DeleteEntryMetaAndData(file3Path)
|
||||
filer.DeleteEntryMetaAndData(file3Path, false)
|
||||
entries, _ = filer.ListDirectoryEntries(filer2.FullPath("/home/chris/this/is"), "", false, 100)
|
||||
if len(entries) != 1 {
|
||||
t.Errorf("list entries count: %v", len(entries))
|
||||
|
@ -28,6 +28,7 @@ var _ = fs.NodeMkdirer(&Dir{})
|
||||
var _ = fs.NodeStringLookuper(&Dir{})
|
||||
var _ = fs.HandleReadDirAller(&Dir{})
|
||||
var _ = fs.NodeRemover(&Dir{})
|
||||
var _ = fs.NodeRenamer(&Dir{})
|
||||
|
||||
func (dir *Dir) Attr(context context.Context, attr *fuse.Attr) error {
|
||||
|
||||
@ -251,9 +252,10 @@ func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
return dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Name: req.Name,
|
||||
IsDirectory: req.Dir,
|
||||
Directory: dir.Path,
|
||||
Name: req.Name,
|
||||
IsDirectory: req.Dir,
|
||||
IsDeleteData: true,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("remove directory entry: %v", request)
|
||||
@ -268,3 +270,80 @@ func (dir *Dir) Remove(ctx context.Context, req *fuse.RemoveRequest) error {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func (dir *Dir) Rename(ctx context.Context, req *fuse.RenameRequest, newDirectory fs.Node) error {
|
||||
|
||||
dir.NodeMapLock.Lock()
|
||||
defer dir.NodeMapLock.Unlock()
|
||||
|
||||
newDir := newDirectory.(*Dir)
|
||||
|
||||
var entry *filer_pb.Entry
|
||||
err := dir.wfs.withFilerClient(func(client filer_pb.SeaweedFilerClient) error {
|
||||
|
||||
// find existing entry
|
||||
{
|
||||
request := &filer_pb.LookupDirectoryEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Name: req.OldName,
|
||||
}
|
||||
|
||||
glog.V(4).Infof("find existing directory entry: %v", request)
|
||||
resp, err := client.LookupDirectoryEntry(ctx, request)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entry = resp.Entry
|
||||
|
||||
if entry.IsDirectory {
|
||||
// do not support moving directory
|
||||
return fuse.ENOTSUP
|
||||
}
|
||||
|
||||
glog.V(4).Infof("found existing directory entry resp: %+v", resp)
|
||||
|
||||
}
|
||||
|
||||
// add to new directory
|
||||
{
|
||||
request := &filer_pb.CreateEntryRequest{
|
||||
Directory: newDir.Path,
|
||||
Entry: &filer_pb.Entry{
|
||||
Name: req.NewName,
|
||||
IsDirectory: false,
|
||||
Attributes: entry.Attributes,
|
||||
Chunks: entry.Chunks,
|
||||
},
|
||||
}
|
||||
|
||||
glog.V(1).Infof("create new entry: %v", request)
|
||||
if _, err := client.CreateEntry(ctx, request); err != nil {
|
||||
return fmt.Errorf("create new entry: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
// delete old entry
|
||||
{
|
||||
request := &filer_pb.DeleteEntryRequest{
|
||||
Directory: dir.Path,
|
||||
Name: req.OldName,
|
||||
IsDirectory: false,
|
||||
IsDeleteData: false,
|
||||
}
|
||||
|
||||
glog.V(1).Infof("remove old entry: %v", request)
|
||||
_, err := client.DeleteEntry(ctx, request)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(dir.NodeMap, req.OldName)
|
||||
|
||||
}
|
||||
|
||||
return nil
|
||||
})
|
||||
|
||||
return err
|
||||
}
|
||||
|
@ -113,6 +113,7 @@ message DeleteEntryRequest {
|
||||
string directory = 1;
|
||||
string name = 2;
|
||||
bool is_directory = 3;
|
||||
bool is_delete_data = 4;
|
||||
}
|
||||
|
||||
message DeleteEntryResponse {
|
||||
|
@ -424,9 +424,10 @@ func (*UpdateEntryResponse) ProtoMessage() {}
|
||||
func (*UpdateEntryResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} }
|
||||
|
||||
type DeleteEntryRequest struct {
|
||||
Directory string `protobuf:"bytes,1,opt,name=directory" json:"directory,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
|
||||
IsDirectory bool `protobuf:"varint,3,opt,name=is_directory,json=isDirectory" json:"is_directory,omitempty"`
|
||||
Directory string `protobuf:"bytes,1,opt,name=directory" json:"directory,omitempty"`
|
||||
Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"`
|
||||
IsDirectory bool `protobuf:"varint,3,opt,name=is_directory,json=isDirectory" json:"is_directory,omitempty"`
|
||||
IsDeleteData bool `protobuf:"varint,4,opt,name=is_delete_data,json=isDeleteData" json:"is_delete_data,omitempty"`
|
||||
}
|
||||
|
||||
func (m *DeleteEntryRequest) Reset() { *m = DeleteEntryRequest{} }
|
||||
@ -455,6 +456,13 @@ func (m *DeleteEntryRequest) GetIsDirectory() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *DeleteEntryRequest) GetIsDeleteData() bool {
|
||||
if m != nil {
|
||||
return m.IsDeleteData
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type DeleteEntryResponse struct {
|
||||
}
|
||||
|
||||
@ -939,62 +947,64 @@ var _SeaweedFiler_serviceDesc = grpc.ServiceDesc{
|
||||
func init() { proto.RegisterFile("filer.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 906 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0x5b, 0x6f, 0xdc, 0x44,
|
||||
0x14, 0x8e, 0xd7, 0xd9, 0x4d, 0x7c, 0x76, 0xc3, 0x65, 0x36, 0x2d, 0x66, 0x9b, 0x54, 0x61, 0xa0,
|
||||
0xa8, 0x15, 0x52, 0x14, 0x05, 0x1e, 0x2a, 0x10, 0x12, 0x55, 0x53, 0xaa, 0x4a, 0xa9, 0x2a, 0xb9,
|
||||
0x04, 0x89, 0xa7, 0x95, 0x63, 0x9f, 0x5d, 0x46, 0xf1, 0x0d, 0xcf, 0x38, 0x28, 0xbc, 0xf2, 0x5b,
|
||||
0x78, 0xe7, 0x81, 0x7f, 0xc0, 0x1f, 0x43, 0x73, 0xb1, 0x3d, 0x8e, 0xbd, 0xbd, 0x3c, 0xf0, 0x36,
|
||||
0x73, 0x2e, 0xdf, 0xf9, 0xce, 0xcc, 0x99, 0xcf, 0x86, 0xe9, 0x8a, 0x25, 0x58, 0x1e, 0x17, 0x65,
|
||||
0x2e, 0x72, 0xb2, 0xab, 0x36, 0xcb, 0xe2, 0x92, 0xbe, 0x82, 0x7b, 0xe7, 0x79, 0x7e, 0x55, 0x15,
|
||||
0x67, 0xac, 0xc4, 0x48, 0xe4, 0xe5, 0xcd, 0xb3, 0x4c, 0x94, 0x37, 0x01, 0xfe, 0x56, 0x21, 0x17,
|
||||
0xe4, 0x00, 0xbc, 0xb8, 0x76, 0xf8, 0xce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|
||||
0x53, 0x68, 0x96, 0xe0, 0xd8, 0x68, 0x7d, 0x89, 0xb3, 0xd1, 0x86, 0x54, 0x4a, 0xa1, 0x59, 0xe2,
|
||||
0x61, 0xa3, 0xf5, 0xe5, 0xcb, 0x46, 0x1b, 0x52, 0x9c, 0x2d, 0xf2, 0x0a, 0x66, 0xb6, 0x08, 0x10,
|
||||
0x2b, 0x61, 0x40, 0x8b, 0x16, 0xf7, 0x37, 0xb9, 0x6d, 0x40, 0x7b, 0xe6, 0x6d, 0xc0, 0x81, 0x57,
|
||||
0x6f, 0x03, 0x0e, 0x3d, 0x15, 0xba, 0x75, 0x39, 0x51, 0xbf, 0xac, 0x5f, 0xff, 0x17, 0x00, 0x00,
|
||||
0xff, 0xff, 0xf1, 0x42, 0x51, 0xbb, 0xc1, 0x0a, 0x00, 0x00,
|
||||
// 931 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xb4, 0x56, 0xdd, 0x6e, 0xdc, 0x44,
|
||||
0x14, 0x8e, 0xd7, 0xd9, 0x4d, 0x7c, 0x76, 0x53, 0x60, 0x36, 0x2d, 0x66, 0x9b, 0x54, 0x61, 0x68,
|
||||
0x51, 0x2b, 0xa4, 0x28, 0x0a, 0x5c, 0x54, 0x20, 0x24, 0xaa, 0xa6, 0x54, 0x95, 0x52, 0x55, 0x72,
|
||||
0x09, 0x12, 0x57, 0x2b, 0xc7, 0x3e, 0x59, 0x46, 0xf1, 0x1f, 0x9e, 0x71, 0x50, 0xb8, 0xe5, 0x01,
|
||||
0x78, 0x0a, 0xee, 0xb9, 0xe0, 0x0d, 0x78, 0x31, 0x34, 0x3f, 0xb6, 0xc7, 0xb1, 0xb7, 0x3f, 0x17,
|
||||
0xbd, 0x9b, 0x39, 0x3f, 0xdf, 0xf9, 0xce, 0xcc, 0x99, 0xcf, 0x86, 0xe9, 0x05, 0x4b, 0xb0, 0x3c,
|
||||
0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, 0x33, 0x75,
|
||||
0xdd, 0xcb, 0x75, 0xde, 0xfd, 0x72, 0xad, 0x19, 0x1a, 0xbd, 0x75, 0x86, 0xe8, 0x11, 0xdc, 0x7e,
|
||||
0x8e, 0x42, 0xd9, 0xf3, 0x4c, 0x60, 0x26, 0xea, 0x56, 0xd7, 0x4d, 0x05, 0x3d, 0x86, 0x3b, 0x37,
|
||||
0x33, 0x0c, 0x65, 0x1f, 0xb6, 0x22, 0x6d, 0x52, 0x29, 0xb3, 0xa0, 0xde, 0xd2, 0x5f, 0x80, 0x3c,
|
||||
0x2d, 0x31, 0x14, 0xf8, 0x1e, 0xe2, 0xd0, 0x3c, 0xf4, 0xd1, 0x1b, 0x1f, 0xfa, 0x6d, 0x98, 0x77,
|
||||
0xa0, 0x35, 0x17, 0x59, 0xf1, 0xac, 0x88, 0x3f, 0x54, 0xc5, 0x0e, 0xb4, 0xa9, 0xf8, 0x97, 0x03,
|
||||
0xe4, 0x04, 0x13, 0x7c, 0xaf, 0x92, 0x03, 0x0a, 0xd8, 0x93, 0x09, 0xb7, 0x2f, 0x13, 0xf7, 0xe1,
|
||||
0x96, 0x0c, 0x51, 0xd5, 0x96, 0x71, 0x28, 0x42, 0x35, 0xff, 0xdb, 0xc1, 0x8c, 0x71, 0x4d, 0xe1,
|
||||
0x24, 0x14, 0xa1, 0x24, 0xda, 0x21, 0x64, 0x88, 0xa6, 0x30, 0x7f, 0xc2, 0x39, 0x5b, 0x65, 0x3f,
|
||||
0xe7, 0x49, 0x95, 0x62, 0x4d, 0x74, 0x17, 0xc6, 0x51, 0x5e, 0x99, 0xbb, 0x1b, 0x07, 0x7a, 0x43,
|
||||
0xee, 0x01, 0x44, 0x79, 0x92, 0x60, 0x24, 0x58, 0x9e, 0x19, 0x9a, 0x96, 0x85, 0x1c, 0xc0, 0xb4,
|
||||
0xc4, 0x22, 0x61, 0x51, 0xa8, 0x02, 0xf4, 0x88, 0xdb, 0x26, 0x7a, 0x05, 0xbb, 0xdd, 0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0xbf, 0xe8, 0xe4, 0xc1, 0x4d,
|
||||
0xfa, 0x83, 0xbf, 0x10, 0x8b, 0x2f, 0xdf, 0x16, 0x66, 0xc6, 0x7a, 0x83, 0x9c, 0xc2, 0xd4, 0xfa,
|
||||
0x7e, 0x93, 0x3d, 0x2b, 0xb1, 0xf7, 0x2b, 0xb0, 0xd8, 0x5f, 0xe3, 0x6d, 0xd0, 0x42, 0x20, 0x7d,
|
||||
0x79, 0x26, 0x5f, 0xb4, 0x69, 0x6b, 0x3f, 0x13, 0x8b, 0xfb, 0x6f, 0x0e, 0xb2, 0x09, 0x5b, 0xda,
|
||||
0x65, 0x13, 0xee, 0xab, 0xa5, 0x4d, 0x78, 0x48, 0xf0, 0x14, 0x9a, 0xa5, 0x4b, 0x36, 0x5a, 0x5f,
|
||||
0x09, 0x6d, 0xb4, 0x21, 0x31, 0x53, 0x68, 0x96, 0x78, 0xd8, 0x68, 0x7d, 0x91, 0xb3, 0xd1, 0x86,
|
||||
0x14, 0x67, 0x83, 0xbc, 0x82, 0x99, 0x2d, 0x02, 0xc4, 0x4a, 0x18, 0xd0, 0xa2, 0xc5, 0xbd, 0x75,
|
||||
0x6e, 0x1b, 0xd0, 0x9e, 0x79, 0x1b, 0x70, 0xe0, 0xd5, 0xdb, 0x80, 0x43, 0x4f, 0x85, 0x6e, 0x9c,
|
||||
0x4f, 0xd4, 0x9f, 0xed, 0xd7, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x1a, 0xed, 0xc4, 0xbe, 0xe8,
|
||||
0x0a, 0x00, 0x00,
|
||||
}
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user