opencurve / curve

Curve is a sandbox project hosted by the CNCF Foundation. It's cloud-native, high-performance, and easy to operate. Curve is an open-source distributed storage system for block and shared file storage.
https://opencurve.io
Apache License 2.0
2.32k stars 521 forks source link

[curvefs] recycle recover file to original address #2227

Open cw123 opened 1 year ago

cw123 commented 1 year ago

Description:

当前curvefs已经有一个实现了基础功能的回收站,用来对误删除操作兜底。当文件从回收站删除之后,可以去回收站找回误删的文件。 但是文件恢复是采用从回收站中把文件mv到指定路径的方式恢复的。 希望回收站能够增加一个高级功能,把文件恢复到删除前的位置,或者把删除的目录按照删除前的目录恢复到原位置或者指定位置。

Currently, curvefs already has a recycle bin that implements basic functions, which is used to cover accidental deletion operations. When files are deleted from the recycle bin, you can go to the recycle bin to retrieve the accidentally deleted files. However, file recovery is done by moving the file mv from the recycle bin to the specified path. I hope that the recycle bin can add an advanced function to restore the file to the location before deletion, or restore the deleted directory to the original location or the specified location according to the directory before deletion.

Proposed solution:

删除的文件在回收站中按照parentinodeid_inodeid_name的方式重新命名了,删除的目录也按照这种命名方式放到了回收站,可以根据文件和父目录的重命名带的信息,组合出删除前的文件的路径,来进行恢复。

Deleted files are renamed according to parentinodeid_inodeid_name in the recycle bin, and deleted directories are also put into the recycle bin according to this naming method, and the path of the file before deletion can be combined according to the information in the renaming band of the file and the parent directory , to restore.

Tangruilin commented 1 year ago

assigned me

Cyber-SiKu commented 1 year ago

@Tangruilin Is this still going on?

caoxianfei1 commented 1 year ago

assigned me

you can contact us if you have any confusion.

CodeFarmerPK commented 1 year ago

@cw123 I have read code of recycle bin commit (commit id in git:b9bc03d0), but i didn't find the function of restore file to the specified path mentioned of 'Description', can i have a little help?

cw123 commented 1 year ago

@cw123 I have read code of recycle bin commit (commit id in git:b9bc03d0), but i didn't find the function of restore file to the specified path mentioned of 'Description', can i have a little help?

You can use mv cmd to restore the file from recycle to the path you want. mv cmd is already supported by rename operation. 恢复到自己制定的路径的操作,可以通过mv操作完成。mv早已经通过rename接口支持了,不在这个commit里。

CodeFarmerPK commented 1 year ago

@cw123 I have read code of recycle bin commit (commit id in git:b9bc03d0), but i didn't find the function of restore file to the specified path mentioned of 'Description', can i have a little help?

You can use mv cmd to restore the file from recycle to the path you want. mv cmd is already supported by rename operation. 恢复到自己制定的路径的操作,可以通过mv操作完成。mv早已经通过rename接口支持了,不在这个commit里。

Thanks.