harbor run -t openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-2193harbor download openthoughts/tasktrove-exp-rpt-stack-rust-v2-stack-rust-2193Task Description: Implement File and Directory Deletion Functionalities
You are required to implement the functionality for two structs: DeleteFile and DeleteDirectory, which are designed to perform deletion operations on files and directories, respectively, with rollback capabilities.
Struct DeleteFile:
execute method of the RollbackableOperation trait:
fs::remove_file.rollback method of the RollbackableOperation trait:
execute method, by copying it back to the original file's location.SingleFileOperation trait:
get_path should return the path of the source file.get_backup_path should return the path of the backup file.set_backup_path should allow setting the backup file's path dynamically.get_temp_dir should return the temporary directory path.Struct DeleteDirectory:
execute method of the RollbackableOperation trait:
DeleteFile, this method should create a backup of the specified directory before deleting it. The backup should be created in the temporary directory.fs::remove_dir_all.rollback method of the RollbackableOperation trait:
execute method, by renaming it back to the original directory's location.DirectoryOperation trait:
get_path should return the path of the source directory.get_backup_path should return the path of the backup directory.set_backup_path should allow setting the backup directory's path dynamically.get_temp_dir should return the temporary directory path.You should place your implementation in the /app/ directory of the project.