File deletion method and device, electronic equipment and readable storage medium

By calculating the value of file grouping and assigning it to multiple subtasks for parallel deletion, the problem of high pressure on file deletion interfaces is solved, and the response speed and user experience of deletion interfaces are improved.

CN119669164APending Publication Date: 2025-03-21CHINA MOBILE (SUZHOU) SOFTWARE TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411733887.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-21

AI Technical Summary

Technical Problem

In the prior art, the high pressure of the file deletion interface leads to a problem of low response speed.

Method used

By calculating the file grouping value of each file, N files are assigned to multiple subtasks, and files are deleted in parallel among multiple subtasks, reducing interface pressure.

Benefits of technology

It improves the response speed of deleting interfaces, avoids the problem of excessive interface pressure caused by deleting all files at once, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119669164A_ABST
    Figure CN119669164A_ABST
Patent Text Reader

Abstract

The invention provides a file deletion method and device, electronic equipment and a readable storage medium, and relates to the technical field of data processing.The method comprises the steps that file information of each file in N files corresponding to a deletion task is obtained, and N is a positive integer larger than 1; calculating a file grouping value of each file based on the file information, wherein the file grouping value is used for representing a resource consumption degree of the deleted file; distributing the N files to a plurality of sub-tasks based on the file grouping value of each file, wherein the plurality of sub-tasks are sub-tasks included in the deletion task; and deleting the files included in the plurality of subtasks. The method can reduce the pressure of deleting the interface, and further improves the response speed of deleting the interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and in particular to a file deletion method, device, electronic device and readable storage medium. Background Art

[0002] With the continuous deepening of informatization, the data storage needs of enterprises and users are increasing. In order to meet the storage needs of massive data, data is usually stored in the cloud. Due to the limited file capacity stored in the cloud, data management is achieved by file deletion in related technologies. However, in related technologies, the files to be deleted are usually transferred to the deletion interface at one time to delete the files, and transferring them to the deletion interface at one time will cause a lot of pressure on the deletion interface, making the response speed of the deletion interface low.

[0003] It can be seen that in the related art, there is a problem that the pressure of the deletion interface is high, resulting in a low response speed of the deletion interface. Summary of the invention

[0004] The embodiments of the present application provide a file deletion method, device, electronic device and readable storage medium to solve the problem in the related art that the deletion interface has high pressure, resulting in a low response speed of the deletion interface.

[0005] To solve the above problems, this application is implemented as follows:

[0006] In a first aspect, an embodiment of the present application provides a file deletion method, comprising:

[0007] Get the file information of each file in the N files corresponding to the deletion task, where N is a positive integer greater than 1;

[0008] Calculating the file grouping value of each file based on the file information, wherein the file grouping value is used to represent the resource consumption degree of deleting the file;

[0009] Allocating the N files to a plurality of subtasks based on the file grouping value of each file, the plurality of subtasks being subtasks included in the deletion task;

[0010] The files included in the plurality of subtasks are deleted.

[0011] In a second aspect, an embodiment of the present application further provides a file deletion device, comprising:

[0012] An acquisition module is used to acquire file information of each file in N files corresponding to the deletion task, where N is a positive integer greater than 1;

[0013] A calculation module, used for calculating the file group value of each file based on the file information, wherein the file group value is used to represent the resource consumption degree of deleting the file;

[0014] an allocating module, configured to allocate the N files to a plurality of subtasks based on the file grouping value of each file, wherein the plurality of subtasks are subtasks included in the deletion task;

[0015] The deleting module is used to delete the files included in the multiple subtasks.

[0016] In a third aspect, an embodiment of the present application further provides an electronic device, including a transceiver and a processor.

[0017] The transceiver is used to obtain file information of each file in N files corresponding to the deletion task, where N is a positive integer greater than 1;

[0018] The processor is used to calculate the file grouping value of each file based on the file information, wherein the file grouping value is used to represent the resource consumption degree of deleting the file;

[0019] The processor is further configured to allocate the N files to a plurality of subtasks based on the file grouping value of each file, wherein the plurality of subtasks are subtasks included in the deletion task;

[0020] The processor is further configured to delete files included in the multiple subtasks.

[0021] In a fourth aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a memory, and a program stored in the memory and executable on the processor, wherein when the program is executed by the processor, the steps of the file deletion method described in the first aspect above are implemented.

[0022] In a fifth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the file deletion method described in the first aspect above are implemented.

[0023] In a sixth aspect, an embodiment of the present application further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the file deletion method as described in the first aspect above.

[0024] In an embodiment of the present application, the file information of each file in the N files corresponding to the deletion task is obtained, where N is a positive integer greater than 1; the file grouping value of each file is calculated based on the file information, and the file grouping value is used to characterize the resource consumption degree of deleting files; the N files are allocated to multiple subtasks based on the file grouping value of each file, and the multiple subtasks are the subtasks included in the deletion task; and the files included in the multiple subtasks are deleted. In this way, by calculating the file grouping value of each file, and then allocating N files to multiple subtasks based on the file grouping value of each file, the time required to delete the files included in each subtask in the multiple subtasks after the files are allocated can be close, and then the files included in the multiple subtasks can be deleted, avoiding excessive pressure on the interface caused by deleting all files at one time, thereby improving the response speed of the deletion interface. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0026] Figure 1 It is a schematic diagram of file deletion in the related art;

[0027] Figure 2 is a flowchart of a file deletion method provided by an embodiment of the present application;

[0028] Figure 3 This is one of the schematic diagrams of file deletion provided in the embodiment of the present application;

[0029] Figure 4 This is the second schematic diagram of file deletion provided in the embodiment of the present application;

[0030] Figure 5 This is the third schematic diagram of file deletion provided in the embodiment of the present application;

[0031] Figure 6 is a structural diagram of a file deletion device provided in an embodiment of the present application;

[0032] Figure 7 It is a structural diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0033] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0034] With the continuous deepening of informatization, the data storage needs of enterprises and users are increasing. In order to meet the storage needs of massive data, data is usually stored in the cloud. Due to the limited file capacity stored in the cloud, related technologies implement data management by deleting files. Related technologies such as Figure 1 As shown in the figure, after the user selects the file to be deleted, the system will transfer all the data to the server at once. At this time, the interface is under too much pressure, and it takes a long time for the server to complete the deletion task before responding to other user operations. At this time, the page corresponding to the user is in an unresponsive state; after a long wait for the deletion task to be completed, the page corresponding to the user responds. During the deletion process, the deletion time is long, and the user cannot perceive whether the file is being deleted. There may be a misjudgment of canceling the task, resulting in abnormal deletion of the file.

[0035] To reduce the pressure on the interface, this application provides a file deletion method, see Figure 2 , Figure 2 is a flowchart of a file deletion method provided by an embodiment of the present application, such as Figure 2 As shown, the following steps are included:

[0036] Step 201: Obtain file information of each file in N files corresponding to the deletion task, where N is a positive integer greater than 1.

[0037] The N files corresponding to the above deletion task can be set in the to-be-deleted file list (delFileList). n (n=1, 2, 3, ....., N) represents the nth file among N files. The above file information includes various parameters that affect the deletion of files. In some implementations, the file information includes at least one of the file size, the number of files, and the file complexity. The file complexity can be calculated by the file type and the file level.

[0038] Optionally, the file complexity is obtained by weighted calculation of the file type and the file level.

[0039] Optionally, the file complexity is calculated using the following formula:

[0040]

[0041] fileComplex in the formula n is the file complexity of the nth file among N files, N files are the files corresponding to the deletion task, fileType n The file type of the nth file, fileLevel n The file level for the nth file.

[0042] The default value of the file level is usually 1.

[0043] Step 202: Calculate the file grouping value of each file based on the file information, where the file grouping value is used to represent the resource consumption degree of deleting the file.

[0044] In some implementations, the file information includes at least one of file size, file quantity, and file complexity, and at least two of the file size, file quantity, and file complexity may be weighted to obtain the file grouping value.

[0045] In some implementations, the file information includes file size, file quantity, and file complexity, and the file grouping value is calculated using the following formula:

[0046]

[0047]

[0048] CS in the formula n Indicates the file grouping value of the nth file, α is the weight value, α<1, fileSize n The file size of the nth file, fileCount n is the number of files in the nth file, fileComplex n is the file complexity of the nth file.

[0049] In some implementations, in addition to the above formula, weight coefficients may be pre-configured for file size, file quantity, and file complexity, and at least two of the file size, file quantity, and file complexity may be weighted based on the weight coefficients to obtain the file grouping value.

[0050] For example, file information includes file size fileSize n and the number of files fileCount n , the weight coefficient of file size is p1, the weight coefficient of file number is p2, and the file grouping value is fileSize n *p1+fileCount n *p2.

[0051] The file grouping value of each file is calculated by the above formula. The file grouping value of N files can be expressed by the following formula:

[0052] CS=[CS n ],n=1,2,3,......,N

[0053] CS is the file grouping value of the file. n The file group value for the nth file.

[0054] Step 203: Allocate the N files to a plurality of subtasks based on the file grouping value of each file, where the plurality of subtasks are subtasks included in the deletion task.

[0055] It should be noted that the higher the file grouping value, the longer it takes to delete the file. The file grouping value of each file is calculated to evaluate the time to delete each file, and then N files are allocated to multiple subtasks based on the file grouping value of each file. This can make the time required to delete the files included in each subtask in the multiple subtasks after the files are allocated close.

[0056] In some implementations, the N files are assigned to a plurality of subtasks based on the file grouping value of each file, and the N files may be sorted based on the file grouping value, and then the files are sequentially added to different subtasks in sequence. For example, the plurality of subtasks include a first subtask, a second subtask, and a third subtask, and the files are sequentially added to the first subtask, the second subtask, and the third subtask in sequence, and the cycle is repeated until all files are added.

[0057] Step 204: Delete the files included in the multiple subtasks.

[0058] In some implementations, deleting files included in multiple subtasks may include sorting the multiple subtasks and sequentially deleting the files included in the multiple subtasks.

[0059] In some implementations, deleting files included in multiple subtasks may be deleting the files included in the multiple subtasks in parallel.

[0060] The process of the embodiment of this application is as follows Figure 3 As shown, when the user selects a file to be deleted and deletes it, N files to be deleted are divided into multiple subtasks, and then the files included in the multiple subtasks are deleted one by one or concurrently. At this time, there is no need to pass the files to be deleted to the server at one time, which reduces the pressure on the interface and improves the response speed of the deletion interface. At this time, the user's corresponding page does not need to wait for a long time to respond, which improves the user experience.

[0061] In an embodiment of the present application, the file information of each file in the N files corresponding to the deletion task is obtained, where N is a positive integer greater than 1; the file grouping value of each file is calculated based on the file information, and the file grouping value is used to characterize the resource consumption degree of deleting files; the N files are allocated to multiple subtasks based on the file grouping value of each file, and the multiple subtasks are the subtasks included in the deletion task; and the files included in the multiple subtasks are deleted. In this way, by calculating the file grouping value of each file, and then allocating N files to multiple subtasks based on the file grouping value of each file, the time required to delete the files included in each subtask in the multiple subtasks after the files are allocated can be close, and then the files included in the multiple subtasks can be deleted, avoiding excessive pressure on the interface caused by deleting all files at one time, thereby improving the response speed of the deletion interface.

[0062] In one embodiment, allocating the N files to a plurality of subtasks based on the file grouping value of each file includes:

[0063] sorting the N files based on the file grouping value of each file;

[0064] Calculating a target grouping value, where the target grouping value is a quotient of a sum of the file grouping values ​​of the N files and a number of the plurality of subtasks;

[0065] The sorted N files are sequentially allocated to the plurality of subtasks based on the target grouping value and the file grouping value.

[0066] In the embodiment of the present application, N files are sorted based on the file grouping value of each file; the target grouping value is calculated, and the target grouping value is the quotient of the sum of the file grouping values ​​of the N files and the number of multiple subtasks; the sorted N files are sequentially assigned to multiple subtasks based on the target grouping value and the file grouping value. In this way, the sorted N files are sequentially assigned to multiple subtasks based on the target grouping value and the file grouping value, so that the sum of the file grouping values ​​corresponding to the files included in each subtask can be close to the target grouping value, thereby achieving an effective balance in the time of deleting files included in different subtasks.

[0067] The target group value can be calculated by the following formula:

[0068]

[0069] The formula is CS target is the target grouping value, CS n is the file grouping value of the nth file, and subTaskCount is the number of tasks of multiple subtasks.

[0070] In some implementations, a target grouping value may be preset, and the number of subtasks may be determined based on the target grouping value and the sum of the file grouping values ​​of N files. This ensures that the target grouping value of each subtask will not be too large, thus avoiding the situation where the deletion interface is overloaded when executing a single subtask.

[0071] For example, the sum of the file grouping values ​​of N files is The target group value is CS target , the number of subtasks is Round up.

[0072] In one embodiment, the step of sequentially allocating the sorted N files to the plurality of subtasks based on the target grouping value and the file grouping value includes:

[0073] Calculate the expected value of the first subtask, where the expected value of the first subtask is the sum of the file group value of the to-be-allocated file and the current value of the first subtask, and the current value of the first subtask is the sum of the file group values ​​of all the files that have been allocated in the first subtask, the to-be-allocated file is a file that has not been allocated according to the sorting among the N files after sorting, the first subtask is a subtask among the multiple subtasks, and the first subtask includes the previous file of the to-be-allocated file;

[0074] When the expected value of the first subtask is less than or equal to the target group value, allocating the to-be-allocated file to the first subtask;

[0075] In the case that the expected value of the first subtask is greater than the target group value, the to-be-allocated file is allocated to a second subtask, where the second subtask is another subtask among the multiple subtasks to which no file is allocated.

[0076] In the embodiment of the present application, the expected value of the first subtask is calculated, and the expected value of the first subtask is the sum of the file grouping value of the file to be allocated and the current value of the first subtask. The current value of the first subtask is the sum of the file grouping values ​​of all files that have been allocated in the first subtask. The file to be allocated is the file that has not been allocated according to the sorting among the N files after sorting. The first subtask is a subtask among multiple subtasks, and the first subtask includes the previous file of the file to be allocated. When the expected value of the first subtask is less than or equal to the target grouping value, the file to be allocated is allocated to the first subtask. When the expected value of the first subtask is greater than the target grouping value, the file to be allocated is allocated to the second subtask, and the second subtask is the other subtask of the multiple subtasks to which the file is not allocated. In this way, whether to allocate the file to be allocated to the subtask is determined by the expected value, so that the file grouping value of all files included in each subtask does not exceed the target grouping value.

[0077] For example, the deletion task includes 5 subtasks, and subTask is defined j For the j The sum of the file grouping values ​​CS of all files included in (j=1,2,...,5) subtasks, taskIndex is the index value of the current subtask, and the index values ​​of different subtasks are different, arranged in a similar order of 0,1,...,K-1, K is the number of subtasks. Traverse the sorted file list and add each file to the CS closest to the current CS. target If the expected value of the current subtask (i.e. the current CS value plus the CS value of the file) exceeds the CS target ), it switches to the next subtask.

[0078] Specifically, Figure 4 As shown, the file grouping value of all files is calculated and all files are sorted according to the file grouping value. After sorting, the sorted file list is traversed and each file is added to the subtask, where

[0079] The group value of the current subtask subTask j , plus the expected value of the current file's CS is less than or equal to the target group value, which is expressed by the following formula:

[0080] subTask j +CS n <=CS target ,n=1,2,....,N,j=1,2,...,5

[0081] When the above formula is satisfied, the files to be assigned are assigned to the current subtask. At this time, the sum of the file grouping values ​​of all files included in the current subtask is updated by the following formula:

[0082] subTask j =subTask j +CS n ,n=1,2,....,N,j=1,2,...,5

[0083] In the above formula, “=” is an assignment.

[0084] Furthermore, when the expected value is greater than the target group value, the index value corresponding to the assigned subtask is determined according to the following formula:

[0085] taskIndex=(taskIndex+1)%subTaskCount

[0086] In the above formula, “=” is an assignment.

[0087] In some implementations, the initial value of the index value may be set to 0. When the expected value is greater than the target group value, a number is selected from a preset number set to update the index value, and then a subtask with an index value of 0 is obtained as a subtask for adding a file. The preset number set includes integers arranged in sequence. When the expected value is greater than the target group value, numbers are obtained from the preset number set in sequence, and then the numbers are summed with the initial value to obtain an updated index value.

[0088] For example, the preset numbering set includes numbers 1 to k. When the expected value of the first subtask is greater than the target grouping value, number 1 is obtained in sequence, and the updated number of the first subtask is 1+0=1; when the expected value of the second subtask is greater than the target grouping value, number 2 is obtained in sequence, and the updated number of the second subtask is 1+0=2, and so on, until the corresponding numbers of all subtasks are not 0, and the file allocation of each subtask is completed.

[0089] The above formula is used to determine the next subtask to assign the file. At this time, the sum of the file grouping values ​​of all the files included in the next subtask is:

[0090] subTask j =CS n ,n=1,2,....,N,j=1,2,...,5

[0091] All files are allocated by the formula until the calculated index value is greater than the maximum index value of the subtask, at which point all files are considered to have been allocated.

[0092] In some implementations, when there are no other subtasks among the multiple subtasks to which files are not assigned, the expected values ​​of the other subtasks except the first subtask can be calculated, and the files can be assigned to other subtasks whose expected values ​​do not exceed the target grouping value.

[0093] In one embodiment, the step of sequentially allocating the sorted N files to the plurality of subtasks based on the target grouping value and the file grouping value includes:

[0094] When the expected value of each subtask in the multiple subtasks is greater than the target group value, the file to be allocated is allocated to the third subtask, and the third subtask is the subtask with the smallest expected value among the multiple subtasks. The expected value of each subtask is the sum of the file to be allocated and the current value, and the current value is the sum of the file group values ​​of all files that have been allocated in each subtask.

[0095] It should be noted that there are situations in which files cannot be distributed evenly during the allocation process. In this case, allocating files to any subtask will cause the expected value of the subtask to exceed the target grouping value. In order to balance the grouping values ​​between different subtasks as much as possible, in this case the files are allocated to the subtask with the smallest expected value, so that the time consumed in deleting the files included in the subtask is close.

[0096] In one embodiment, before deleting the files included in the plurality of subtasks, the method includes:

[0097] Constructing a commitment parameter corresponding to each of the multiple subtasks, wherein the commitment parameter is used to characterize the execution status of each subtask;

[0098] After deleting the files included in the plurality of subtasks, the method comprises:

[0099] Update the commitment parameter corresponding to each subtask based on the deletion result, where the deletion result is deletion success or deletion failure;

[0100] The commitment parameters corresponding to each subtask are sent to the client.

[0101] In the embodiment of the present application, a commitment parameter corresponding to each of the multiple subtasks is constructed, and the commitment parameter is used to characterize the execution status of each subtask. The commitment parameter corresponding to each subtask is updated based on the deletion result, and the deletion result is a successful deletion or a failed deletion; the commitment parameter corresponding to each subtask is sent to the client. In this way, the execution status of the subtask is recorded through the commitment parameter, and the commitment parameter is updated according to the execution result, so that the client can parse the commitment parameter to determine the current execution result, and thus can display the progress of the deletion.

[0102] Specifically, Figure 5 As shown, the asynchronous method is used to encapsulate the subtasks and create a promise array. At this time, the files included in the subtasks are passed to the server and the server's response is waited for. The following formula represents the created promise array:

[0103] tasks = [task k ],k=1,2,...,subTaskCount

[0104] tasks is a promise array, and taskk is the kth subtask.

[0105] Call Promise.allSettled: Use the Promise.allSettled method and pass the Promise array as a parameter, which is represented by the following formula:

[0106] Promise.allSettled(task k ),k=1,2,....,subTaskCount

[0107] Wait for all subtasks corresponding to Promise parameters to be completed. The Promise returned by Promise.allSettled will wait for all subtasks corresponding to Promise parameters in the array to be completed (whether resolved or rejected). Once all subtasks corresponding to Promise parameters in the array are completed, the Promise parameter returned by Promise.allSettled will be resolved into a new array. Each element in this new array is an object that describes the status (status) and result (value or reason) of the original Promise parameter. Among them, if the Promise parameter is resolved successfully, the corresponding subtask is completed at this time, the status is fulfilled, and the result is stored in the value property; if the resolution of the Promise parameter is rejected, the corresponding subtask is not completed at this time, the status is rejected, and the reason for the rejection is stored in the reason property.

[0108] In some implementations, taskRejected is defined as a subtask that failed to execute, the failed subtask is stored in the variable, and the subtask is re-executed. If the retry still fails, a specific prompt is given on the page to indicate that the subtask failed to execute.

[0109] In one embodiment, deleting the files included in the multiple subtasks includes:

[0110] Deleting a target subtask of the plurality of subtasks, wherein the target subtask is one of the plurality of subtasks;

[0111] When the deletion of the first subtask of the plurality of subtasks exceeds a set progress threshold, the next subtask of the target subtask in the plurality of subtasks is deleted.

[0112] In an embodiment of the present application, when the deletion of the first subtask of multiple subtasks exceeds the set progress threshold, the next subtask of the target subtask in the multiple subtasks is deleted, thereby achieving the effect of concurrent processing, while reducing resource consumption and reducing the pressure on the deletion interface.

[0113] Specifically, the execution of a subtask is triggered first, and when the subtask execution progress exceeds the threshold, the next subtask is executed. This method ensures that the subtask corresponding to the Promise parameter will not wait for the subtask corresponding to the previous Promise parameter to complete before starting the next one, achieving the effect of concurrency. At the same time, it also alleviates the problem of resource consumption.

[0114] See also Figure 6 , Figure 6 is a structural diagram of a file deletion device provided in an embodiment of the present application, such as Figure 6 As shown, the file deletion device 600 includes:

[0115] An acquisition module 601 is used to acquire file information of each file in N files corresponding to the deletion task, where N is a positive integer greater than 1;

[0116] A calculation module 602, configured to calculate a file grouping value of each file based on the file information, wherein the file grouping value is used to represent a resource consumption degree of deleting a file;

[0117] An allocating module 603, configured to allocate the N files to a plurality of subtasks based on the file grouping value of each file, wherein the plurality of subtasks are subtasks included in the deletion task;

[0118] The deleting module 604 is used to delete the files included in the multiple subtasks.

[0119] In one embodiment, the allocation module 603 includes:

[0120] A sorting unit, used for sorting the N files based on the file grouping value of each file;

[0121] A calculation unit, configured to calculate a target grouping value, wherein the target grouping value is a quotient of a sum of the file grouping values ​​of the N files and a number of the plurality of subtasks;

[0122] An allocating unit is used to allocate the sorted N files to the multiple subtasks in sequence based on the target grouping value and the file grouping value.

[0123] In one embodiment, the allocation unit comprises:

[0124] a calculation subunit, configured to calculate an expected value of a first subtask, wherein the expected value of the first subtask is the sum of the file grouping value of the to-be-allocated file and the current value of the first subtask, and the current value of the first subtask is the sum of the file grouping values ​​of all files that have been allocated in the first subtask, the to-be-allocated file is a file that has not been allocated according to the sorting among the N files after sorting, the first subtask is a subtask among the multiple subtasks, and the first subtask includes a previous file of the to-be-allocated file;

[0125] A first allocating subunit, configured to allocate the to-be-allocated file to the first subtask if the expected value of the first subtask is less than or equal to the target group value;

[0126] The second allocating subunit is used to allocate the to-be-allocated file to a second subtask when the expected value of the first subtask is greater than the target group value, where the second subtask is another subtask among the multiple subtasks to which no file is allocated.

[0127] In one embodiment, the allocation unit comprises:

[0128] The third allocation subunit is used to allocate the to-be-allocated files to the third subtask when the expected value of each subtask in the multiple subtasks is greater than the target group value. The third subtask is the subtask with the smallest expected value among the multiple subtasks. The expected value of each subtask is the sum of the to-be-allocated files and the current value. The current value is the sum of the file group values ​​of all the files that have been allocated in each subtask.

[0129] In one embodiment, before the deleting module 604, the file deleting device 600 includes:

[0130] A construction module, used to construct a commitment parameter corresponding to each of the multiple subtasks, wherein the commitment parameter is used to characterize the execution status of each subtask;

[0131] After the deletion module 604, the file deletion device 600 includes:

[0132] An updating module, used for updating the commitment parameters corresponding to each subtask based on a deletion result, wherein the deletion result is a deletion success or a deletion failure;

[0133] The sending module is used to send the commitment parameters corresponding to each subtask to the client.

[0134] In one embodiment, the deletion module 604 includes:

[0135] A first deleting unit, configured to delete a target subtask of the plurality of subtasks, wherein the target subtask is one of the plurality of subtasks;

[0136] The second deleting unit is configured to delete the next subtask of the target subtask among the multiple subtasks when the deletion of the first subtask among the multiple subtasks exceeds a set progress threshold.

[0137] The file deletion device provided in the embodiment of the present application is capable of implementing each process of each embodiment of the above-mentioned file deletion method, and the technical features correspond one to one and can achieve the same technical effect. To avoid repetition, they will not be described here.

[0138] It should be noted that the file deletion device in the embodiment of the present application can be a device, or a component, integrated circuit, or chip in an electronic device.

[0139] For details, see Figure 7 An embodiment of the present application further provides an electronic device, including a bus 701, a transceiver 702, an antenna 703, a bus interface 704, a processor 705 and a memory 706.

[0140] The transceiver 702 is used to obtain the file information of each file in the N files corresponding to the deletion task, where N is a positive integer greater than 1;

[0141] The processor 705 is used to calculate the file grouping value of each file based on the file information, where the file grouping value is used to represent the resource consumption degree of deleting the file;

[0142] The processor 705 is further configured to allocate the N files to a plurality of subtasks based on the file grouping value of each file, where the plurality of subtasks are subtasks included in the deletion task;

[0143] The processor 705 is further configured to delete files included in the multiple subtasks.

[0144] In one embodiment, allocating the N files to a plurality of subtasks based on the file grouping value of each file includes:

[0145] sorting the N files based on the file grouping value of each file;

[0146] Calculating a target grouping value, where the target grouping value is a quotient of a sum of the file grouping values ​​of the N files and a number of the plurality of subtasks;

[0147] The sorted N files are sequentially allocated to the plurality of subtasks based on the target grouping value and the file grouping value.

[0148] In one embodiment, the step of sequentially allocating the sorted N files to the plurality of subtasks based on the target grouping value and the file grouping value includes:

[0149] Calculate the expected value of the first subtask, where the expected value of the first subtask is the sum of the file group value of the to-be-allocated file and the current value of the first subtask, and the current value of the first subtask is the sum of the file group values ​​of all the files that have been allocated in the first subtask, the to-be-allocated file is a file that has not been allocated according to the sorting among the N files after sorting, the first subtask is a subtask among the multiple subtasks, and the first subtask includes the previous file of the to-be-allocated file;

[0150] When the expected value of the first subtask is less than or equal to the target group value, allocating the to-be-allocated file to the first subtask;

[0151] In the case that the expected value of the first subtask is greater than the target group value, the to-be-allocated file is allocated to a second subtask, where the second subtask is another subtask among the multiple subtasks to which no file is allocated.

[0152] In one embodiment, the step of sequentially allocating the sorted N files to the plurality of subtasks based on the target grouping value and the file grouping value includes:

[0153] When the expected value of each subtask in the multiple subtasks is greater than the target group value, the file to be allocated is allocated to the third subtask, and the third subtask is the subtask with the smallest expected value among the multiple subtasks. The expected value of each subtask is the sum of the file to be allocated and the current value, and the current value is the sum of the file group values ​​of all files that have been allocated in each subtask.

[0154] In one embodiment, the processor 705 is further configured to construct a commitment parameter corresponding to each of the plurality of subtasks, wherein the commitment parameter is used to characterize an execution state of each subtask;

[0155] The processor 705 is further configured to update the commitment parameter corresponding to each subtask based on a deletion result, wherein the deletion result is a deletion success or a deletion failure;

[0156] The commitment parameters corresponding to each subtask are sent to the client.

[0157] In one embodiment, deleting the files included in the multiple subtasks includes:

[0158] Deleting a target subtask of the plurality of subtasks, wherein the target subtask is one of the plurality of subtasks;

[0159] When the deletion of the first subtask of the plurality of subtasks exceeds a set progress threshold, the next subtask of the target subtask in the plurality of subtasks is deleted.

[0160] exist Figure 7 In the embodiment, the bus architecture (represented by bus 701) may include any number of interconnected buses and bridges, and bus 701 links various circuits including one or more processors represented by processor 705 and memory represented by memory 706. Bus 701 may also link various other circuits such as peripherals, voltage regulators, and power management circuits, which are well known in the art and are therefore not further described herein. Bus interface 704 provides an interface between bus 701 and transceiver 702. Transceiver 702 may be one element or multiple elements, such as multiple receivers and transmitters, providing a unit for communicating with various other devices on a transmission medium. Data processed by processor 705 is transmitted on a wireless medium via antenna 703, and further, antenna 703 also receives data and transmits the data to processor 705.

[0161] The processor 705 is responsible for managing the bus 701 and general processing, and can also provide various functions, including timing, peripheral interfaces, voltage regulation, power management and other control functions. The memory 706 can be used to store data used by the processor 705 when performing operations.

[0162] Optionally, the processor 705 may be a central processing unit (CPU), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or a complex programmable logic device (CPLD).

[0163] An embodiment of the present application also provides an electronic device, including: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the various processes of the above-mentioned file deletion method embodiment are implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0164] The embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, each process of the embodiment of the above-mentioned file deletion method is implemented, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0165] The embodiment of the present application also provides a computer program product, including computer instructions. When the computer instructions are executed by a processor, the various processes of the embodiment of the above-mentioned file deletion method are implemented, and the same technical effect can be achieved. To avoid repetition, they are not repeated here.

[0166] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0167] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.

[0168] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.

Claims

1. A file deletion method, characterized in that: include: Get the file information of each file in the N files corresponding to the deletion task, where N is a positive integer greater than 1; Calculating the file grouping value of each file based on the file information, wherein the file grouping value is used to represent the resource consumption degree of deleting the file; Allocating the N files to a plurality of subtasks based on the file grouping value of each file, the plurality of subtasks being subtasks included in the deletion task; The files included in the plurality of subtasks are deleted.

2. The method according to claim 1, characterized in that The allocating the N files to a plurality of subtasks based on the file grouping value of each file comprises: sorting the N files based on the file grouping value of each file; Calculating a target grouping value, where the target grouping value is a quotient of a sum of the file grouping values ​​of the N files and a number of the plurality of subtasks; The sorted N files are sequentially allocated to the plurality of subtasks based on the target grouping value and the file grouping value.

3. The method according to claim 2, characterized in that The step of sequentially allocating the sorted N files to the plurality of subtasks based on the target grouping value and the file grouping value includes: Calculate the expected value of the first subtask, where the expected value of the first subtask is the sum of the file group value of the to-be-allocated file and the current value of the first subtask, and the current value of the first subtask is the sum of the file group values ​​of all the files that have been allocated in the first subtask, the to-be-allocated file is a file that has not been allocated according to the sorting among the N files after sorting, the first subtask is a subtask among the multiple subtasks, and the first subtask includes the previous file of the to-be-allocated file; When the expected value of the first subtask is less than or equal to the target group value, allocating the to-be-allocated file to the first subtask; In the case that the expected value of the first subtask is greater than the target group value, the to-be-allocated file is allocated to a second subtask, where the second subtask is another subtask among the multiple subtasks to which no file is allocated.

4. The method according to claim 3, characterized in that The step of sequentially allocating the sorted N files to the plurality of subtasks based on the target grouping value and the file grouping value includes: When the expected value of each subtask in the multiple subtasks is greater than the target group value, the file to be allocated is allocated to the third subtask, and the third subtask is the subtask with the smallest expected value among the multiple subtasks. The expected value of each subtask is the sum of the file to be allocated and the current value, and the current value is the sum of the file group values ​​of all files that have been allocated in each subtask.

5. The method according to claim 1, characterized in that Before deleting the files included in the plurality of subtasks, the method includes: Constructing a commitment parameter corresponding to each of the multiple subtasks, wherein the commitment parameter is used to characterize the execution status of each subtask; After deleting the files included in the plurality of subtasks, the method comprises: Update the commitment parameter corresponding to each subtask based on the deletion result, where the deletion result is deletion success or deletion failure; The commitment parameters corresponding to each subtask are sent to the client.

6. The method according to claim 1, characterized in that The deleting the files included in the multiple subtasks includes: Deleting a target subtask of the plurality of subtasks, wherein the target subtask is one of the plurality of subtasks; When the deletion of the first subtask of the plurality of subtasks exceeds a set progress threshold, the next subtask of the target subtask in the plurality of subtasks is deleted.

7. A file deletion device, characterized in that: include: An acquisition module is used to acquire file information of each file in N files corresponding to the deletion task, where N is a positive integer greater than 1; A calculation module, used for calculating the file group value of each file based on the file information, wherein the file group value is used to represent the resource consumption degree of deleting the file; an allocating module, configured to allocate the N files to a plurality of subtasks based on the file grouping value of each file, wherein the plurality of subtasks are subtasks included in the deletion task; The deleting module is used to delete the files included in the multiple subtasks.

8. An electronic device, characterized in that: Including transceiver and processor, The transceiver is used to obtain file information of each file in N files corresponding to the deletion task, where N is a positive integer greater than 1; The processor is used to calculate the file grouping value of each file based on the file information, wherein the file grouping value is used to represent the resource consumption degree of deleting the file; The processor is further configured to allocate the N files to a plurality of subtasks based on the file grouping value of each file, wherein the plurality of subtasks are subtasks included in the deletion task; The processor is further configured to delete files included in the multiple subtasks.

9. An electronic device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the computer program implements the steps in the file deletion method according to any one of claims 1 to 6 when executed by the processor.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the file deletion method according to any one of claims 1 to 6 are implemented.

11. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the file deletion method according to any one of claims 1 to 6.