File cleaning method and device, equipment and medium

By obtaining and parsing cleaning configuration information, and automatically judging and executing file cleaning operations, the problem of complex and costly file cleaning configuration in the existing technology is solved, and a flexible and low-cost file cleaning function is realized.

CN120196601APending Publication Date: 2025-06-24BEIJING YOUZHUJU NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311786962.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-22
Publication Date
2025-06-24

AI Technical Summary

Technical Problem

In the prior art, realizing the file cleaning function requires adding complex configuration code to the business code corresponding to the file, resulting in high configuration costs and difficult to reuse.

Method used

By obtaining the cleaning configuration information, including the sub-cleaning configuration information corresponding to the target data structure, we judge whether the file meets the cleaning conditions and automatically performs the cleaning operation.

Benefits of technology

It realizes independent file cleaning function without adjusting business code, reducing the cost of developers maintaining code.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120196601A_ABST
    Figure CN120196601A_ABST
Patent Text Reader

Abstract

The invention discloses a file cleaning method and device, equipment and a medium in the technical field of computers. In the method, cleaning configuration information is firstly obtained; the cleaning configuration information comprises sub-cleaning configuration information corresponding to the target data structure. The sub-cleaning configuration information comprises a cleaning condition used for triggering execution of cleaning operation on the file of the target data structure. First file information of the file of the target data structure is obtained; the first file information is related to cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure. If it is determined that the file meets the cleaning condition included in the sub-cleaning configuration information corresponding to the target data structure based on the first file information, cleaning operation is executed on the file. Therefore, the file of the target data structure can be cleaned by using the cleaning configuration information. The file can be cleaned independently by using the cleaning configuration information, and the service code corresponding to the file does not need to be adjusted, so that the code maintenance cost of a developer is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and particularly to a file cleaning method, apparatus, device, and medium. Background Art

[0002] During the operation of a business system, files are generated and stored. When a file becomes invalid, it is necessary to clean up the file to release the storage resources occupied by the file, facilitating the storage of other data.

[0003] Currently, developers need to add code for implementing the file cleaning function in the business code corresponding to the file to configure the cleaning operation for the file. This way of implementing file cleaning is relatively complex and has a high configuration cost. Summary of the Invention

[0004] In view of this, this application provides a file cleaning method, apparatus, device, and medium, aiming to reduce the configuration cost required for implementing file cleaning.

[0005] Based on this, the technical solutions provided by this application are as follows:

[0006] In a first aspect, this application provides a file cleaning method, the method including:

[0007] Obtain cleaning configuration information, where the cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure, and the sub-cleaning configuration information includes cleaning conditions for triggering a cleaning operation on a file of the target data structure;

[0008] Obtain first file information of a file of the target data structure, where the first file information is related to the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure;

[0009] If it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, perform the cleaning operation on the file.

[0010] In a possible implementation, the cleaning conditions include basic file conditions and associated file conditions, the basic file conditions are conditions for the file, and the method further includes:

[0011] Obtain second file information of an associated file, where the associated file is associated with the file, and the second file information is related to the associated file conditions;

[0012] The step of if it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, perform the cleaning operation on the file includes:

[0013] If it is determined that the file meets the basic file conditions based on the first file information, and it is determined that the associated file meets the associated file conditions based on the second file information, perform the cleaning operation on the file and the associated file.

[0014] In a possible implementation, the cleaning condition includes one or more of the file identifier and the event information of the operation event.

[0015] In a possible implementation, the sub-cleaning configuration information further includes cleaning operation execution information, and the cleaning operation execution information is used to indicate the way to execute the cleaning operation. Performing the cleaning operation on the file includes:

[0016] Perform the cleaning operation on the file in the way indicated by the cleaning operation execution information.

[0017] In a possible implementation, the cleaning operation execution information is used to indicate to execute the cleaning operation when a preset time is reached.

[0018] In a possible implementation, the cleaning operation execution information is used to indicate to execute the cleaning operation at the moment when it is determined that the file meets the cleaning conditions included in the sub-cleaning policy corresponding to the target data structure based on the first file information.

[0019] In a possible implementation, obtaining the first file information of the file of the target data structure includes:

[0020] Obtain the first file information of the file of the target data structure by accessing the file storage system.

[0021] In a possible implementation, the cleaning configuration information further includes connection configuration information corresponding to the target data structure, and the connection configuration information is used to establish a connection relationship with the file storage system;

[0022] Before obtaining the first file information of the file of the target data structure by accessing the file storage system, the method further includes:

[0023] Based on the connection configuration information, establish a connection relationship with the file storage system.

[0024] In a possible implementation, the file storage system is a file storage system with a pre-established connection relationship.

[0025] In a possible implementation, the method further includes:

[0026] Generate a log recording the cleaning operation.

[0027] Second aspect, the present application provides a file cleaning device, the device includes:

[0028] A first acquisition unit, configured to acquire cleaning configuration information, the cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure, and the sub-cleaning configuration information includes a cleaning condition for triggering a cleaning operation on a file of the target data structure;

[0029] A second acquisition unit, configured to acquire first file information of a file of the target data structure, and the first file information is related to a cleaning condition included in the sub-cleaning configuration information corresponding to the target data structure;

[0030] A cleaning unit, configured to, if it is determined based on the first file information that the file meets the cleaning condition included in the sub-cleaning configuration information corresponding to the target data structure, perform the cleaning operation on the file.

[0031] In a possible implementation manner, the cleaning condition includes a basic file condition and an associated file condition, the basic file condition is a condition for the file, and the device further includes:

[0032] A third acquisition unit, configured to acquire second file information of an associated file, the associated file is associated with the file, and the second file information is related to the associated file condition;

[0033] The cleaning unit is specifically configured to, if it is determined based on the first file information that the file meets the basic file condition and it is determined based on the second file information that the associated file meets the associated file condition, perform the cleaning operation on the file and the associated file.

[0034] In a possible implementation manner, the cleaning condition includes one or more of a file identifier and event information of an operation event.

[0035] In a possible implementation manner, the sub-cleaning configuration information further includes cleaning operation execution information, the cleaning operation execution information is used to indicate a manner of performing the cleaning operation, and the cleaning unit is configured to perform the cleaning operation on the file, including:

[0036] The cleaning unit is configured to perform the cleaning operation on the file in a manner indicated by the cleaning operation execution information.

[0037] In a possible implementation manner, the cleaning operation execution information is used to indicate performing the cleaning operation when a preset time is reached.

[0038] In a possible implementation, the cleaning operation execution information is used to indicate that the cleaning operation is to be executed at the moment when it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning policy corresponding to the target data structure.

[0039] In a possible implementation, the second obtaining unit is specifically configured to obtain the first file information of the file of the target data structure by accessing a file storage system.

[0040] In a possible implementation, the cleaning configuration information further includes connection configuration information corresponding to the target data structure, and the connection configuration information is used to establish a connection relationship with the file storage system;

[0041] The apparatus further includes:

[0042] A connection unit, configured to establish a connection relationship with the file storage system based on the connection configuration information.

[0043] In a possible implementation, the file storage system is a file storage system with which a connection relationship has been pre-established.

[0044] In a possible implementation, the apparatus further includes:

[0045] A recording unit, configured to generate a log recording the cleaning operation.

[0046] In a third aspect, the present application provides an electronic device, including:

[0047] One or more processors;

[0048] A storage device, on which one or more programs are stored,

[0049] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in the first aspect and any implementation manner in the first aspect.

[0050] In a fourth aspect, the present application provides a computer-readable medium, on which a computer program is stored, wherein when the program is executed by a processor, the method described in the first aspect and any implementation manner in the first aspect is implemented.

[0051] In a fifth aspect, the present application provides a computer program product, which, when running on a device, causes the device to execute the method described in the first aspect and any implementation manner in the first aspect.

[0052] Thus, the present application has the following beneficial effects:

[0053] The present application provides a file cleaning method, apparatus, device, and medium. In this method, cleaning configuration information is first obtained. The cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure. The sub-cleaning configuration information includes cleaning conditions for triggering a cleaning operation on files of the target data structure. Then, first file information of files of the target data structure is obtained. The first file information is related to the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure. If it is determined based on the first file information that a file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, a cleaning operation is performed on the file. In this way, the cleaning of files of the target data structure can be realized by using the cleaning configuration information. By using the cleaning configuration information, the cleaning of files can be independently realized without adjusting the service code corresponding to the files, reducing the cost for developers to maintain the code. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 FIG. is a schematic diagram of the logical architecture of a file cleaning processor provided by an embodiment of the present application;

[0055] Figure 2 FIG. is a schematic flowchart of a file cleaning method provided by an embodiment of the present application;

[0056] Figure 3 FIG. is a schematic structural diagram of a file cleaning apparatus provided by an embodiment of the present application;

[0057] Figure 4 FIG. is a schematic diagram of the basic structure of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0058] To facilitate the understanding and explanation of the technical solutions provided by the embodiments of the present application, the background technology of the present application will be described first.

[0059] During the process of a business system processing a business, files including business data are generated. The files are stored in a storage system for subsequent reading of the data stored in the files. However, as the business continues to be processed, some files may become invalid. For example, if a file is updated by a new file, the original file becomes invalid. Another example is that if the file generation time exceeds the effective duration, the file becomes invalid. For invalid files, cleaning is required, that is, deleting the files from the storage system. In this way, storage resources can be released, storage costs can be reduced, and it is also convenient to manage the stored files. Currently, developers need to add code for implementing the file cleaning function in the service code corresponding to the files. In this way, when the service code is run, the cleaning of the file can be realized. However, for different service codes, the code added by developers for the file cleaning function is different. The process of developers adding code for the file cleaning function is relatively complex, and the cost of configuring the file cleaning function is relatively high. Moreover, the code for the file cleaning function is difficult to reuse and has poor scalability.

[0060] Based on this, the embodiments of the present application provide a file cleaning method, apparatus, device, and medium. In this method, cleaning configuration information is first obtained. The cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure. The sub-cleaning configuration information includes cleaning conditions for triggering a cleaning operation on files of the target data structure. Then, first file information of the files of the target data structure is obtained. The first file information is related to the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure. If it is determined based on the first file information that a file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, a cleaning operation is performed on the file. In this way, the cleaning of files of the target data structure can be achieved by using the cleaning configuration information. By using the cleaning configuration information, the cleaning of files can be independently achieved without adjusting the business code corresponding to the files, reducing the cost for developers to maintain the code.

[0061] A file cleaning method provided by the embodiments of the present application can be applied to an electronic device. An electronic device refers to a device with data processing capabilities, such as a server or a terminal. Among them, the terminal includes but is not limited to a smart phone, a tablet computer, a laptop computer, a personal digital assistant (PDA), or a smart wearable device, etc. The server can be a cloud server, such as the central server in a central computing cluster or the edge server in an edge computing cluster. Of course, the server can also be a server in a local data center. A local data center refers to a data center directly controlled by a user.

[0062] As an example, the electronic device includes a file cleaning processor. The file cleaning processor can be software encapsulated based on code for implementing the file cleaning function. Refer to Figure 1 , a schematic diagram of the logical architecture of a file cleaning processor provided by the embodiments of the present application.

[0063] The file cleaning processor includes a dynamic configuration detector, a pattern detector, a condition filter, and a policy executor. Among them, the dynamic configuration detector is used to obtain the cleaning configuration information and distribute the cleaning configuration information to the pattern detector, the condition filter, and the policy executor respectively. The pattern detector is used to determine the detection of files for the target data structure based on the sub-cleaning configuration information corresponding to the target data structure included in the cleaning configuration information. For example, the pattern detector is used to detect files of binary logs (Binlog), message queues (Message Queue, MQ), and interface description languages (Interface description language, IDL). The condition filter is used to filter files based on the cleaning conditions included in the sub-cleaning configuration information included in the cleaning configuration information to determine the files that meet the cleaning conditions. The policy executor is used to perform cleaning operations on the files that meet the cleaning conditions. In some possible implementation manners, the sub-cleaning configuration information further includes cleaning operation execution information. The user can configure timed cleaning operations or real-time cleaning operations on the files based on the cleaning operation execution information.

[0064] Those skilled in the art can understand that the above application scenario is only an example in which the embodiments of the present application can be implemented. The scope of application of the embodiments of the present application is not limited by any aspect of this application scenario.

[0065] To facilitate understanding of the technical solutions provided by the embodiments of the present application, the file cleaning method provided by the embodiments of the present application will be described below with reference to the accompanying drawings.

[0066] See Figure 2 As shown, this figure is a schematic flowchart of a file cleaning method provided by an embodiment of the present application. As Figure 2 shown, the method may include S201-S203:

[0067] S201: Obtain the cleaning configuration information, where the cleaning configuration information includes sub-cleaning configuration information corresponding to the target data structure, and the sub-cleaning configuration information includes cleaning conditions for triggering the execution of cleaning operations on the files of the target data structure.

[0068] The cleaning configuration information is the configuration information used to indicate the cleaning method of the file. The embodiments of the present application do not limit the possible implementation manners of obtaining the cleaning configuration information. In one possible implementation manner, a cleaning configuration instruction is obtained, and the cleaning configuration instruction includes the cleaning configuration information. In another possible implementation manner, the cleaning configuration information is obtained from a configuration file. As an example, when the cleaning configuration information included in the configuration file is updated, the cleaning configuration information is obtained from the configuration file. Configuring the cleaning method of the file by using the cleaning configuration information facilitates flexible configuration of the cleaning method of the file, realizes dynamic adjustment of the cleaning method of the file, and reduces the cost of adjusting the cleaning method of the file.

[0069] The cleaning configuration information can be generated from user configurations cleaned by the configuration file. The user can be the developer of the code or the user of the business system. The cleaning configuration information can also be automatically generated based on the operation requirements of the business system, and the embodiments of the present application do not limit this.

[0070] The cleaning configuration information includes at least one sub-cleaning configuration information.

[0071] The sub-cleaning configuration information corresponds to the target data structure and is used to indicate the cleaning method of the file of the target data structure. It should be noted that the embodiments of the present application do not limit the number of sub-cleaning configuration information included in the cleaning configuration information. The cleaning configuration information can include multiple sub-cleaning configuration information. The target data structures corresponding to different sub-cleaning configuration information can be the same or different.

[0072] The embodiments of the present application do not limit the specific type of the target data structure. The target data structure can be determined based on the data structure of the file to be cleaned. As an example, the target data structure is, for example, one or more of database logs, MQ, and IDL. The database log is, for example, a binary log (Binlog).

[0073] The sub-cleaning configuration information includes a cleaning condition for triggering the execution of a cleaning operation on the file of the target data structure. Based on the cleaning condition, it can be determined whether it is necessary to execute a cleaning operation on the file of the target data structure.

[0074] The specific content included in the cleaning condition is related to the file of the target data structure and the requirements for cleaning the file. This facilitates the user to flexibly configure the cleaning condition. The embodiments of the present application do not limit the specific content of the cleaning condition. The cleaning condition can include conditions in one or more dimensions, facilitating the user to configure multiple-dimensional conditions that the file to be cleaned needs to meet.

[0075] As an example, the embodiments of the present application provide three possible cleaning conditions. For specific details, please refer to the following specific description.

[0076] As an example, the cleaning configuration information is represented in the form of code. The cleaning conditions can be determined by the conditional parameters included in the code. In this way, the cleaning of files can be achieved by running independent code without modifying the business code of the files, reducing the cost of code maintenance.

[0077] S202: Obtain the first file information of the file of the target data structure, where the first file information is related to the cleaning conditions.

[0078] Based on the cleaning configuration information, the file of the target data structure that needs to be cleaned can be determined. Obtain the first file information related to the cleaning conditions of the file of the target data structure. The first file information is used to determine whether to clean the file based on the cleaning conditions. The specific content of the information included in the first file information is determined by the cleaning conditions.

[0079] S203: If it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, perform a cleaning operation on the file.

[0080] Use the obtained first file information to determine whether the file of the target data structure meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure.

[0081] If it is determined using the first file information that the file of the target data structure meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, then perform a cleaning operation on the file.

[0082] If it is determined using the first file information that the file of the target data structure does not meet the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, then do not perform a cleaning operation on the file.

[0083] The embodiments of the present application do not limit the manner of performing the cleaning operation on the file. In a possible implementation manner, a preset cleaning operation manner is adopted to perform the cleaning operation on the file. For example, the preset cleaning operation manner is to immediately perform the cleaning operation, that is, perform the cleaning operation at the moment when it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning strategy corresponding to the target data structure.

[0084] In another possible implementation manner, the sub-cleaning configuration information further includes cleaning operation execution information. The cleaning operation execution information is used to indicate the manner of performing the cleaning operation. In this scenario, performing the cleaning operation on the file in S203 includes: performing the cleaning operation on the file according to the manner indicated by the cleaning operation execution information.

[0085] In some possible cases, the sub-cleaning configuration information is represented by code. The cleaning operation execution information is represented by the cleaning parameters included in the code.

[0086] As an example, the embodiments of the present application provide two types of cleaning operation execution information.

[0087] As an example, the cleaning operation execution information is used to indicate that a cleaning operation is to be performed when a preset time is reached. The manner of such a cleaning operation can also be referred to as a timed cleaning manner. The preset time can be a fixed time set in advance. For example, the preset time is 24:00 every day. The preset time can also be a time determined based on a preset duration and a time when it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning policy corresponding to the target data structure. For example, the preset duration is 7 days, and the preset time is a time obtained by adding a duration of 7 days to the time when it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning policy corresponding to the target data structure.

[0088] As another example, the cleaning operation execution information is used to indicate that a cleaning operation is to be performed when it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning policy corresponding to the target data structure. The manner of such a cleaning operation can also be referred to as a real-time cleaning manner.

[0089] In addition, in some possible implementation manners, after a cleaning operation is performed on a file, a log recording the cleaning operation is generated. This facilitates subsequent tracing of the cleaning operation by querying the log.

[0090] Based on the relevant content of S201-S203 above, the triggering and execution of the cleaning operation on the file are realized by using the cleaning configuration information, and the process of file cleaning is independent of the business processing process of the file. In this way, there is no need to add code for the file cleaning function in the business code corresponding to the file, which facilitates the user to flexibly set the cleaning configuration information according to the need for file cleaning and reduces the cost of developers maintaining the code.

[0091] In some possible implementation scenarios, the file is stored in a file storage system. By accessing the file storage system, the first file information of the file with the target data structure is obtained. The embodiments of the present application do not limit the specific type of the file storage system. For example, the file storage system is a database for storing files of database logs.

[0092] In one possible implementation manner, the file storage system is a file storage system with a pre-established connection relationship. In this way, the file storage system can be directly accessed to obtain the first file information.

[0093] In another possible implementation, a connection relationship with the file storage system needs to be established to access the file storage system and obtain the first file information of the file. As an example, the cleaning configuration information further includes connection configuration information. The connection configuration information is used to establish a connection relationship with the file storage system to obtain information about the files of the target data structure stored in the file storage system. In some scenarios, the methods of establishing connection relationships with file storage systems storing files of different data structures are different. The connection configuration information corresponds to the target data structure. The embodiments of the present application do not limit the specific content included in the connection configuration information, and the connection configuration information can be determined based on the file storage system with which the connection relationship is to be established.

[0094] Based on the connection configuration information included in the cleaning configuration information, a connection relationship with the file storage system is constructed. In this way, a connection relationship with the file storage system can be established so that the first file information of the files of the target data structure can be obtained by accessing the file storage system subsequently, realizing the cleaning of the files of the target data structure and facilitating the flexible configuration of the files of the target data structure that need to be cleaned.

[0095] As an example, the embodiments of the present application provide a piece of code including connection configuration information for constructing a connection relationship with the file storage system:

[0096]

[0097]

[0098] Among them, "mode" is used to represent the type of the target data structure. For example, "mode": "BINLOG" is used to represent that the target data structure is a binary log. "mode": "MQ" is used to represent that the target data structure is MQ. "mode": "IDL" is used to represent that the target data structure is IDL.

[0099] "config" is used to represent the connection configuration information. For example, for binary logs, a connection relationship with mysql (a kind of database) is established through jdbc (Java DataBase Connectivity), the connection user name, and the user password for subsequent access to mysql. For MQ, a connection relationship with the Kafka cluster is established through bootstrap.servers and the topic. Bootstrap.servers is a configuration item of Kafka used to specify the addresses of at least one broker (server node in the Kafka cluster) in the Kafka cluster as the initial address when establishing a connection with the Kafka cluster. For IDL, a connection relationship with the interface of the service storing the file is established through the interface identifier.

[0100] The above is the construction method of the connection relationship between the storage subsystems of the file storing the target data structure. The storage subsystem belongs to the file storage system. The code also includes the file system address, access user name, and user password of the file storage system. This facilitates establishing a connection relationship with the file storage system and, based on the connection relationship with the file storage system, establishing a connection relationship with the storage subsystem of the file storing the specific data structure. Running the above code establishes a connection relationship with the storage subsystems of the files storing each target data structure, so as to obtain the first file information of the files of the target data structure from each storage subsystem.

[0101] In addition, the embodiments of the present application do not limit the specific content of the cleaning conditions. Three possible cleaning conditions provided by the embodiments of the present application are introduced below.

[0102] The first one: The cleaning condition includes a file identifier.

[0103] The file identifier is used to determine the file that needs to be cleaned. The embodiments of the present application do not limit the specific content of the file identifier. The file identifier can be related to the target data structure. As an example, the target data structure is a binary log. The file identifier is the table name. Further, for a table, the file identifier can also include field names. In this way, the fields in the table identified by the table name can be cleaned, refining the cleaning granularity. Another example is that the target data structure is MQ or IDL. The file identifier is the primary key of the file.

[0104] For the case where the cleaning condition includes a file identifier, the first file information of the file of the target data structure obtained includes the file identifier. In this way, it is possible to clean the files whose file identifiers included in the first file information are the same as the file identifiers included in the cleaning condition, realizing the cleaning of specific files.

[0105] As an example, the embodiments of the present application provide a partial code including sub-cleaning configuration information corresponding to MQ, including:

[0106]

[0107] Among them, the file primary key is the file identifier, which is used to determine the file that needs to be cleaned.

[0108] As another example, an embodiment of the present application provides a code including sub-cleaning configuration information corresponding to the IDL. It should be noted that a cleaning service is pre-configured, and the cleaning of files is achieved by calling the interface of the cleaning service. For example, the interface of the SDK (Software Development Kit) can be called to achieve the cleaning of files. The SDK is, for example, the storege-clean-client dependency package. Another example is that the cleaning of files can be achieved through the interface of the RPC (Remote Procedure Call) service. Part of the code is as follows:

[0109]

[0110] Among them, the file primary key is the file identifier, which is used to determine the file to be cleaned.

[0111] The second type: The cleaning condition includes event information of the operation event for the file.

[0112] During the operation of the business system, operation events may be performed on files. The cleaning condition includes event information of the operation event for the file. The event information is used to describe the operation event that meets the cleaning condition. As an example, the event information includes the event type. The event type is a write event, an update event, a delete event, etc., and the embodiments of the present application do not limit this. As another example, the event information includes the event type and the event occurrence time.

[0113] For the case where the cleaning condition includes the event type of the operation event for the file, the first file information includes operation event information. The operation event information is used to indicate the operation event performed on the file. Based on the operation event information, the specific operation event performed on the file can be determined, and then it can be judged whether the event type of the specific operation event performed on the file belongs to the event type of the operation event for the file included in the cleaning condition, so as to determine whether to trigger the cleaning operation on the file.

[0114] The condition contents included in the above two cleaning conditions are all conditions for the files to be cleaned. The condition contents included in the above two cleaning conditions can be used alone or in combination.

[0115] The condition contents included in the above two cleaning conditions are only examples. In addition, the condition contents included in the cleaning condition are, for example, file types, business types to which the files belong, etc. Among them, the file type is used to determine the type of the file to be cleaned. The file type includes, for example, one or more of various types such as audio files, video files, image files, text files, etc. The business type to which the file belongs is related to the specific business that generates the file.

[0116] As an example, an embodiment of the present application provides a part of the code including sub-cleaning configuration information corresponding to binlog, including:

[0117]

[0118] It should be noted that the condition field and the condition value belong to the event information and are used to define the conditions that the operation event needs to meet. For example, for the field value of the event type indicating that the operation event is an update event, the condition field indicates the update time, and the condition value is a preset time. In this way, it can be realized that when an update event triggered at the preset time is detected, it is determined that the file meets the cleaning conditions.

[0119] In addition to the above cleaning conditions, the cleaning conditions can include conditions for multiple interrelated files to implement the cleaning of interrelated files.

[0120] The third type: the cleaning conditions include basic file conditions and associated file conditions.

[0121] The basic file condition is the condition for a file that needs to be cleaned. The associated file condition is the condition for the file associated with this file. As an example, the data included in file A is determined based on the data included in file B. File B is associated with file A. As another example, processing file A requires processing file B. File B is associated with file A. The association relationship between files can be preset.

[0122] The embodiments of the present application do not limit the specific content included in the basic file condition and the associated file condition. Both the basic file condition and the associated file condition can be configured based on the cleaning requirements of the file. As an example, both the basic file condition and the associated file condition include the file identifier and the event type of the operation event for the file.

[0123] In a possible implementation manner, the cleaning condition is represented by code. The code includes an associated field indicating whether there is an associated file condition. Based on the associated field, it can be determined whether the cleaning condition includes an associated file condition.

[0124] For the case where the cleaning condition includes the basic file condition and the associated file condition, in addition to obtaining the first file information of the file, it is also necessary to obtain the second file information of the associated file. The second file information is related to the associated file condition. The content included in the second file information is determined by the associated file condition. In this way, it is convenient to determine whether to clean the associated file based on the associated file condition.

[0125] As an example, an embodiment of the present application provides a part of the code including sub-cleaning configuration information corresponding to binlog, including:

[0126]

[0127]

[0128]

[0129] Among them, the basic file conditions include file identification, file type, business type, and event information. The associated file conditions include file identification, file type, and business type.

[0130] When determining whether a file needs to be cleaned up, it is necessary to ensure that both the file and the associated file meet the cleaning conditions. An embodiment of the present application provides an S203: A specific implementation manner of performing a cleaning operation on a file if it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure includes:

[0131] If it is determined based on the first file information that the file meets the basic file conditions, and it is determined based on the second file information that the associated file meets the associated file conditions, perform a cleaning operation on the file and the associated file.

[0132] Use the first file information to determine whether the file meets the basic file conditions, and use the second file information to determine whether the associated file meets the associated file conditions. If it is determined based on the first file information that the file meets the basic file conditions, and it is determined based on the second file information that the associated file meets the associated file conditions, then perform a cleaning operation on the file and the associated file.

[0133] It should be noted that in some cases, the cleaning operation execution information includes the cleaning operation execution information of the basic file and the cleaning operation execution information of the associated file. Perform a cleaning operation on the file in the manner indicated by the cleaning operation execution information of the basic file. Perform a cleaning operation on the associated file in the manner indicated by the cleaning operation execution information of the associated file.

[0134] In this way, it is possible to clean up multiple associated files, improve the cleaning efficiency of the files, and there is no need to separately configure cleaning conditions for the associated files, reducing the configuration difficulty.

[0135] Based on the file cleaning method provided in the above method embodiment, the present application embodiment also provides a file cleaning device, which will be described below in conjunction with the accompanying drawings.

[0136] See Figure 3 As shown, this figure is a schematic structural diagram of a file cleaning device provided by an embodiment of the present application. As Figure 3 shown, the file cleaning device includes:

[0137] A first acquisition unit 301, configured to acquire cleaning configuration information, where the cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure, and the sub-cleaning configuration information includes a cleaning condition for triggering a cleaning operation on a file of the target data structure;

[0138] A second acquisition unit 302, configured to acquire first file information of a file of the target data structure, where the first file information is related to a cleaning condition included in the sub-cleaning configuration information corresponding to the target data structure;

[0139] A cleaning unit 303, configured to perform the cleaning operation on the file if it is determined based on the first file information that the file meets the cleaning condition included in the sub-cleaning configuration information corresponding to the target data structure.

[0140] In a possible implementation manner, the cleaning condition includes a basic file condition and an associated file condition, the basic file condition is a condition for the file, and the apparatus further includes:

[0141] A third acquisition unit, configured to acquire second file information of an associated file, where the associated file is associated with the file, and the second file information is related to the associated file condition;

[0142] The cleaning unit 303 is specifically configured to perform the cleaning operation on the file and the associated file if it is determined based on the first file information that the file meets the basic file condition and it is determined based on the second file information that the associated file meets the associated file condition.

[0143] In a possible implementation manner, the cleaning condition includes one or more of a file identifier and event information of an operation event.

[0144] In a possible implementation manner, the sub-cleaning configuration information further includes cleaning operation execution information, where the cleaning operation execution information is used to indicate a manner of performing a cleaning operation, and the cleaning unit 303 is configured to perform the cleaning operation on the file, including:

[0145] The cleaning unit 303 is configured to perform the cleaning operation on the file in a manner indicated by the cleaning operation execution information.

[0146] In a possible implementation manner, the cleaning operation execution information is used to indicate performing a cleaning operation when a preset time is reached.

[0147] In a possible implementation manner, the cleaning operation execution information is used to indicate performing a cleaning operation at a moment when it is determined based on the first file information that the file meets the cleaning condition included in the sub-cleaning policy corresponding to the target data structure.

[0148] In a possible implementation, the second obtaining unit 302 is specifically configured to obtain first file information of a file of the target data structure by accessing a file storage system.

[0149] In a possible implementation, the cleaning configuration information further includes connection configuration information corresponding to the target data structure, and the connection configuration information is used to establish a connection relationship with the file storage system;

[0150] The apparatus further includes:

[0151] A connection unit, configured to establish a connection relationship with the file storage system based on the connection configuration information.

[0152] In a possible implementation, the file storage system is a file storage system with a pre-established connection relationship.

[0153] In a possible implementation, the apparatus further includes:

[0154] A recording unit, configured to generate a log recording the cleaning operation.

[0155] Based on a file cleaning method provided in the foregoing method embodiment, the present application further provides an electronic device, including: one or more processors; a storage device storing one or more programs thereon, and when the one or more programs are executed by the one or more processors, the one or more processors implement the file cleaning method as described in any of the foregoing embodiments.

[0156] Next, referring to Figure 4 , which shows a schematic structural diagram of an electronic device 400 suitable for implementing embodiments of the present application. The terminal device in the embodiments of the present application may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (portable android devices, tablet computers), PMPs (Portable Media Players), in-vehicle terminals (such as in-vehicle navigation terminals), etc., and fixed terminals such as digital TVs (televisions), desktop computers, etc. Figure 4 The electronic device shown is only an example and should not impose any limitation on the functions and usage scopes of the embodiments of the present application.

[0157] As Figure 4As shown, the electronic device 400 may include a processing device (such as a central processing unit, a graphics processing unit, etc.) 401, which may perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 402 or a program loaded from a storage device 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 are also stored. The processing device 401, the ROM 402, and the RAM 403 are connected to each other through a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.

[0158] Generally, the following devices may be connected to the I / O interface 405: an input device 408 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 407 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 408 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 409. The communication device 409 may allow the electronic device 400 to communicate with other devices wirelessly or wiredly to exchange data. Although Figure 4 an electronic device 400 with various devices is shown, it should be understood that it is not required to implement or have all the shown devices. More or fewer devices may be implemented or had alternatively.

[0159] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart may be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes program codes for executing the method shown in the flowchart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 409, or installed from the storage device 408, or installed from the ROM 402. When the computer program is executed by the processing device 401, the above functions defined in the method of the embodiment of the present application are executed.

[0160] The electronic device provided by the embodiment of the present application and the file cleaning method provided by the above embodiment belong to the same inventive concept. Technical details not described in detail in this embodiment may be referred to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.

[0161] Based on a file cleaning method provided by the above method embodiment, an embodiment of the present application provides a computer storage medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the file cleaning method as described in any of the above embodiments.

[0162] It should be noted that the computer-readable medium described above in the present application can be a computer-readable signal medium, a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above. More specific examples of the computer-readable storage medium can include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, the computer-readable storage medium can be any tangible medium that contains or stores a program, and this program can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present application, a computer-readable signal medium can include a data signal propagated in a baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, and this computer-readable signal medium can send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.

[0163] In some embodiments, the client and the server can communicate using any currently known or future-developed network protocol such as HTTP (Hyper Text Transfer Protocol), and can be interconnected with digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any currently known or future-developed networks.

[0164] The above computer-readable medium can be included in the above electronic device; or it can exist separately without being assembled into the electronic device.

[0165] The above computer-readable medium carries one or more programs, and when the one or more programs are executed by the electronic device, the electronic device is caused to execute the above file cleaning method.

[0166] Computer program code for performing the operations of this application can be written in one or more programming languages or combinations thereof. The above-mentioned programming languages include, but are not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (for example, by using an Internet service provider to connect through the Internet).

[0167] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and combinations of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0168] The units involved in the embodiments described in this application can be implemented in software or in hardware. Among them, the name of the unit / module does not, in some cases, constitute a limitation on the unit itself. For example, the voice data acquisition module can also be described as the "data acquisition module".

[0169] The functions described above herein can be performed, at least in part, by one or more hardware logic components. For example, by way of non-limitation, exemplary types of hardware logic components that can be used include: field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), systems on a chip (SOC), complex programmable logic devices (CPLD), and so on.

[0170] In the context of the present application, a machine-readable medium may be a tangible medium that can contain or store a program for use by or in connection with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0171] It should be noted that the various embodiments in this specification are described in a progressive manner, and the key point of each embodiment is to illustrate the differences from other embodiments. For the same or similar parts among the various embodiments, reference can be made to each other. For the systems or devices disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple, and reference can be made to the description in the method part for the relevant parts.

[0172] It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: only A exists, only B exists, and both A and B exist simultaneously. Among them, A and B may be singular or plural. The character " / " generally indicates that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or a similar expression refers to any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c may mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c may be single or multiple.

[0173] It should also be noted that, in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article or device comprising a series of elements not only includes those elements but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or device comprising said element.

[0174] The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A file cleaning method, characterized in that, The method includes: Obtaining cleaning configuration information, where the cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure, and the sub-cleaning configuration information includes cleaning conditions for triggering a cleaning operation on a file of the target data structure; Obtaining first file information of a file of the target data structure, where the first file information is related to the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure; If it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, performing the cleaning operation on the file.

2. The method according to claim 1, characterized in that, The cleaning conditions include basic file conditions and associated file conditions. The basic file conditions are conditions for the file. The method further includes: Obtaining second file information of an associated file, where the associated file is associated with the file, and the second file information is related to the associated file conditions; The step of, if it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning configuration information corresponding to the target data structure, performing the cleaning operation on the file includes: If it is determined based on the first file information that the file meets the basic file conditions and it is determined based on the second file information that the associated file meets the associated file conditions, performing the cleaning operation on the file and the associated file.

3. The method according to claim 1, wherein The cleaning conditions include one or more of a file identifier and event information of an operation event.

4. The method according to claim 1, wherein The sub-cleaning configuration information further includes cleaning operation execution information for indicating a manner of performing the cleaning operation. The step of performing the cleaning operation on the file includes: Performing the cleaning operation on the file in the manner indicated by the cleaning operation execution information.

5. The method according to claim 4, wherein The cleaning operation execution information is used to indicate performing the cleaning operation at a preset moment.

6. The method according to claim 4, wherein The cleaning operation execution information is used to indicate performing the cleaning operation at the moment when it is determined based on the first file information that the file meets the cleaning conditions included in the sub-cleaning strategy corresponding to the target data structure.

7. The method according to claim 1, characterized in that The step of obtaining first file information of a file of the target data structure includes: Obtaining first file information of a file of the target data structure by accessing a file storage system.

8. The method according to claim 7, wherein The cleaning configuration information further includes connection configuration information corresponding to the target data structure, and the connection configuration information is used to establish a connection relationship with the file storage system; Before obtaining first file information of a file of the target data structure by accessing the file storage system, the method further includes: Establishing a connection relationship with the file storage system based on the connection configuration information.

9. The method according to claim 7, characterized in that, The file storage system is a file storage system with a pre-established connection relationship.

10. The method according to any one of claims 1-9, characterized in that, The method further includes: Generating a log recording the cleaning operation.

11. A file cleaning device, characterized in that, The apparatus includes: A first obtaining unit for obtaining cleaning configuration information, where the cleaning configuration information includes sub-cleaning configuration information corresponding to a target data structure, and the sub-cleaning configuration information includes cleaning conditions for triggering a cleaning operation on a file of the target data structure; A second acquisition unit, configured to acquire first file information of a file of the target data structure, where the first file information is related to a cleaning condition included in sub-cleaning configuration information corresponding to the target data structure; A cleaning unit, configured to perform the cleaning operation on the file if it is determined based on the first file information that the file meets the cleaning condition included in the sub-cleaning configuration information corresponding to the target data structure.

12. An electronic device, characterized in that, Comprising: One or more processors; A storage device storing one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the method according to any one of claims 1-10.

13. A computer-readable medium, characterized in that, A computer program is stored thereon, wherein the program, when executed by a processor, implements the method according to any one of claims 1-10.