File processing method and device based on distributed file system and electronic equipment

By introducing an operation interception module and a recycle bin mechanism into the distributed file system, the problem of users accidentally deleting files is solved, and secure file interception and recovery are achieved, thereby improving data security.

CN118964308APending Publication Date: 2024-11-15SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
CN202411156169.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-22
Publication Date
2024-11-15

AI Technical Summary

Technical Problem

Existing distributed file systems lack a recycle bin mechanism, which can lead to data loss when users accidentally delete important files, thus reducing data security.

Method used

An operation interception module is introduced into the distributed file system to intercept deletion requests and redirect them to rename operations, move the files to the recycle bin, record the original path information in the extended attributes, and update the index and metadata information to ensure that the files are recoverable.

Benefits of technology

By retaining the original path information and permission verification of files in the recycle bin, the data security of the distributed file system is improved, preventing the loss of accidentally deleted files and supporting subsequent file recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118964308A_ABST
    Figure CN118964308A_ABST
Patent Text Reader

Abstract

The invention provides a file processing method and device based on a distributed file system and electronic equipment. According to the method, an operation interception module is utilized to intercept all deletion requests of a client and redirect the deletion requests to a rename operation instead of direct deletion, a target deletion file is moved to a target directory specified by a recycle bin to be processed, and meanwhile, original path information is recorded in the moving process and stored in an extension attribute of the target deletion file; and subsequent file recovery operation is facilitated. Through the above process, even if the user mistakenly deletes the important file, the important file can be retrieved and recovered in the recycle bin, so that the data security of the distributed file system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a file processing method, device and electronic equipment based on a distributed file system. Background Art

[0002] With the development of society, people's Internet life has become more and more abundant, which has also brought huge challenges to information storage. Therefore, it is particularly important to design a distributed file system with large capacity, high availability, high reliability, high performance, scalability and easy maintenance.

[0003] However, existing distributed file systems do not have a recycle bin mechanism during use.

[0004] Therefore, when a user deletes an important file by mistake, data loss in the file system will inevitably occur, thereby reducing the data security of the distributed file system. Summary of the invention

[0005] The embodiments of the present invention provide a file processing method, device and electronic device based on a distributed file system, which can improve the data security of the distributed file system.

[0006] In a first aspect, an embodiment of the present invention provides a file processing method based on a distributed file system, comprising:

[0007] A1: Use the operation interception module to obtain external deletion requests;

[0008] A2: Based on the deletion request, determining a target deletion file of a target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete;

[0009] A3: intercepting the deletion request, redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of a recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file;

[0010] A4: recording the original path information of the target deleted file in an extended attribute corresponding to the recycle bin, wherein the extended attribute is used to represent the original path information of the target deleted file;

[0011] A5: Update the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information.

[0012] Preferably,

[0013] Before the operation interception module is used to obtain the deletion request from the outside, the method further includes:

[0014] The recycle bin function is pre-configured using the recycle bin configuration module, wherein the recycle bin function configuration information includes whether to enable the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files.

[0015] Preferably,

[0016] Before intercepting the deletion request and redirecting the deletion request operation to a rename operation, the method further includes:

[0017] Based on the target deletion file, determine whether the target deletion user has the deletion permission. If yes, execute step A3. Otherwise, send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion permission.

[0018] Preferably,

[0019] After the updating of the index information and metadata information of the target deleted file, the method further comprises:

[0020] D1: Use the file recovery module to obtain the recovery request from the outside;

[0021] D2: Determine a target recovery file based on the recovery request, wherein the target recovery file is a target deleted file that needs to be recovered;

[0022] D3: Based on the target recovery file, determine whether the target recovery user has recovery authority, if yes, execute D4, otherwise execute D5;

[0023] D4: restoring the target recovery file to a target location, wherein the target location includes an original location of the target recovery file;

[0024] D5: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority.

[0025] Preferably,

[0026] The step of restoring the target recovery file to a target location includes:

[0027] Using the file recovery module to obtain the original path information included in the extended attribute of the target recovery file;

[0028] Based on the original path information, determining whether the target location is the original location of the target recovery file;

[0029] When the target location is the original location of the target recovery file, restoring the target recovery file to the original location;

[0030] When the target location is not the original location of the target recovery file, the target recovery file is restored to the target location.

[0031] In a second aspect, an embodiment of the present invention provides a file processing device based on a distributed file system, the device comprising: an operation interception module;

[0032] The operation interception module is used to execute:

[0033] A1: Use the operation interception module to obtain external deletion requests;

[0034] A2: Based on the deletion request, determining a target deletion file of a target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete;

[0035] A3: intercepting the deletion request, redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of a recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file;

[0036] A4: recording the original path information of the target deleted file in an extended attribute corresponding to the recycle bin, wherein the extended attribute is used to represent the original path information of the target deleted file;

[0037] A5: Update the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information.

[0038] Preferably,

[0039] Before the operation interception module is used to obtain the deletion request from the outside, it further includes: a recycling bin configuration module;

[0040] The recycle bin configuration module is used to pre-configure the recycle bin function, wherein the recycle bin function configuration information includes whether to enable the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files.

[0041] Preferably,

[0042] The operation interception module is also used to execute:

[0043] Based on the target deletion file, determine whether the target deletion user has the deletion permission. If yes, execute step A3. Otherwise, send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion permission.

[0044] Preferably,

[0045] Further comprising: a file recovery module;

[0046] The file recovery module is used to execute:

[0047] D1: Use the file recovery module to obtain the recovery request from the outside;

[0048] D2: Determine a target recovery file based on the recovery request, wherein the target recovery file is a target deleted file that needs to be recovered;

[0049] D3: Based on the target recovery file, determine whether the target recovery user has recovery authority, if yes, execute D4, otherwise execute D5;

[0050] D4: restoring the target recovery file to a target location, wherein the target location includes an original location of the target recovery file;

[0051] D5: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority.

[0052] Preferably,

[0053] The file recovery module is further used to execute:

[0054] Using the file recovery module to obtain the original path information included in the extended attribute of the target recovery file;

[0055] Based on the original path information, determining whether the target location is the original location of the target recovery file;

[0056] When the target location is the original location of the target recovery file, restoring the target recovery file to the original location;

[0057] When the target location is not the original location of the target recovery file, the target recovery file is restored to the target location.

[0058] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: at least one memory and at least one processor;

[0059] The at least one memory is used to store a machine-readable program;

[0060] The at least one processor is used to call the machine-readable program to execute any method described in the first aspect of claim 1.

[0061] In a fourth aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes any one of the methods described in the first aspect.

[0062] The embodiment of the present invention provides a file processing method, device and electronic device based on a distributed file system. When a user needs to delete a file, an operation interception module can be used to intercept all deletion requests of a client and redirect them to a rename operation instead of direct deletion, and then the target deleted file to be deleted is determined based on the deletion request of the client, and the target deleted file is moved to a target directory specified by a recycle bin for processing. At the same time, the original path information is recorded during the moving process and stored in the extended attributes of the target deleted file for subsequent file recovery operations. The extended attribute is a mechanism for storing additional information related to a file in a distributed file system. By storing this information in the extended attribute, it can be ensured that even if the file is moved or renamed, its original path information can still be retained. Since the file has been moved to the target directory of the recycle bin, the index information and metadata information of the distributed file system also need to be updated accordingly, and the index information and metadata information can be updated by the operation interception module to ensure that the file system can correctly track and manage the files in the recycle bin. Through the above process, even if the user deletes an important file by mistake, it can be retrieved and restored in the recycle bin through the index information, and the permission information can be verified through the metadata information, thereby improving the data security of the distributed file system. BRIEF DESCRIPTION OF THE DRAWINGS

[0063] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0064] Figure 1 is a flow chart of a file processing method based on a distributed file system provided by an embodiment of the present invention;

[0065] Figure 2 is a flowchart of another file processing method based on a distributed file system provided by an embodiment of the present invention;

[0066] Figure 3 is a schematic diagram of a file processing device based on a distributed file system provided by an embodiment of the present invention;

[0067] Figure 4 is a schematic diagram of another file processing device based on a distributed file system provided by an embodiment of the present invention;

[0068] Figure 5 It is a schematic diagram of another file processing device based on a distributed file system provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0069] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0070] like Figure 1 As shown, an embodiment of the present invention provides a file processing method based on a distributed file system, and the method may include the following steps:

[0071] Step 101: using the operation interception module to obtain a deletion request from outside;

[0072] Step 102: based on the deletion request, determining the target deletion file of the target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete;

[0073] Step 103: intercepting the deletion request, and redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of the recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file;

[0074] Step 104: Record the original path information of the target deleted file in the extended attribute corresponding to the recycle bin, where the extended attribute is used to represent the original path information of the target deleted file;

[0075] Step 105: Update the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information.

[0076] In an embodiment of the present invention, a file processing method based on a distributed file system is provided. When a user needs to delete a file, an operation interception module can be used to intercept all deletion requests of the client and redirect them to a rename operation instead of direct deletion. Then, based on the deletion request of the client, the target deleted file to be deleted is determined, and the target deleted file is moved to a target directory specified by a recycle bin for processing. At the same time, the original path information is recorded during the moving process and stored in the extended attributes of the target deleted file for subsequent file recovery operations. The extended attributes are a mechanism for storing additional information related to a file in a distributed file system. By storing this information in the extended attributes, it can be ensured that even if the file is moved or renamed, its original path information can still be retained. Since the file has been moved to the target directory of the recycle bin, the index information and metadata information of the distributed file system also need to be updated accordingly. The index information and metadata information can be updated by the operation interception module to ensure that the file system can correctly track and manage the files in the recycle bin. Through the above process, even if the user deletes an important file by mistake, it can be retrieved and restored in the recycle bin through the index information, and the permission information can be verified through the metadata information, thereby improving the data security of the distributed file system.

[0077] Specifically, the embodiment of the present invention can be applied to a CephFS distributed file system. When a user deletes a file, the file automatically enters the recycle bin instead of being directly deleted.

[0078] In order to configure the recycle bin function, in one embodiment of the present invention, before using the operation interception module to obtain the deletion request from the outside in step 101, the above embodiment further includes: using the recycle bin configuration module to pre-configure the recycle bin function, wherein the recycle bin function configuration information includes whether to open the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files.

[0079] In an embodiment of the present invention, the recycle bin configuration module allows the user to configure the recycle bin function for a specified file system and set related file recycling rules. The configuration content may include the following:

[0080] (1) Whether to enable the Recycle Bin: After the Recycle Bin function is enabled, the target deleted files will be moved to the specified directory of the Recycle Bin. Otherwise, the target deleted files will be directly deleted and the corresponding storage space will be cleared. This function can be flexibly enabled according to the actual needs of the user;

[0081] (2) Recycle Bin File Validity Period: You can specify the length of time that the target deleted file is retained in the Recycle Bin. After this period, the target deleted file will be automatically deleted;

[0082] (2) Maximum storage capacity of the recycle bin: Set the maximum storage capacity of the recycle bin to prevent it from taking up too much storage space;

[0083] (3) Maximum storage capacity of the Recycle Bin: You can set the maximum number of files or directories that can be stored in the Recycle Bin to prevent it from taking up too much storage space;

[0084] (4) Automatically clear expired files: Set the time to automatically delete files that have exceeded their validity period or trigger it manually to free up storage space.

[0085] The above configurations can be flexibly adjusted according to actual needs to meet data recovery requirements in different scenarios.

[0086] In order to further improve the security of the distributed file system, in one embodiment of the present invention, before intercepting the deletion request and redirecting the deletion request operation to a rename operation, the above embodiment further includes:

[0087] Based on the target deletion file, determine whether the target deletion user has the deletion permission. If yes, execute step A3. Otherwise, send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion permission.

[0088] In the embodiment of the present invention, in order to further improve the security of the distributed file system, the user's deletion authority can be verified before the target deleted file is moved to the recycle bin. If the user has the deletion authority, the above operation process is performed, and for users who do not have the deletion authority, an error deletion message can be sent to the user to prompt the user. Through the above process, the loss caused by the user's accidental deletion of important files can be avoided, thereby improving the data security of the distributed file system.

[0089] In order to restore the target recovery file, in one embodiment of the present invention, after updating the index information and metadata information of the target deleted file in step 105 in the above embodiment, the method further includes:

[0090] D1: Use the file recovery module to obtain the recovery request from the outside;

[0091] D2: Based on the recovery request, determine a target recovery file of a target recovery user, wherein the target recovery user is the object that initiates the recovery request, and the target recovery file is the file that the target recovery user needs to recover;

[0092] D3: Based on the target recovery file, determine whether the target recovery user has recovery authority, if yes, execute D4, otherwise execute D5;

[0093] D4: restoring the target recovery file to a target location, wherein the target location includes an original location of the target recovery file;

[0094] D5: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority.

[0095] In an embodiment of the present invention, when a user needs to recover a file from a recycle bin, the file recovery module can be used to perform the operation. The module will first verify whether the user who initiated the recovery request has the corresponding authority. This operation is to ensure the security of the file system and prevent unauthorized users from performing recovery operations. If the user does not have the corresponding authority, the file recovery module will reject the request and return a corresponding error recovery information prompt to the user. The module will search in the recycle bin directory based on the file name provided by the user, through index information and metadata information, and quickly locate the file to be recovered. The recycle bin directory is usually a special directory used to store files that have been deleted but not yet permanently deleted.

[0096] In order to determine the recovery location of the target recovery file, in one embodiment of the present invention, the step of restoring the target recovery file to the target location in the above embodiment includes:

[0097] Using the file recovery module to obtain the original path information included in the extended attribute of the target recovery file;

[0098] Based on the original path information, determining whether the target location is the original location of the target recovery file;

[0099] When the target location is the original location of the target recovery file, restoring the target recovery file to the original location;

[0100] When the target location is not the original location of the target recovery file, the target recovery file is restored to the target location.

[0101] In the embodiment of the present invention, the file recovery module can be used to read the original path information in the extended attribute so as to determine the original location of the file through the original path information. At the same time, when the user does not specify the target location, the file will be restored to the original location, and when the user specifies the target location, the file will be restored to the target location.

[0102] like Figure 2 To more clearly illustrate the technical solution and advantages of the present invention, a file processing method based on a distributed file system is described in detail below in accordance with an embodiment of the present invention. Specifically, the method may include the following steps:

[0103] Step 201: pre-configure the recycle bin function using the recycle bin configuration module, wherein the recycle bin function configuration information includes whether to enable the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files;

[0104] Specifically, if the recycle bin reaches the maximum storage capacity, the customer will receive a message prompting that the recycle bin is full, and the user can delete it as needed.

[0105] Step 202: using the operation interception module to obtain a deletion request from outside;

[0106] Specifically, the operation interception module can be used to set a listener in the metadata server of the distributed file system to listen for deletion requests from clients. These requests may come from various client tools, applications, or command line interfaces. When the listener captures a deletion request, it extracts relevant information in the request, such as the original path information and file name of the file to be deleted.

[0107] Step 203: based on the deletion request, determining the target deletion file of the target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete;

[0108] Step 204: Based on the target deletion file, determine whether the target deletion user has the deletion permission, if yes, execute step 205, otherwise, execute step 216;

[0109] Step 205: intercepting the deletion request, redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of the recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file;

[0110] Step 206: Record the original path information of the target deleted file in the extended attribute corresponding to the recycle bin, where the extended attribute is used to represent the original path information of the target deleted file;

[0111] Step 207: updating the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information;

[0112] Step 208: using the file recovery module to obtain a recovery request from the outside;

[0113] Step 209: determining a target recovery file based on the recovery request, wherein the target recovery file is a target deleted file to be recovered;

[0114] Step 210: Based on the target recovery file, determine whether the target recovery user has the recovery permission, if yes, execute step 211, otherwise, execute step 215;

[0115] Step 211: using the file recovery module to obtain the original path information included in the extended attributes of the target recovery file;

[0116] Step 212: Based on the original path information, determine whether the target location is the original location of the target recovery file, if yes, execute step 213:, otherwise, execute step 214;

[0117] Step 213: Restoring the target recovery file to the original location;

[0118] Step 214: Restoring the target recovery file to the target location;

[0119] Specifically, a user may initiate a file recovery request through a client tool, a command line interface, or a graphical interface.

[0120] For example, this refers to the client used by the file system, such as executing rmdir in the command line, or the rm command to delete a file, selecting the delete file option in the graphical interface, etc.

[0121] Step 215: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority;

[0122] Step 216: Send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion authority.

[0123] Specifically, the operation interception module can first verify whether the user who initiates the deletion request has the corresponding deletion permission. This is to ensure the security of the file system and prevent unauthorized users from performing deletion operations. If the user does not have the corresponding deletion permission, the operation interception module will reject the deletion request and return the corresponding error deletion information prompt to the user. If the user has the deletion permission, the operation interception module will intercept the request, rename the file to be deleted to a new name (the same as the original file name), and move it to the specified recycle bin directory. This process is a metadata operation, and the data content will not be modified or deleted during the move process, so the integrity and correctness of the file can be guaranteed. In addition, if there is already a file with the same name in the recycle bin directory, a specified suffix can be added after the file name that needs to be deleted to distinguish files with the same name.

[0124] like Figure 3 As shown, an embodiment of the present invention provides a file processing device based on a distributed file system, the device comprising: an operation interception module 301;

[0125] The operation interception module 301 is used to execute:

[0126] A1: Use the operation interception module to obtain external deletion requests;

[0127] A2: Based on the deletion request, determining a target deletion file of a target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete;

[0128] A3: intercepting the deletion request, redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of a recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file;

[0129] A4: recording the original path information of the target deleted file in an extended attribute corresponding to the recycle bin, wherein the extended attribute is used to represent the original path information of the target deleted file;

[0130] A5: Update the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information.

[0131] based on Figure 3 A file recovery device based on a distributed file system is shown, such as Figure 4 As shown, in one embodiment of the present invention, before the operation interception module, it further includes: a recycling bin configuration module 302;

[0132] The recycle bin configuration module 302 is used to pre-configure the recycle bin function, wherein the recycle bin function configuration information includes whether to enable the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files.

[0133] based on Figure 4 A file recovery device based on a distributed file system is shown. In one embodiment of the present invention, the operation interception module 301 is further used to execute:

[0134] Based on the target deletion file, determine whether the target deletion user has the deletion permission. If yes, execute step A3. Otherwise, send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion permission.

[0135] based on Figure 4 A file processing device based on a distributed file system is shown, Figure 5 As shown, in one embodiment of the present invention, after the operation interception module, a file recovery module 303 is further included;

[0136] The file recovery module 303 is used to perform:

[0137] D1: Use the file recovery module to obtain the recovery request from the outside;

[0138] D2: Determine a target recovery file based on the recovery request, wherein the target recovery file is a target deleted file that needs to be recovered;

[0139] D3: Based on the target recovery file, determine whether the target recovery user has recovery authority, if yes, execute D4, otherwise execute D5;

[0140] D4: restoring the target recovery file to a target location, wherein the target location includes an original location of the target recovery file;

[0141] D5: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority.

[0142] based on Figure 4 A file recovery device based on a distributed file system is shown. In one embodiment of the present invention, the file recovery module 303 is further used to execute:

[0143] Using the file recovery module to obtain the original path information included in the extended attribute of the target recovery file;

[0144] Based on the original path information, determining whether the target location is the original location of the target recovery file;

[0145] When the target location is the original location of the target recovery file, restoring the target recovery file to the original location;

[0146] When the target location is not the original location of the target recovery file, the target recovery file is restored to the target location.

[0147] It is to be understood that the structure illustrated in the embodiment of the present invention does not constitute a specific limitation on a file processing device based on a distributed file system. In other embodiments of the present invention, a file processing device based on a distributed file system may include more or fewer components than those illustrated, or combine certain components, or split certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0148] The information interaction, execution process and other contents between the units in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For specific contents, please refer to the description in the embodiment of the method of the present invention, and no further description is given here.

[0149] An embodiment of the present invention further provides an electronic device, comprising: at least one memory and at least one processor;

[0150] at least one memory for storing a machine-readable program;

[0151] At least one processor is used to call a machine-readable program to execute a file processing method based on a distributed file system in any embodiment of the present invention.

[0152] An embodiment of the present invention further provides a computer-readable medium on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes a file processing method based on a distributed file system in any embodiment of the present invention.

[0153] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.

[0154] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0155] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0156] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0157] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or written to a memory provided in an expansion unit connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or the expansion unit is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0158] Each embodiment of the present invention has at least the following beneficial effects:

[0159] 1. In an embodiment of the present invention, a file processing method based on a distributed file system is provided. When a user needs to delete a file, an operation interception module can be used to intercept all deletion requests of the client and redirect them to a rename operation instead of direct deletion. Then, based on the deletion request of the client, the target deleted file to be deleted is determined, and the target deleted file is moved to the target directory specified by the recycle bin for processing. At the same time, the original path information is recorded during the move process and stored in the extended attributes of the target deleted file for subsequent file recovery operations. Extended attributes are a mechanism for storing additional information related to files in a distributed file system. By storing this information in extended attributes, it can be ensured that even if the file is moved or renamed, its original path information can still be retained. Since the file has been moved to the target directory of the recycle bin, the index information and metadata information of the distributed file system also need to be updated accordingly. The index information and metadata information can be updated by the operation interception module to ensure that the file system can correctly track and manage the files in the recycle bin. Through the above process, even if the user deletes an important file by mistake, it can be retrieved and restored in the recycle bin through the index information, and the permission information can be verified through the metadata information, thereby improving the data security of the distributed file system;

[0160] 2. In the embodiment of the present invention, the original path information is recorded during the moving process of the target deleted file and stored in the extended attribute of the target deleted file. In order to further improve the security of the distributed file system, the user's deletion authority can be verified before the target deleted file is moved to the recycle bin. The above operation process is performed if the user has the deletion authority, and for users who do not have the deletion authority, an error deletion message can be sent to the user to prompt the user. Through the above process, the loss caused by the user's accidental deletion of important files can be avoided, thereby improving the data security of the distributed file system;

[0161] 3. In an embodiment of the present invention, when a user needs to recover a file from the recycle bin, the file recovery module can be used to perform the operation. The module will first verify whether the user who initiated the recovery request has the corresponding authority. This operation is to ensure the security of the file system and prevent unauthorized users from performing recovery operations. If the user does not have the corresponding authority, the file recovery module will reject the request and return a corresponding error recovery information prompt to the user. The module will search in the recycle bin directory based on the file name provided by the user, through index information and metadata information, and quickly locate the file to be recovered. The recycle bin directory is usually a special directory used to store files that have been deleted but not yet permanently deleted.

[0162] It should be noted that not all steps and modules in the above-mentioned processes and system structure diagrams are necessary, and some steps or modules can be ignored according to actual needs. The execution order of each step is not fixed and can be adjusted as needed. The system structure described in the above-mentioned embodiments can be a physical structure or a logical structure, that is, some modules may be implemented by the same physical entity, or some modules may be implemented by multiple physical entities, or some components in multiple independent devices may be implemented together.

[0163] In the above embodiments, the hardware unit can be realized by mechanical means or electrical means. For example, a hardware unit can include permanent dedicated circuits or logic (such as special processors, FPGA or ASIC) to complete the corresponding operation. The hardware unit can also include programmable logic or circuits (such as general-purpose processors or other programmable processors), which can be temporarily set by software to complete the corresponding operation. Concrete implementation (mechanical means or dedicated permanent circuits or temporarily set circuits) can be determined based on cost and time considerations.

[0164] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A file processing method based on a distributed file system, characterized in that: include: A1: Use the operation interception module to obtain external deletion requests; A2: Based on the deletion request, determining a target deletion file of a target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete; A3: intercepting the deletion request, redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of a recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file; A4: recording the original path information of the target deleted file in an extended attribute corresponding to the recycle bin, wherein the extended attribute is used to represent the original path information of the target deleted file; A5: Update the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information.

2. The method according to claim 1, characterized in that Before the operation interception module is used to obtain the deletion request from the outside, the method further includes: using the recycle bin configuration module to pre-configure the recycle bin function, wherein the recycle bin function configuration information includes whether to open the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files; and / or, Before intercepting the deletion request and redirecting the deletion request operation to a rename operation, the method further includes: Based on the target deletion file, determine whether the target deletion user has the deletion permission. If yes, execute step A3. Otherwise, send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion permission.

3. The method according to claim 1, characterized in that: After the updating of the index information and metadata information of the target deleted file, the method further comprises: D1: Use the file recovery module to obtain the recovery request from the outside; D2: Determine a target recovery file based on the recovery request, wherein the target recovery file is a target deleted file that needs to be recovered; D3: Based on the target recovery file, determine whether the target recovery user has recovery authority, if yes, execute D4, otherwise execute D5; D4: restoring the target recovery file to a target location, wherein the target location includes an original location of the target recovery file; D5: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority.

4. The method according to claim 3, characterized in that The step of restoring the target recovery file to a target location includes: Using the file recovery module to obtain the original path information included in the extended attribute of the target recovery file; Based on the original path information, determining whether the target location is the original location of the target recovery file; When the target location is the original location of the target recovery file, restoring the target recovery file to the original location; When the target location is not the original location of the target recovery file, the target recovery file is restored to the target location.

5. A file processing device based on a distributed file system, characterized in that: The device comprises: an operation interception module; The operation interception module is used to execute: A1: Use the operation interception module to obtain external deletion requests; A2: Based on the deletion request, determining a target deletion file of a target deletion user, wherein the target deletion user is the object initiating the deletion request, and the target deletion file is the file that the target deletion user needs to delete; A3: intercepting the deletion request, redirecting the deletion request operation to a rename operation, wherein the redirection operation is used to move the target deleted file to a target directory of a recycle bin, the target directory is used to store the target deleted file, and the rename operation is used to rename the target deleted file; A4: recording the original path information of the target deleted file in an extended attribute corresponding to the recycle bin, wherein the extended attribute is used to represent the original path information of the target deleted file; A5: Update the index information and metadata information of the target deleted file, wherein the index information is used to represent the current location information of the target deleted file, and the metadata information is used to represent the specific attributes of the target deleted file, and the metadata information includes owner information, permission information and update time information.

6. The device according to claim 5, characterized in that Before the operation interception module is used to obtain the deletion request from the outside, it further includes: a recycling bin configuration module; The recycle bin configuration module is used to pre-configure the recycle bin function, wherein the recycle bin function configuration information includes whether to enable the recycle bin, the validity period of the recycle bin file, the maximum storage capacity of the recycle bin, the maximum storage quantity of the recycle bin, and the time for automatically clearing expired files; and / or, The operation interception module is also used to execute: Based on the target deletion file, determine whether the target deletion user has the deletion permission. If yes, execute step A3. Otherwise, send an error deletion information prompt to the target deletion user, wherein the error deletion information prompt is used to indicate that the target deletion user does not have the deletion permission.

7. The device according to claim 5, characterized in that After the operation interception module, it further includes: a file recovery module; The file recovery module is used to execute: D1: Use the file recovery module to obtain the recovery request from the outside; D2: Determine a target recovery file based on the recovery request, wherein the target recovery file is a target deleted file that needs to be recovered; D3: Based on the target recovery file, determine whether the target recovery user has recovery authority, if yes, execute D4, otherwise execute D5; D4: restoring the target recovery file to a target location, wherein the target location includes an original location of the target recovery file; D5: Sending an error recovery information prompt to the target recovery user, wherein the error recovery information prompt is used to reflect that the target recovery user does not have the recovery authority.

8. The device according to claim 7, characterized in that The file recovery module is further used to execute: Using the file recovery module to obtain the original path information included in the extended attribute of the target recovery file; Based on the original path information, determining whether the target location is the original location of the target recovery file; When the target location is the original location of the target recovery file, restoring the target recovery file to the original location; When the target location is not the original location of the target recovery file, the target recovery file is restored to the target location.

9. An electronic device, characterized in that include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 4.

10. A computer readable medium, characterized in that The computer readable medium stores computer instructions, which, when executed by a processor, cause the processor to perform any one of the methods of claims 1 to 4.

Citation Information

Patent Citations

  • Data object deleting method and device based on distributed file system

    CN106354884A

  • Renaming method and device in distributed file system, and distributed file system

    CN108647285A

  • File processing method, system and device, equipment and storage medium

    CN109739815A

  • Recycle bin system and file recycling method

    CN110888847A

  • File deletion method, apparatus and device, and readable storage medium

    CN110941591A