File data processing method, device, equipment and medium
By adopting a batch deletion strategy and path adjustment in the storage module of the end-side device, the problem of high performance consumption of the storage module during file deletion is solved, efficient and reliable file deletion is achieved, and the high performance state of the storage module is maintained.
Patent Information
- Application Number
- CN202210459274.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2042-04-27
AI Technical Summary
The storage module of the existing end-side device consumes a lot of performance during the file deletion process, resulting in a decrease in storage module performance, affecting the normal operation of other modules, and possibly causing file loss.
A batch deletion strategy is adopted, which moves the file data to be deleted to the preset space, and deletes the files in batches in the space according to the target deletion strategy. The storage path depth is adjusted, and the target deletion strategy is determined based on the current available capacity of the file storage space and the current amount of data in the message queue.
It reduces the peak performance consumption, keeps the storage module in a high-performance state, reduces the possibility of file loss, avoids affecting the work of other modules, and improves the efficiency of file deletion and request response speed.
Smart Images

Figure CN114817164B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, apparatus, device and medium for processing file data. Background Art
[0002] With the development of technology, the specifications of chips are getting smaller and smaller, the computing power is getting stronger and stronger, and the functions of chips are becoming more and more powerful. The terminal devices are also gradually evolving from simple acquisition devices into independent units that integrate acquisition, analysis, calculation, storage, push and other functions. There is no need for supporting network video recorders, small boxes and other equipment.
[0003] Although the performance of edge devices is gradually improving, its performance is always limited. Therefore, in order to ensure that the edge devices are in a high-performance state, each module of the edge devices needs to ensure that the module itself is in a high-performance state. Among them, storage is an important part of the device's operation, and the high-performance maintenance solution of existing storage modules is less effective. Summary of the Invention
[0004] This application at least provides a method, apparatus, device and medium for processing file data.
[0005] The present application provides a method for processing file data, including: receiving a file data deletion request; searching for file data to be deleted from a file storage space based on the deletion request, wherein the file data to be deleted includes at least one file; moving the file data to be deleted to a preset space; and deleting the files in the preset space in batches according to a target deletion strategy.
[0006] Therefore, by deleting the files in the preset space in batches according to the target deletion strategy, the peak performance consumption is reduced compared to centralized deletion, so that the storage module remains in a high-performance state, reducing the possibility of loss of files to be stored due to file deletion, and avoiding affecting the work of other modules.
[0007] Among them, after moving the file data to be deleted to the preset space, the method also includes: adjusting the storage path of the file data to be deleted, wherein the path depth of the adjusted storage path is less than the storage path before the adjustment, and / or the adjusted storage path includes the time when the deletion request is received.
[0008] Therefore, by reducing the depth of the storage path, the efficiency of traversal when deleting files can be improved, performance consumption can be reduced, and the efficiency of deleting files can be improved; at the same time, increasing the time of the deletion request as a path can prevent data races.
[0009] Among them, deleting files in the preset space in batches according to the target deletion strategy includes: determining the target deletion strategy based on at least one of the current available capacity of the file storage space and the current amount of data in the message queue, wherein the message queue is used to cache the files to be stored in the file storage space; detecting whether file deletion is currently being executed according to the target deletion strategy; in response to the current execution of file deletion, selecting files in the preset space that meet the preset file requirements for deletion, repeating the above-mentioned determination of the target deletion strategy based on at least one of the current available capacity of the file storage space and the current amount of data in the message queue and its subsequent steps until all files in the preset space are deleted.
[0010] Therefore, the corresponding target deletion strategy can be determined based on the current available capacity of the file storage space and the current amount of data in the message queue, making file deletion more flexible and more adaptable to the current storage situation, so that the storage module remains in a high-performance state.
[0011] Among them, based on at least one of the current available capacity of the file storage space and the current amount of data in the message queue, the target deletion policy is determined, including: in response to the current available capacity meeting the first requirement, determining the target deletion policy as the first deletion policy; in response to the current available capacity not meeting the first requirement and the current amount of data meeting the second requirement, determining the target deletion policy as the second deletion policy; in response to the current available capacity not meeting the first requirement and the current amount of data not meeting the second requirement, determining the target deletion policy as the third deletion policy.
[0012] Therefore, by judging whether the current available capacity meets the first requirement and whether the current data quantity meets the second requirement, different deletion strategies can be determined according to different storage situations, thereby achieving more flexible file deletion and better adaptation to the current storage situation.
[0013] Among them, the first deletion strategy is to execute file deletion at intervals of a first time period; and / or, the second deletion strategy is to detect whether the current amount of data in the message queue meets the third requirement every third time period within the second time period, and execute file deletion in response to the current amount of data meeting the third requirement, or in response to the current amount of data not being detected to meet the third requirement within the second time period, wherein the second time period is greater than the third time period; and / or, the third deletion strategy is to execute file deletion at intervals of a fourth time period.
[0014] Therefore, different deletion strategies have different intervals, which can control the time interval for executing file deletion based on the current available capacity and the current amount of data in the message queue, thereby making file deletion more flexible and more adaptable to the current storage situation.
[0015] Among them, the first requirement is that the current available capacity is less than or equal to the preset capacity threshold, the second requirement is that the current data quantity is greater than the first quantity threshold, and the third requirement is that the current data quantity is less than or equal to the second quantity threshold, among which the first quantity threshold is greater than or equal to the second quantity threshold.
[0016] Therefore, the first requirement indicates that the current available capacity is small, the second requirement indicates that the current number of files to be stored is large, and the third requirement indicates that the current number of files to be stored is decreasing, thereby determining that the first deletion strategy is adopted when the current available capacity is small, the second deletion strategy is adopted when the current number of files to be stored is large, and the third deletion strategy is adopted when the current available capacity is large and the current number of files to be stored is small.
[0017] The preset file requirement includes files whose generation time is within the target time period.
[0018] Therefore, the files deleted in a batch can be determined within the target time period by the file generation time.
[0019] The method further includes: in response to the current available capacity meeting the first requirement, stopping the storage of the file to be stored.
[0020] Therefore, when the current available capacity is small, you can also stop executing the storage of the files to be stored, so as to prevent data loss caused by the small available capacity.
[0021] The method further includes at least one of the following steps: receiving a storage request for a file to be stored, storing the file to be stored in the file storage space; and issuing a reminder that the storage is about to be full in response to detecting that the current storage capacity of the file storage space is greater than a preset capacity.
[0022] Therefore, when the current storage capacity is greater than the preset capacity, a reminder that the storage is almost full can be issued, which can prompt the need to delete files to prevent data loss due to low available capacity.
[0023] Storing the files to be stored in the file storage space includes: caching the files to be stored in the message queue; and storing the files to be stored cached in the message queue in the file storage space according to a preset order.
[0024] Therefore, by setting up the message queue, the files to be stored can be cached in the message queue, which can prevent the memory occupation caused by slow message consumption.
[0025] The storage path of the file to be stored in the file storage space is composed of at least the root path of the file storage space, the identifier of the task associated with the file to be stored, the type of the algorithm associated with the file to be stored, and the generation time of the file to be stored.
[0026] Therefore, by using the task identifier, algorithm type, generation time, etc. to form a storage path, files can be kept in order and easy to find.
[0027] The sending of the reminder that the storage is almost full includes: reporting the reminder to the business module, wherein the business module is used to feed back the reminder to the user so that the user can confirm whether to initiate a deletion request through the business module.
[0028] Therefore, by sending the reminder to the business module to feed back to the user, the user can be reminded that the file needs to be deleted when the storage is full, and the file can be deleted according to the user's confirmation, avoiding the situation of mistakenly deleting the file required by the user.
[0029] The present application also provides a file data processing device, including: a receiving module, a searching module, a moving module and a deleting module, wherein the receiving module is used to receive a file data deletion request; the searching module is used to find the file data to be deleted from the file storage space according to the deletion request, wherein the file data to be deleted includes at least one file; the moving module is used to move the file data to be deleted to a preset space; and the deleting module is used to delete the files in the preset space in batches according to the target deletion strategy.
[0030] The present application also provides an electronic device, comprising a memory and a processor coupled to each other, wherein the processor is configured to execute program instructions stored in the memory to implement the file data processing method in the first aspect described above.
[0031] The present application also provides a computer-readable storage medium having program instructions stored thereon, which implement the file data processing method in the first aspect mentioned above when the program instructions are executed by a processor.
[0032] The above solution deletes the files in the preset space in batches according to the target deletion strategy. Compared with centralized deletion, it reduces the peak performance consumption, keeps the storage module in a high-performance state, reduces the possibility of loss of stored files due to file deletion, and avoids affecting the work of other modules.
[0033] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] The drawings herein are incorporated into and constitute a part of the specification. These drawings illustrate embodiments consistent with the present application and, together with the specification, are used to illustrate the technical solutions of the present application.
[0035] Figure 1 This is a flow chart of an embodiment of a method for processing document data of the present application;
[0036] Figure 2 This is a flowchart of another embodiment of the method for processing file data in the present application;
[0037] Figure 3 This is a flowchart of another embodiment of step S210 in this application;
[0038] Figure 4 This is a flowchart of another embodiment of the method for processing file data in the present application;
[0039] Figure 5 A flowchart of another embodiment of step S440 in this application;
[0040] Figure 6 This is a flow chart of another embodiment of the method for processing document data of the present application;
[0041] Figure 7 It is a schematic diagram of the framework of an embodiment of a device for processing document data of the present application;
[0042] Figure 8 This is a schematic diagram of the framework of an embodiment of the electronic device of the present application;
[0043] Figure 9 This is a schematic diagram of a framework of an embodiment of a computer-readable storage medium of the present application. DETAILED DESCRIPTION
[0044] The following describes the embodiments of the present application in detail with reference to the accompanying drawings.
[0045] In the following description, for the purpose of explanation rather than limitation, specific details such as specific system structures, interfaces, and technologies are provided to facilitate a thorough understanding of the present application.
[0046] The term "and / or" in this article is simply a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects are in an "or" relationship. In addition, "many" in this article means two or more than two. In addition, the term "at least one" in this article means any combination of at least two of any one or more of a plurality of. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0047] The file data processing method in the present application can be executed by an electronic device, which can be any device with processing capabilities, such as a mobile phone, a tablet computer, a computer, etc. Furthermore, the electronic device can be an end-side IOT (Internet of Things) device, which is an independent unit integrating functions such as collection, analysis, calculation, storage, and push. The electronic device includes a storage module and a storage medium, and the storage module can be used to manage the storage medium of the electronic device, for example, writing file data, deleting file data, etc.
[0048] See also Figure 1 , Figure 1 1 is a flow chart of an embodiment of a method for processing document data of the present application. Specifically, the relevant steps of the method can be performed by a storage module of an electronic device. The method may include the following steps:
[0049] Step S110: receiving a file data deletion request.
[0050] The electronic device may further include a business module and / or other modules. The business module and / or other modules may send a file data deletion request to the storage module, requesting the storage module to delete the file data to be deleted, and the storage module may receive the deletion request.
[0051] Step S120: According to the deletion request, the file data to be deleted is searched from the file storage space.
[0052] After receiving the deletion request, the storage module may determine the file data to be deleted according to the deletion request, and search for the file data to be deleted from the file storage space.
[0053] Step S130: Move the file data to be deleted to a preset space.
[0054] It can be understood that this embodiment uses the receipt of a deletion request and related subsequent processing as an example for explanation. The storage module can also execute the steps in this embodiment multiple times, and the execution of the steps in this embodiment is triggered by the deletion request sent by the business module and / or other modules.
[0055] After completing step S130, the storage module may reply to the deletion request, and the module that sent the deletion request may consider that the deletion request has been completed.
[0056] Step S140: Deleting files in the preset space in batches according to the target deletion policy.
[0057] When moving the to-be-deleted file data to the preset space, the preset space may already contain previously moved files, or may not contain any other files. The to-be-deleted file data may include at least one file. The files in the preset space may be considered to be files to be deleted. The files in the preset space may be deleted in batches according to the target deletion policy. The storage module may initiate a background thread to execute step S140.
[0058] Deleting in batches can include two meanings. On the one hand, it means that the files in the preset space are divided into several batches. On the other hand, the deletion operations of files in different batches are independent of each other and are not executed continuously.
[0059] It can be understood that the target deletion policy can be a target deletion policy pre-stored in the electronic device. For example, the target deletion policy can be to delete files that meet the preset file requirements when the preset conditions are met, wherein the preset conditions can be a preset time interval, etc. Then the files in the preset space are divided into batches according to the preset file requirements. Batch deletion means that a batch of files are deleted when the preset conditions are met. The objects of the batch file deletion are files that meet the preset file requirements, until all files in the preset space are deleted.
[0060] It should be noted that, usually, the storage module can delete file data by searching for the file data to be deleted and executing a delete command (rm command) on it, thereby deleting the file data to be deleted. However, when deleting in this way, if the file data to be deleted is large, it may cause blockage of read and write IO (Input / Output), and increase the CPU (Central Processing Unit) usage. Since the performance of electronic devices is limited, and electronic devices process both writing and deleting file data, deleting file data at this time takes up too many resources, which will affect the storage of files to be stored, and may cause the loss of files to be stored, affecting the storage of file data.
[0061] Table 1 shows the results of a performance test that uses the delete command to directly delete all files. A 1GB file was created according to the storage path of "storage medium root path / task number / algorithm type / date / hour" and then directly deleted. This test was performed without any other applications running.
[0062] Serial number Blk_wrtn / s CPU usage Execution time (seconds) 1 7215.84 41.58 1.22 2 7203.96 64.36 1.24 3 4891.09 58.42 1.33
[0063] Table 1 Performance test results
[0064] Based on the above test results, we can see that the delete command caused a significant increase in IO writes and a surge in CPU usage. Moreover, this data was tested without any application running. In a real environment, the performance impact will be even greater. Therefore, if the delete command is called directly, the storage of new files and the normal operation of other modules will be affected on the terminal device with relatively weak performance.
[0065] In this embodiment, however, the deletion of file data to be deleted does not involve directly executing a delete command on the file data. Instead, after moving the file data to be deleted to a preset space, the files in the preset space are deleted in batches according to a target deletion policy. Compared to traditional deletion methods, the files in the preset space are divided into batches, which controls the number of files deleted in a batch and reduces the performance consumption of a single deletion. Moreover, the target deletion policy does not process files in different batches continuously, but rather processes them at intervals. Therefore, the high performance consumption of deleting large batches of file data over a period of time is converted into smaller performance consumption at intervals, reducing the peak performance consumption. This allows the storage module to maintain high performance without causing the loss of stored files or affecting the operation of other modules.
[0066] In the above embodiment, by deleting files in the preset space in batches according to the targeted deletion policy, peak performance consumption is reduced compared to centralized deletion, allowing the storage module to maintain high performance, reducing the possibility of loss of stored files due to file deletion, and avoiding impact on the operation of other modules. Furthermore, once the deleted file data is moved to the preset space, the deletion request can be replied to, improving the request response speed and shortening the interaction time between modules.
[0067] See also Figure 2 , Figure 2 : is a flowchart of another embodiment of the method for processing file data in the present application. Specifically, the method may include the following steps:
[0068] Step S210: receiving a storage request for a file to be stored, and storing the file to be stored in the file storage space.
[0069] It should be noted that the electronic device in the present application may further include an encoding module and / or other modules. When the encoding module and / or other modules generate a storage requirement, they send a storage request to the storage module for the file to be stored. After receiving the storage request, the storage module stores the file to be stored in the file storage space. The execution of step S210 is triggered by the storage request sent by other modules to the storage module, and the number of times it is executed and the order of execution with other steps are not limited.
[0070] It should be noted that during actual operation of the electronic device, the storage module performs independent operations on storage and deletion. At the same time, the storage module can simultaneously store files to be stored and delete files to be deleted. In this embodiment, for ease of understanding, the process of storing and deleting the same file data is described as an example. For the same file data, it is first stored and then deleted upon receiving a deletion request. During storage, it is treated as a file to be stored, and during deletion, it is treated as a file to be deleted.
[0071] Please refer to Figure 3 , Figure 3 This is a flowchart of another embodiment of step S210 in the present application. Step S210 may further include:
[0072] Step S311: Cache the file to be stored in the message queue.
[0073] The storage request sent by the encoding module and / or other modules to the storage module includes the file to be stored. After receiving the storage request, the storage module caches the file to be stored in the message queue. The number of messages that the message queue can accommodate is fixed. If the storage module consumes the message too slowly, it may cause the message queue to discard the new request data, resulting in frame loss. Since the performance of electronic devices is limited, if the storage module consumes a lot of performance due to deleting file data, it may cause the consumption of messages in the message queue to slow down, the storage of the file to be stored to slow down, the message may be lost, and it may also affect the normal operation of other modules. Therefore, it is necessary to optimize the deletion operation to maintain the high performance of the storage module.
[0074] The encoding module, business module, and storage module in this application can be in the form of either a dynamic library or a process. If the storage module is in the form of a dynamic library, it will provide an interface for other modules to call. If it is a process, the storage module will act as a server and provide services such as Hypertext Transfer Protocol (HTTP) or Remote Procedure Calls (gRPC) for client requests.
[0075] Step S312: storing the files to be stored in the message queue buffer into the file storage space according to a preset order.
[0076] The storage module sequentially processes the files to be stored cached in the message queue and stores them in the file storage space. It is understood that when storing the files to be stored in the file storage space, the storage module may determine the storage path according to a preset rule. The determination of the path needs to take into account the needs of subsequent file deletion and user viewing.
[0077] For example, when storing a file to be stored, the storage path hierarchy is set according to the task identifier associated with the file to be stored, the algorithm type associated with the file to be stored, the generation time of the file to be stored, etc. For example, the storage path may be: storage medium root path / task number / algorithm type / date / hour. The task number, algorithm type, date, and hour may be determined based on a storage request for the file to be stored provided by another module, and the date and hour may be the time the file was generated. This allows users to conveniently view files in the file storage space based on information such as the task number, algorithm type, and time.
[0078] It should be noted that when storing files, their storage path can correspond to the preset file requirements for subsequent deletion. For example, when executing file deletion, the preset file requirement is that the file is generated within one hour. Then, when storing files, files generated within the same hour can be stored in the same folder. When deleting a file subsequently, only one folder needs to be operated.
[0079] In a specific application scenario, the electronic device may be an identification device, and the algorithm types running therein may include face recognition algorithms, vehicle recognition algorithms, etc. Several algorithms may be run during the execution of a task by the device. The file to be stored may be a picture collected by the identification device during the execution of a task. The collection time is also the generation time. Several algorithms may be run for the picture, so as to determine the task identifier, algorithm type and generation time associated with the file to be stored, so as to determine the storage path when storing.
[0080] Step S220: Receive a file data deletion request.
[0081] It should be noted that the storage module can determine the file data to be deleted based on the deletion request. For example, the deletion request may include relevant information that can identify the file data to be deleted, such as at least one of the generation time of the file data to be deleted, the task identifier, and the algorithm type. Specifically, for example, the deletion request may specify a start time and a deadline, and all files generated between the start time and the deadline are considered file data to be deleted.
[0082] Step S230: According to the deletion request, the file data to be deleted is searched from the file storage space.
[0083] Finding the file data to be deleted in step S230 can be achieved by traversing the file storage space according to a DFS algorithm (Depth-First-Search).
[0084] Step S240: moving the file data to be deleted to a preset space, and adjusting the storage path of the file data to be deleted.
[0085] Moving the file data to be deleted to the preset space can be achieved by executing a rename command (mv command). The rename command executes in a very short time, almost 0 seconds, and hardly uses CPU and IO. After completing the movement of the file data to be deleted to the preset space, the storage module can respond to the deletion request. The module that sent the deletion request can then consider the deletion request completed, thus greatly shortening the interaction time between modules. The storage module can then start a background thread to execute the subsequent deletion steps.
[0086] It should be noted that when deleting files in a preset space in batches, the files to be deleted in the current batch must first be found. To delete all files in the preset space, the storage module will traverse the folders in the preset space during multiple searches for the files to be deleted in the current batch. The storage module may traverse the preset space using a DFS (Depth-First-Search) algorithm. It is understood that the depth-first traversal method of the depth-first algorithm is significantly affected by the depth of the folder tree. Excessive folder tree levels can affect traversal efficiency and consume system performance, such as memory and CPU. For example, the preset space is a Recycle Bin, which includes multiple folder hierarchies, such as task number, algorithm, and date. For example, the storage path for a folder in the Recycle Bin might be " / Recycle / Task Number 1 / Algorithm 1 / Date 1 / 02." The storage module traverses the folders in the preset space using a depth-first algorithm to delete all files in the preset space. In this case, the folder depth is 5.
[0087] In order to improve the efficiency of the deletion process and reduce system performance consumption, after moving the file data to be deleted to the preset space, the storage path of the file data to be deleted can also be adjusted. The depth of the adjusted storage path is smaller than the storage path before adjustment, thereby improving the efficiency of traversing the folders in the preset space and reducing performance consumption in the subsequent deletion process.
[0088] Specifically, adjusting the storage path of the file data to be deleted can also be achieved by executing the rename command (mv command), for example, renaming " / Recycle / Task Number 1 / Algorithm 1 / Date 1 / 02" to " / Recycle / Task Number 1_Algorithm 1_Date 1 / 02", so that the folder depth is reduced to 3.
[0089] It can be understood that since both steps of moving the file data to be deleted to the preset space and adjusting the storage path of the file data to be deleted can be achieved by executing the rename command (mv command), the two steps can be achieved by executing the rename command twice or by executing the rename command once.
[0090] In some embodiments, the storage path of a file in a file storage space is composed of the root path of the file storage space, the task identifier associated with the file, the type of algorithm associated with the file, and the date and hour of file generation. For example, if the file data to be deleted corresponding to the request to be deleted is generated in the current hour, the corresponding storage path is "storage medium root path / task number a / algorithm type b / date c / hour d", then after the storage module moves the file data to be deleted to the preset space, the current file data is still continuously generated and stored in the file storage space, and the path is still "storage medium root path / task number a / algorithm type b / date c / hour d", if the subsequent deletion request still corresponds to the file data in the folder, then when the file data to be deleted is moved to the preset space again, the storage path of the file to be deleted in the two deletion request operations will be adjusted based on the original storage path, and the two will be consistent, thereby causing data competition. Therefore, when adjusting the storage path of the file data to be deleted, the deletion time and / or other identifiers can be added. The adjusted storage path can also include the time and / or other identifiers of receiving the deletion request. The other identifiers can be random numbers, etc. By adding deletion times and / or other identifiers, files generated during the same time period can be deleted at different times. This creates files with different storage paths within the preset space, preventing data races. For example, using the rename command, the storage path for the deleted files can be changed to " / Recycle / Task Number_Algorithm_Date 1_Delete Time / 02."
[0091] Step S250: Deleting files in the preset space in batches according to the target deletion policy.
[0092] Among them, the target deletion strategy can be to delete files that meet the preset file requirements when the preset conditions are met. The preset conditions can be a preset time interval, etc. The preset file requirement can be files whose file generation time is within the target time period, or the preset file requirement can also be files whose size is within a preset range, etc. Based on the preset file requirements, the files that need to be deleted in the current batch can be determined. Among them, the preset time can be set according to actual needs, the default length of the target time period in the preset file requirements can also be set according to actual needs, and the file size in the preset file requirements can also be set according to actual needs. For example, the preset time is 20s, the default length of the target time period can be one hour, the preset space includes files generated in several hours, and the storage module executes a file deletion every 20s. When performing a file deletion, any hour corresponding to a file in the preset space can be used as the target time period, and files whose generation time is within the target time period are deleted.
[0093] In step S250, the files to be deleted are those created within the target time period. To perform this deletion, the folder must first be found. Therefore, in the process of deleting all files in the preset space, the storage module traverses the folders in the preset space. At this point, the depth of the storage path for the files in the preset space has been adjusted, improving traversal efficiency and reducing performance consumption.
[0094] In the above embodiment, by deleting files in a preset space in batches according to a targeted deletion policy, peak performance consumption is reduced compared to centralized deletion, allowing the storage module to maintain high performance, reducing the possibility of lost stored files due to file deletion, and avoiding impacts on the operation of other modules. Furthermore, by reducing the depth of the storage path, the efficiency of traversal when deleting files is improved, reducing performance consumption.
[0095] See also Figure 4 , Figure 4 FIG. 5 is a flow chart of another embodiment of the method for processing file data in the present application. Specifically, the method may include the following steps:
[0096] Step S410: receiving a file data deletion request.
[0097] Step S420: According to the deletion request, the file data to be deleted is searched from the file storage space.
[0098] For steps S410 to S420, reference may be made to the relevant contents in the aforementioned embodiment and will not be repeated here.
[0099] Step S430: Move the file data to be deleted to a preset space.
[0100] After completing step S430, the storage module can reply to the deletion request, and the module that sent the deletion request can consider that the deletion request has been completed. Then the storage module can start the background thread to execute subsequent steps to process the files in the preset space.
[0101] It should be noted that step S140 can be implemented by executing steps S440 and S450 several times. The background thread can delete the files in the preset space in batches. In this embodiment, deletion of a batch is used as an example for description.
[0102] Step S440: Determine a target deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue.
[0103] In order to delete the files in the preset space in batches according to the target deletion strategy, it is first necessary to determine the target deletion strategy. Step S440 is used to determine the target deletion strategy. Among them, the current available capacity can reflect the current storage situation of the electronic device. If the current available capacity is small, then there may be a situation where the storage of subsequent files to be stored is affected by the small available capacity; the current number of data in the message queue can reflect the number of files to be stored. Since the size of the message queue is fixed, if the current number of data in the message queue is too much, and the storage module consumes messages slowly, then messages may be lost. Therefore, based on the relevant storage conditions, a target deletion strategy suitable for the current situation can be determined to adapt to the current situation for deletion operations.
[0104] It should be noted that the electronic device may have multiple pre-stored deletion policies. Step S440 can be understood as selecting a target deletion policy appropriate for the current situation based on the current available capacity and the current amount of data in the message queue. Specifically, the deletion policy specifies the time interval between determining the target deletion policy and executing file deletion, as well as the preset file requirements for a single deletion. Different deletion policies may have different intervals before executing file deletion, different preset file requirements, or some deletion policies may include additional restrictions.
[0105] If the current storage space has sufficient capacity and the current amount of data in the message queue is not excessive, file deletion will proceed normally. If the current available storage space is small, file deletion will be accelerated to avoid affecting the storage of files to be stored due to insufficient storage space. If the current storage space has sufficient capacity but the current amount of data in the message queue is large, file deletion will be slowed down to avoid message loss. The above-mentioned acceleration and deceleration of file deletion can be reflected by different time intervals between determining the target deletion policy and executing file deletion, or by different preset file requirements for deletion at one time.
[0106] In some embodiments, the storage module may first determine whether there are recyclable files in the preset space. If so, it may execute the relevant steps of determining the target deletion strategy and executing file deletion. If not, it may return to determine again whether there are recyclable files in the preset space.
[0107] Please refer to Figure 5 , Figure 5 A flowchart of another embodiment of step S440 in the present application, step S440 may include:
[0108] Step S541: Determine whether the current available capacity meets the first requirement.
[0109] The first requirement is that the current available capacity is less than or equal to a preset capacity threshold. This threshold can be adjusted based on actual needs. For example, the threshold could be 10%. Generally speaking, meeting the first requirement indicates that the current available capacity is low. Therefore, electronic devices need to determine a target deletion policy to avoid file storage issues caused by limited storage space.
[0110] Step S542: In response to the current available capacity meeting the first requirement, determining the target deletion policy as the first deletion policy.
[0111] Among them, the first deletion strategy can be to execute file deletion at intervals of a first time period, wherein the first time period can be adjusted according to actual needs. It should be noted that executing file deletion specifically means executing file deletion once, and deleting files that meet the preset file requirements. Generally speaking, meeting the first requirement can mean that the current available capacity is small. Then, for electronic devices, in order to avoid affecting the storage of files due to the small storage space, it is necessary to speed up the removal of file data in the preset space. Then, the first time period in the first deletion strategy is set to a shorter interval. In a specific application scenario, the first time period can be 10s or 15s.
[0112] In some embodiments, when the current available capacity meets the first requirement, in addition to determining that the target deletion policy is the first policy, the storage of files to be stored can also be stopped. The recovery of files to be stored can be performed after the deletion of this batch of files, or can be set as needed.
[0113] Step S543: In response to the current available capacity not meeting the first requirement, determining whether the current data quantity meets the second requirement.
[0114] If the current available capacity does not meet the first requirement, it may mean that the current available capacity is large and can meet the storage needs. Then it is judged whether the current data quantity meets the second requirement, where the current data quantity can reflect the number of files to be processed and stored. The second requirement may be that the current data quantity is greater than the first quantity threshold.
[0115] If the current available capacity does not meet the first requirement, and the current amount of data meets the second requirement, then it may mean that there are many files to be processed and stored, and the corresponding target strategy needs to be determined in this case.
[0116] Step S544: In response to the current available capacity not meeting the first requirement and the current data quantity meeting the second requirement, determining that the target deletion policy is the second deletion policy.
[0117] The second deletion strategy may be to detect whether the current amount of data in the message queue meets a third requirement at intervals of a third time period within the second time period, and execute file deletion in response to the current amount of data meeting the third requirement, or if the current data is not detected to meet the third requirement during the second time period; the third requirement may be that the current amount of data is less than or equal to the second amount threshold, and the first amount threshold is greater than or equal to the second amount threshold, indicating that the number of files currently to be processed and stored has decreased. The first amount threshold and the second amount threshold can be adjusted according to actual needs. For example, the first amount threshold can be 80% of the total amount that the message queue can accommodate, and the second amount threshold can be 50% of the total amount that the message queue can accommodate.
[0118] When there is still free storage space and there are many files to be stored that are currently waiting to be processed, in order to avoid the loss of files to be stored, the storage module can slow down the deletion operation accordingly, give priority to consuming messages in the message queue, and store files to be stored. Therefore, the current data quantity is detected within a longer second time period. If the current data quantity drops to meet the third requirement, it means that the current files to be stored that are currently waiting to be processed have dropped to meet the requirement, and this file deletion can be executed. If within the second time period, the current data quantity has never dropped to meet the third requirement, in order to avoid the loss of files caused by not executing file deletion for a long time, this file deletion is executed after the second time period ends.
[0119] That is, when the second deletion policy is used, the time interval between determining the deletion policy and executing file deletion is not fixed, but is affected by changes in the current amount of data and is limited to the second time period. If there is sufficient storage space and the number of files currently waiting to be processed remains high, the time interval between determining the deletion policy and executing file deletion is the second time period. The specific lengths of the second and third time periods can be set based on actual needs. In a specific application scenario, the second time period may be 30 seconds, and the third time period may be 5 seconds.
[0120] Step S545: In response to the current available capacity not meeting the first requirement and the current data quantity not meeting the second requirement, determining that the target deletion policy is the third deletion policy.
[0121] Among them, the third deletion strategy is to execute file deletion at intervals of a fourth time period, where the length of the fourth time period is greater than the length of the first time period, and the length of the fourth time period is less than the length of the third time period. The length of the fourth time period can be set according to actual needs. In a specific application scenario, the fourth time period can be 20 seconds. If the current available capacity does not meet the first requirement and the current amount of data does not meet the second requirement, it can be considered that there is still free storage space and the pressure of writing files to be stored is not great. In this case, the fourth time period in the third deletion strategy is longer than the first time period when the current available capacity is small, and shorter than the third time period when there is still free storage space and there are many files to be stored that are currently waiting to be processed.
[0122] It can be understood that in this embodiment, the time interval between determining the target deletion strategy and executing the file deletion is adjusted during a deletion operation to make file deletion more flexible and adaptable to the current storage situation. In some embodiments, the preset file requirements can also be adjusted to adjust the amount of data deleted at a time, thereby making file deletion more flexible and adaptable to the current storage situation. For example, the preset file requirements include files whose file generation time is within the target time period. Then, by adjusting the length of the target time period, the amount of data deleted at a time can be adjusted, thereby achieving flexible settings for file deletion. Specifically, when the current available capacity is small, the amount of data deleted at a time is increased to speed up file deletion; when there is still free storage space, but the write pressure of the files to be stored is high, the amount of data deleted at a time can be appropriately reduced, thereby reducing the performance consumption of file deletion and improving the storage efficiency of the files to be stored.
[0123] In some embodiments, the adjustment of the time interval and the adjustment of the preset file requirements may also be combined to make file deletion more flexible.
[0124] In some embodiments, other methods may be used to divide the files in the preset space into batches. For example, the preset file requirement may be that the data volume meets a preset size, thereby dividing the files in the preset space into batches and determining a batch of deleted files.
[0125] Step S450: detecting whether file deletion is currently being executed according to the target deletion policy, and in response to the current execution of file deletion, selecting files in the preset space that meet preset file requirements for deletion.
[0126] The target deletion strategy is determined in step S440, and then in step S450, file deletion is executed according to the deletion strategy determined in step S440. Whether file deletion is currently executed is determined based on the target deletion strategy. For example, if the target deletion strategy is to execute file deletion after an interval of 20 seconds, then after 20 seconds, in response to the current execution of file deletion, the files in the preset space that meet the preset file requirements are selected for deletion.
[0127] In a specific application scenario, the storage module determines that the target deletion strategy is the first deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue. After determining the target deletion strategy, file deletion is executed at intervals of 20 seconds according to the first deletion strategy, thereby completing the deletion of this batch of files.
[0128] In a specific application scenario, the storage module determines that the target deletion strategy is the second deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue. After determining the target deletion strategy, according to the second deletion strategy, within 30 seconds, the current amount of data is checked every 5 seconds to see if it meets the third requirement. After 6 checks (30 seconds), if the current amount of data still does not meet the third requirement, then file deletion is executed at this time, thereby completing the deletion of this batch of files.
[0129] In a specific application scenario, the storage module determines that the target deletion strategy is the second deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue. After determining the target deletion strategy, according to the second deletion strategy, within 30 seconds, the current amount of data is checked every 5 seconds to see whether it meets the third requirement. After two checks (10 seconds), if it is detected that the current amount of data meets the third requirement, the file deletion is executed at this time, thereby completing the deletion of this batch of files.
[0130] In a specific application scenario, the storage module determines that the target deletion strategy is the second deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue. After determining the target deletion strategy, according to the second deletion strategy, within 30 seconds, the current amount of data is checked every 5 seconds to see whether it meets the third requirement. After 4 checks (20 seconds), it is detected that the current amount of data meets the third requirement. At this time, file deletion is executed, and the deletion of this batch of files is completed.
[0131] In a specific application scenario, the storage module determines that the target deletion strategy is the third deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue. After determining the target deletion strategy, file deletion is executed at intervals of 20 seconds according to the third deletion strategy, thereby completing the deletion of this batch of files.
[0132] Please refer to Figure 6 , Figure 6 It is a flow chart of another embodiment of the method for processing document data of the present application.
[0133] Figure 6 The first deletion strategy is to delete files every 10 seconds. The second deletion strategy is to start a timer and determine within 30 seconds whether the current data quantity meets the third requirement. If it does or if it does not meet the third requirement within 30 seconds, the file will be deleted. The third deletion strategy is to delete files every 20 seconds.
[0134] When executing file deletion, the preset file requirement is that the file is generated within one hour. Then one deletion is to find the folder in hours from the preset space and delete it.
[0135] It can be understood that the above-mentioned steps of determining the target deletion strategy based on at least one of the current available capacity of the file storage space and the current amount of data in the message queue, and detecting whether file deletion is currently being executed according to the target deletion strategy, and selecting files in the preset space that meet the preset file requirements for deletion in response to the current execution of file deletion, are steps of deleting a batch of files, and the storage module can repeat the above steps until all files in the preset space are deleted.
[0136] In some embodiments, a batch deletion operation is performed on the files in the preset space from determining whether there are recyclable files in the preset space to deleting folders in hours. After completing this batch deletion, the storage module can immediately execute the operation of determining whether there are recyclable files in the preset space again, and thus start the next batch deletion operation.
[0137] In the above embodiment, by deleting files in a preset space in batches according to a targeted deletion policy, compared to centralized deletion, peak performance consumption is reduced, maintaining high performance of the storage module, reducing the possibility of loss of stored files due to file deletion, and avoiding impact on the operation of other modules. Furthermore, the corresponding targeted deletion policy can be determined based on the current available capacity of the storage space and the current amount of data in the message queue, making file deletion more flexible and more adaptable to the current storage situation, ensuring that the storage module maintains high performance.
[0138] In some embodiments, the method may further include: detecting that the current storage capacity of the file storage space is greater than a preset capacity, and issuing a reminder that the storage is about to be full.
[0139] It should be noted that the deletion strategy adopted in this application can be a full overwrite strategy, that is, when the storage is full, the oldest generated file is deleted and the most recently generated file is stored. It can also be based on user operations to determine the deletion object. Then, when the storage module detects that the current storage capacity of the file storage space is greater than the preset capacity, it means that the storage is about to be full. In response to detecting that the current storage capacity of the file storage space is greater than the preset capacity, a reminder of the storage being full is issued. By sending the reminder to the business module for feedback to the user, the user can be reminded that the file needs to be deleted when the storage is about to be full, and the file can be deleted based on the user's confirmation, avoiding the situation where the file required by the user is accidentally deleted.
[0140] Specifically, issuing a reminder that the storage is about to be full includes reporting the reminder to the business module. The business module is used to feed back the reminder that the storage is about to be full to the user, so that the user can determine whether to initiate a deletion request through the business module, as well as the corresponding files to be deleted. Among them, the preset capacity can be set according to actual needs. For example, the preset capacity can be 90% of the total capacity. Specifically, the reporting of the reminder can be reported through protocols such as MQTT (Message Queuing Telemetry Transport). MQTT is a client-server based message publish / subscribe transmission protocol, which is suitable for the electronic devices in this application.
[0141] See also Figure 7 , Figure 7 It is a schematic diagram of the framework of an embodiment of a device for processing document data of the present application.
[0142] In this embodiment, the file data processing device 70 includes a receiving module 71, a searching module 72, a moving module 73 and a deleting module 74, wherein the receiving module 71 is used to receive a file data deletion request; the searching module 72 is used to find the file data to be deleted from the file storage space according to the deletion request, wherein the file data to be deleted includes at least one file; the moving module 73 is used to move the file data to be deleted to a preset space; and the deleting module 74 is used to delete the files in the preset space in batches according to the target deletion strategy.
[0143] The above solution deletes the files in the preset space in batches according to the target deletion strategy. Compared with centralized deletion, it reduces the peak performance consumption, keeps the storage module in a high-performance state, reduces the possibility of loss of stored files due to file deletion, and avoids affecting the work of other modules.
[0144] In which, the file data processing device 70 can also include an adjustment module for adjusting the storage path of the file data to be deleted after moving the file data to be deleted to the preset space, wherein the path depth of the adjusted storage path is smaller than the storage path before adjustment, and / or the adjusted storage path includes the time when the deletion request is received.
[0145] The above solution can improve the efficiency of traversal when deleting files by reducing the depth of the storage path, reduce performance consumption, and improve the efficiency of file deletion; at the same time, increasing the time of the deletion request as a path can prevent data races.
[0146] Among them, the deletion module 74 may include a determination submodule, a detection submodule and a deletion submodule, wherein the determination submodule is used to determine the target deletion strategy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue, wherein the message queue is used to cache the files to be stored in the storage space; the detection submodule is used to detect whether file deletion is currently being executed according to the target deletion strategy; the deletion submodule is used to select files in the preset space that meet the preset file requirements for deletion in response to the current execution of file deletion.
[0147] The above solution can determine the corresponding target deletion strategy based on the current available capacity of the storage space and the current amount of data in the message queue, making file deletion more flexible and more adaptable to the current storage situation, so that the storage module remains in a high-performance state.
[0148] Among them, the determination sub-module can be used to determine the target deletion policy based on at least one of the current available capacity of the storage space and the current amount of data in the message queue, specifically including: in response to the current available capacity meeting the first requirement, determining the target deletion policy as the first deletion policy; in response to the current available capacity not meeting the first requirement and the current amount of data meeting the second requirement, determining the target deletion policy as the second deletion policy; in response to the current available capacity not meeting the first requirement and the current amount of data not meeting the second requirement, determining the target deletion policy as the third deletion policy.
[0149] The above solution can determine different deletion strategies according to different storage situations by judging whether the current available capacity meets the first requirement and whether the current data quantity meets the second requirement, thereby achieving more flexible file deletion and better adaptability to the current storage situation.
[0150] Among them, the first deletion strategy is to execute file deletion at intervals of a first time period; and / or, the second deletion strategy is to detect whether the current amount of data in the message queue meets the third requirement every third time period within the second time period, and execute file deletion in response to the current amount of data meeting the third requirement, or in response to the current amount of data not being detected to meet the third requirement within the second time period, wherein the second time period is greater than the third time period; and / or, the third deletion strategy is to execute file deletion at intervals of a fourth time period.
[0151] In the above scheme, different deletion strategies have different intervals, which can control the time interval for executing file deletion based on the specific situation of the current available capacity and the current amount of data in the message queue, thereby making file deletion more flexible and more adaptable to the current storage situation.
[0152] Among them, the first requirement is that the current available capacity is less than or equal to the preset capacity threshold, the second requirement is that the current data quantity is greater than the first quantity threshold, and the third requirement is that the current data quantity is less than or equal to the second quantity threshold, among which the first quantity threshold is greater than or equal to the second quantity threshold.
[0153] In the above scheme, the first requirement indicates that the current available capacity is small, the second requirement indicates that the current number of files to be stored is large, and the third requirement indicates that the current number of files to be stored is decreasing. Therefore, it is determined that the first deletion strategy is adopted when the current available capacity is small, the second deletion strategy is adopted when the current number of files to be stored is large, and the third deletion strategy is adopted when the current available capacity is large and the current number of files to be stored is small.
[0154] The preset file requirement includes files whose generation time is within the target time period.
[0155] The above solution can determine the files deleted in a batch by the file generation time within the target time period.
[0156] The file data processing device 70 may further include a stopping module configured to stop storing the file to be stored in response to the current available capacity satisfying the first requirement.
[0157] The above solution can also stop the execution of storing the files to be stored when the current available capacity is small, so it can prevent data loss caused by small available capacity.
[0158] Among them, the file data processing device 70 can also include a storage module for receiving a storage request for a file to be stored and storing the file to be stored in the file storage space; in response to detecting that the current storage capacity of the file storage space is greater than the preset capacity, issuing a reminder that the storage is about to be full.
[0159] The above solution issues a reminder that the storage is almost full when the current storage capacity is greater than the preset capacity, which can prompt the need to delete files to prevent data loss due to low available capacity.
[0160] The storage module may be used to store the files to be stored in the file storage space, specifically including: caching the files to be stored in the message queue; and storing the files to be stored cached in the message queue in the file storage space according to a preset order.
[0161] The above solution can cache the files to be stored in the message queue through the setting of the message queue, which can prevent the memory occupation caused by slow message consumption.
[0162] The storage path of the file to be stored in the file storage space is composed of at least the root path of the file storage space, the identifier of the task associated with the file to be stored, the type of the algorithm associated with the file to be stored, and the generation time of the file to be stored.
[0163] The above solution can make files orderly and easy to find by using the task identifier, algorithm type, generation time, etc. to form a storage path.
[0164] The storage module may be configured to issue a reminder that the storage is about to be full, specifically including: reporting the reminder to the business module, wherein the business module is configured to feed back the reminder to the user so that the user can confirm whether to initiate a deletion request through the business module.
[0165] The above solution can remind users to delete files when the storage is full by sending reminders to the business module for feedback to the user. Files can also be deleted based on user confirmation, avoiding the situation where files needed by users are accidentally deleted.
[0166] See also Figure 8 , Figure 8It is a schematic diagram of the framework of an embodiment of the electronic device of the present application.
[0167] Electronic device 80 includes a memory 81 and a processor 82 coupled to each other. Processor 82 is configured to execute program instructions stored in memory 81 to implement the steps of any of the above-described file data processing method embodiments. In a specific implementation scenario, electronic device 80 may include, but is not limited to, a microcomputer and a server. Furthermore, electronic device 80 may also include mobile devices such as laptops and tablet computers, which are not limited herein.
[0168] Specifically, the processor 82 is used to control itself and the memory 81 to implement the steps of any of the above-described file data processing method embodiments. The processor 82 may also be referred to as a CPU (Central Processing Unit). The processor 82 may be an integrated circuit chip with signal processing capabilities. The processor 82 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor. In addition, the processor 82 may be implemented by an integrated circuit chip.
[0169] The above embodiment deletes the files in the preset space in batches according to the target deletion strategy. Compared with centralized deletion, this reduces the peak performance consumption, keeps the storage module in a high-performance state, reduces the possibility of loss of files to be stored due to file deletion, and avoids affecting the work of other modules.
[0170] See also Figure 9 , Figure 9 The computer-readable storage medium 90 stores program instructions 91 that can be executed by a processor, and the program instructions 91 are used to implement the steps of any of the above-mentioned file data processing method embodiments.
[0171] The computer-readable storage medium 90 may specifically be a medium that can store program data, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, or may be a server that stores the program data. The server may send the stored program data to other devices for execution, or may execute the stored program data itself.
[0172] In some embodiments, the computer readable storage medium 90 may also be Figure 8 Memory shown.
[0173] The above embodiment deletes the files in the preset space in batches according to the target deletion strategy. Compared with centralized deletion, this reduces the peak performance consumption, keeps the storage module in a high-performance state, reduces the possibility of loss of files to be stored due to file deletion, and avoids affecting the work of other modules.
[0174] In some embodiments, the functions or modules included in the device provided by the embodiments of the present disclosure can be used to execute the method described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0175] The above description of the various embodiments tends to emphasize the differences between the various embodiments. The same or similar aspects can be referenced with each other and will not be repeated herein for the sake of brevity.
[0176] In the several embodiments provided in this application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation methods described above are only schematic. For example, the division of modules or units is only a logical function division. There may be other division methods in actual implementation. For example, units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0177] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.
[0178] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the existing technology, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the various implementation methods of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, and other media that can store program code.
Claims
1. A method for processing file data, characterized in that: include: receiving a request for file data deletion; According to the deletion request, searching for file data to be deleted from the file storage space, wherein the file data to be deleted includes at least one file; Moving the file data to be deleted to a preset space; determining a target deletion policy based on at least one of a current available capacity of the file storage space and a current amount of data in a message queue, wherein the message queue is used to cache files to be stored in the file storage space; Check whether file deletion is currently being executed according to the target deletion policy; In response to currently executing file deletion, the files in the preset space that meet preset file requirements are selected for deletion.
2. The method according to claim 1, characterized in that After moving the to-be-deleted file data to the preset space, the method further includes: The storage path of the to-be-deleted file data is adjusted, wherein the path depth of the adjusted storage path is smaller than the storage path before the adjustment, and / or the adjusted storage path includes the time when the deletion request is received.
3. The method according to claim 1, characterized in that In response to the currently executing file deletion, after selecting the files in the preset space that meet the preset file requirements for deletion, it also includes: repeating the above-mentioned determination of the target deletion strategy and its subsequent steps based on at least one of the current available capacity of the file storage space and the current amount of data in the message queue, until all files in the preset space are deleted.
4. The method according to claim 3, characterized in that The determining of a target deletion strategy based on at least one of a current available capacity of the file storage space and a current amount of data in the message queue includes: In response to the current available capacity meeting the first requirement, determining the target deletion policy to be a first deletion policy; In response to the current available capacity not meeting the first requirement and the current data quantity meeting the second requirement, determining the target deletion policy to be the second deletion policy; In response to the current available capacity not meeting the first requirement and the current data quantity not meeting the second requirement, the target deletion policy is determined to be a third deletion policy.
5. The method according to claim 4, characterized in that The first deletion strategy is to execute file deletion at intervals of a first time period; And / or, the second deletion strategy is to detect whether the current amount of data in the message queue meets a third requirement at intervals of a third time period within the second time period, and execute the file deletion in response to the current amount of data meeting the third requirement or failing to detect that the current amount of data meets the third requirement within the second time period, wherein the second time period is greater than the third time period; And / or, the third deletion strategy is to execute file deletion at intervals of a fourth time period.
6. The method according to claim 5, characterized in that The first requirement is that the current available capacity is less than or equal to a preset capacity threshold, the second requirement is that the current data quantity is greater than a first quantity threshold, and the third requirement is that the current data quantity is less than or equal to a second quantity threshold, wherein the first quantity threshold is greater than or equal to the second quantity threshold.
7. The method according to any one of claims 3 to 6, characterized in that The preset file requirement includes the file whose generation time is within the target time period; And / or, the method further comprises: In response to the current available capacity satisfying the first requirement, storage of the file to be stored is stopped.
8. The method according to claim 1, characterized in that The method further comprises at least one of the following steps: Receiving a storage request for a file to be stored, storing the file to be stored in the file storage space; In response to detecting that the current storage capacity of the file storage space is greater than a preset capacity, a reminder that the storage is almost full is issued.
9. The method according to claim 8, characterized in that The storing the file to be stored in the file storage space includes: Cache the file to be stored in a message queue; The files to be stored in the message queue cache are stored in the file storage space according to a preset order.
10. The method according to claim 9, characterized in that The storage path of the file to be stored in the file storage space is composed of at least the root path of the file storage space, the identifier of the task associated with the file to be stored, the type of the algorithm associated with the file to be stored, and the generation time of the file to be stored.
11. The method according to claim 8, characterized in that The issuing of a reminder that the storage is almost full includes: The reminder is reported to a business module, wherein the business module is used to feed back the reminder to the user, so that the user can confirm whether to initiate the deletion request through the business module.
12. A file data processing device, characterized in that: include: A receiving module, configured to receive a file data deletion request; a search module, configured to search for file data to be deleted from a file storage space according to the deletion request, wherein the file data to be deleted includes at least one file; A moving module, used for moving the file data to be deleted to a preset space; The deletion module includes a determination submodule, a detection submodule and a deletion submodule. The determination submodule is used to determine the target deletion strategy based on at least one of the current available capacity of the file storage space and the current amount of data in the message queue, wherein the message queue is used to cache the files to be stored in the file storage space; the detection submodule is used to detect whether file deletion is currently being executed according to the target deletion strategy; and the deletion submodule is used to select the files in the preset space that meet the preset file requirements for deletion in response to the current execution of file deletion.
13. An electronic device, characterized in that: The invention comprises a memory and a processor coupled to each other, wherein the processor is used to execute program instructions stored in the memory to implement the file data processing method according to any one of claims 1 to 11.
14. A computer-readable storage medium having program instructions stored thereon, characterized in that: When the program instructions are executed by a processor, the file data processing method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
File management method, device and terminal equipment
CN106802957A
File storage optimization method and device
CN110275865A
Message processing method and device, computer equipment and storage medium
CN111538600A
Data deletion method and device, equipment and storage medium
CN114356856A