CN110795401A - Method and device for clearing file and storage medium - Google Patents

Method and device for clearing file and storage medium Download PDF

Info

Publication number
CN110795401A
CN110795401A CN201911008294.1A CN201911008294A CN110795401A CN 110795401 A CN110795401 A CN 110795401A CN 201911008294 A CN201911008294 A CN 201911008294A CN 110795401 A CN110795401 A CN 110795401A
Authority
CN
China
Prior art keywords
file
directory
information
expired
ttl
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911008294.1A
Other languages
Chinese (zh)
Inventor
周应超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Mobile Software Co Ltd
Original Assignee
Beijing Xiaomi Mobile Software Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Xiaomi Mobile Software Co Ltd filed Critical Beijing Xiaomi Mobile Software Co Ltd
Priority to CN201911008294.1A priority Critical patent/CN110795401A/en
Publication of CN110795401A publication Critical patent/CN110795401A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to a method for clearing files, a device for clearing files and a storage medium. A method of clearing a file, comprising: acquiring TTL (time to live) information of a file from a file storage system, wherein the TTL information is stored in the file storage system; determining an expired file according to the TTL information; and clearing the expired files. By the method and the device, when the file is cleared, interaction with the outside is not required, a database for storing TTL information is not required to be separately deployed, and system maintenance is more convenient.

Description

Method and device for clearing file and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method for removing a file, an apparatus for removing a file, and a storage medium.
Background
The stored files need to be cleared regularly in the file storage system so as to ensure the normal operation of the file storage system.
Time To Live (TTL) mechanism is a mechanism to automatically clear data. In the related art, when a TTL mechanism is used to remove a file, TTL information is stored in a database independent of a file storage system. The TTL information is periodically retrieved from a database separate from the file storage system. And clearing the expired files in the file storage system based on the acquired TTL information.
In the method for clearing the file by using the TTL mechanism, an additional maintenance of a database independent of the file storage system is required, and the TTL function deployment and maintenance are complicated.
Disclosure of Invention
To overcome the problems in the related art, the present disclosure provides a method of removing a file, an apparatus for removing a file, and a storage medium.
According to a first aspect of the embodiments of the present disclosure, there is provided a method for clearing a file, which is applied to a file storage system, and includes: acquiring TTL (time to live) information of a file from a file storage system, wherein the TTL information is stored in the file storage system; determining an expired file according to the TTL information; and clearing the expired files.
In one example, determining an expired file from the TTL information includes: acquiring a file access request, wherein the file access request indicates to access a target file; acquiring TTL information of a target file in a file storage system; and determining an expired file in the target file based on the TTL information of the target file.
In one example, the TTL information is stored in the data block where the file storage system inode extended attribute is located; acquiring time-to-live (TTL) information of a file from a file storage system, wherein the TTL information comprises the following steps:
and scanning the data block at a preset moment through a thread resident in a background of the file storage system, and acquiring TTL information from the data block through scanning.
In one example, the TTL information is stored in an array string and includes one or more of the following information:
information indicating whether a clear file function is turned on; expiration time information; indicating whether to clear the information of the directory file after the directory file is expired when the directory file is empty; and indicating whether the information of the subdirectory file is removed after the subdirectory file is expired or not when the subdirectory file is empty.
In one example, the inode comprises a directory file inode, or the inode comprises: directory file index nodes and subdirectory file index nodes belonging to directory files; clearing the expired files, including:
when TTL information stored in a directory file index node represents that a directory file is overdue, if the directory file is empty, the directory file is removed; when TTL information stored in the directory file index node represents that the directory file is expired, if the directory file is not empty, the directory file is cleared after the next-level subdirectory file belonging to the directory file is expired and cleared.
In one example, if the expired file includes: a next level of sub-directory files belonging to the directory file; clearing the expired files, including: clearing the TTL information stored by the index node based on the file of the next-level subdirectory; or clearing the TTL information of the inherited directory file based on the next level subdirectory file.
According to a second aspect of the embodiments of the present disclosure, there is provided an apparatus for clearing a file, which is applied to a file storage system, including: the acquiring unit is configured to acquire Time To Live (TTL) information of a file from a file storage system, wherein the TTL information is stored in the file storage system; a determining unit configured to determine an expired file according to the TTL information; a processing unit configured to clear the expired file.
In one example, an obtaining unit is configured to obtain a file access request, the file access request indicates to access a target file, and obtain TTL information of the target file in a file storage system; the determination unit is configured to: and determining an expired file in the target file based on the TTL information of the target file.
In one example, the TTL information is stored in the data block where the file storage system inode extended attribute is located; the acquisition unit is configured to: and scanning the data block at a preset moment through a thread resident in a background of the file storage system, and acquiring TTL information from the data block through scanning.
In one example, the TTL information is stored in an array string and includes one or more of the following information:
information indicating whether a clear file function is turned on; expiration time information; indicating whether to clear the information of the directory file after the directory file is expired when the directory file is empty; and indicating whether the information of the subdirectory file is removed after the subdirectory file is expired or not when the subdirectory file is empty.
In one example, the inode comprises a directory file inode, or the inode comprises: directory file index nodes and subdirectory file index nodes belonging to directory files; the processing unit clears the expired file in the following way: when TTL information stored in a directory file index node represents that a directory file is overdue, if the directory file is empty, the directory file is removed; when TTL information stored in the directory file index node represents that the directory file is expired, if the directory file is not empty, the directory file is cleared after the next-level subdirectory file belonging to the directory file is expired and cleared.
In one example, if the expired file includes: a next level of sub-directory files belonging to the directory file; the processing unit clears the expired file in the following way: clearing the TTL information stored by the index node based on the file of the next-level subdirectory; or clearing the TTL information of the inherited directory file based on the next level subdirectory file.
According to a third aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer-executable instructions that, when executed by a processor, perform the method of clearing a file of the first aspect or any of the examples of the first aspect.
According to a fourth aspect of the present disclosure, there is provided an apparatus for clearing a file, the apparatus for clearing a file comprising: a memory configured to store instructions. And a processor configured to invoke instructions to perform the method of clearing files in the foregoing first aspect or any example of the first aspect.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects: when the file is cleared, the TTL information of the file is stored in the file storage system, the TTL information of the file can be directly acquired from the file storage system, the expired file is determined, and the expired file is cleared. Through the embodiment of the disclosure, when the file is cleared, the interaction with the outside is not required, and a database for storing TTL information is not required to be separately deployed, so that the system maintenance is more convenient.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure.
FIG. 1 is a flow diagram illustrating a method of clearing a file in accordance with an exemplary embodiment.
FIG. 2 is a flow diagram illustrating a method of clearing a file in accordance with an exemplary embodiment.
Fig. 3 is a flow chart illustrating a method for determining stale files based on TTL information in accordance with an exemplary embodiment.
FIG. 4 is a flow diagram illustrating a method of clearing a file in accordance with an exemplary embodiment.
Fig. 5 is a diagram illustrating an example of storing TTL information for a file, according to an exemplary embodiment.
FIG. 6 is a block diagram illustrating an apparatus for clearing files in accordance with an exemplary embodiment.
FIG. 7 is a block diagram illustrating an apparatus in accordance with an example embodiment.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
The method for clearing the files is applied to an application scene for clearing the files stored in the file storage system. In this application scenario, the execution main body of the cleaning file may be a device for cleaning a file, and the device for cleaning a file may be a computer, a mobile terminal, or other terminal.
Fig. 1 is a flowchart illustrating a method for clearing a file according to an exemplary embodiment, where the method for clearing a file, as shown in fig. 1, is applied to a file storage system, and the method for clearing a file includes the following steps.
In step S11, TTL information of the file is acquired from the file storage system.
In an exemplary embodiment of the present disclosure, a file may be a data file, a directory file, or a sub-directory file. In the present disclosure, TTL information of a file is stored in a file storage system.
In step S12, an expired file is determined according to the TTL information.
The expiration time of the file can be determined through TTL information in the disclosure.
In one embodiment, the TTL information may include one or more of the following: the information indicating whether to start a function of removing files, the expiration time information of files, the information indicating whether to remove the directory files after the directory files are expired when the directory files are empty, and the information indicating whether to remove the subdirectory files after the subdirectory files are expired when the subdirectory files are empty.
In the present disclosure, the TTL information may be stored in the file storage system in the form of a (key) array string. The form of the (key) array string is also referred to as a form of a key-value pair. For example, the TTL information stored in the form of an array string is:
Ttl=true/false
Expiretime=XXXX
KeepEmptySubdir=yes/no
KeepEmptyDir=yes/no
wherein, the Ttl/false indicates whether the file has information for clearing the file function according to the Ttl information. Expiretime denotes the expiration time of the file XXXX. And the keep emptysubpard indicates whether the subdirectory file is cleared after the subdirectory file expires when the subdirectory file is empty. The keepteptydir & yes/no indicates whether the directory file is cleared after the directory file has expired when the directory file is empty.
In an exemplary embodiment of the present disclosure, when TTL information acquired in a file storage system satisfies the following condition, the file is an expired file: the file starts a function of clearing the file according to the TTL information, and when the survival time of the file is expired, the file is the expired file.
In step S13, the expired file is cleared.
In the exemplary embodiment of the disclosure, when a file is cleared, TTL information of the file is stored in the file storage system, and the TTL information of the file can be directly acquired from the file storage system, an expired file is determined, and the expired file is cleared. Therefore, when the file is cleared, the interaction with the outside is not needed, and a database for storing TTL information is not needed to be separately deployed, so that the system maintenance is more convenient.
In the present disclosure, clearing expired files may be based on TTL information of the files. The present disclosure is described below in conjunction with practical applications.
Referring to fig. 2, fig. 2 is a flow diagram illustrating a method of clearing a file in accordance with an exemplary embodiment. As shown in fig. 2, step S13 shown in fig. 1 includes the following steps.
S131: and the TTL information acquired from the file storage system is the TTL information of the data file, and the data file is directly cleared when the data file is overdue.
In one embodiment, the TTL information obtained from the file storage system is TTL information of a data file, and the data file is cleared directly when the data file is expired.
S132: and acquiring TTL information from the file storage system as TTL information of the directory file, wherein the directory file is overdue, and if the directory file is empty, the directory file is cleared.
S133: and if the directory file is not empty, the directory file is cleared after the next level subdirectory file belonging to the directory file is expired and cleared.
In a possible implementation manner, if the directory file is not empty, the expired file is cleared according to the next-level subdirectory file belonging to the directory file, and after the next-level subdirectory file belonging to the directory file expires and is cleared, the directory file is cleared. The next level subdirectory file of the directory file can be a directory file or a data file.
In the present disclosure, on one hand, if the TTL information is not set in the next-level subdirectory file of the directory file, the next-level subdirectory file inherits the TTL information of the directory file. After the next level of sub-directory file inherits the TTL information of the directory file, the two have the same TTL information. When the directory file is expired, the subdirectory file is also expired, and the directory file and the next level subdirectory file of the directory file can be further cleared. On the other hand, if the directory file is not empty and the next level sub-directory file is provided with the TTL information of the sub-directory file, the directory file is cleared after the next level sub-directory file belonging to the directory file expires. In other words, if the TTL of the next-level sub-directory file of the directory file is greater than the TTL of the directory file, after the directory file expires, the directory file is not cleared, but the directory file is cleared after the next-level sub-directory file belonging to the directory file expires. For example, the TTL information obtained from the file storage system is TTL information of a directory file a, the directory file a is expired, the directory file a is not empty, and the directory file exists in the next-level sub-directory file B. And continuously acquiring TTL information of the subdirectory file B from the file storage system, and if the subdirectory file B is provided with the TTL information, clearing the directory file A after the subdirectory file B is determined to be overdue according to the TTL information of the subdirectory file B and is cleared. And by analogy, if the directory file A is not empty, the directory file exists in a next level of sub-directory file B, the sub-directory file B exists in a next level of sub-directory file C, the sub-directory file C is provided with TTL information, the sub-directory file B is removed after the sub-directory file C expires, and the directory file A is removed after the sub-directory file B expires.
In the exemplary embodiment of the disclosure, the outdated data file is directly cleared, the outdated empty directory file is directly cleared, and the outdated directory file which is not empty is cleared in a manner that the directory file is cleared after the next-level sub-directory file belonging to the directory file is expired and cleared, so that the files can be ensured to be cleared orderly, and the files are prevented from being cleared by mistake.
In the present disclosure, when determining an expired file, the determination may be performed in a file access process, or may be performed by periodically acquiring TTL information. The present disclosure is described below in conjunction with practical applications.
Referring to fig. 3, fig. 3 is a flow chart illustrating a method for determining an expired file based on TTL information according to an exemplary embodiment. As shown in fig. 3, step S12 shown in fig. 1 includes the following steps.
In step S121, a file access request is acquired, the file access request indicating access to the target file.
In an exemplary embodiment of the present disclosure, the file access request may be obtained based on when the file is accessed, and then the access target file may be instructed by the file access request. By accessing the target file, the TTL information of the target file can be acquired.
In step S122, TTL information of the target file is acquired in the file storage system.
In the present disclosure, the access target file may be instructed by the file access request. By accessing the target file, the TTL information of the target file can be acquired.
In step S123, an expired file is determined in the target file based on the TTL information of the target file.
In an exemplary embodiment of the present disclosure, after determining that the access file is an expired file, a response message indicating that the file access fails may be fed back.
In an exemplary embodiment of the present disclosure, based on a target file that is indicated to be accessed when a file is accessed, whether the target file is an expired file may be determined by acquiring TTL information of the target file in a file storage system. If the target file is the expired file, the expired file is cleared, so that the expired file which is not cleared can be found in time, and the expired file is ensured not to be missed.
Referring to fig. 4, fig. 4 is a flowchart illustrating a method of clearing a file according to an exemplary embodiment, and as shown in fig. 4, step S11 shown in fig. 1 includes the following steps.
In step S111, TTL information is acquired from the file storage system at a preset time through a thread resident in the background of the file storage system.
In an exemplary embodiment of the disclosure, a thread resident in a background of the file storage system may be started when the file storage system is mounted, and a data block where an extended attribute of each index node of the file storage system is located may be scanned at a preset time based on the started thread resident in the background of the file storage system. And acquiring the TTL information from the data block where the extended attribute of each index node of the file storage system is located by scanning.
According to the method and the device, the TTL information of the file is acquired through the thread of the background of the file storage system, and the TTL information of the file is not acquired through the program outside the file storage system, so that the complexity of file cleaning deployment can be further reduced, the complexity of file cleaning in later maintenance is further reduced, and the file cleaning is more convenient and easier to operate.
In the exemplary embodiment of the disclosure, TTL information of a file is acquired through a thread of a background of a persistent file storage system, so that complexity of file cleaning and deployment can be reduced, and complexity of file cleaning in later maintenance can be reduced.
Further, the present disclosure may store TTL information of a file in each INode in the file storage system using an attribute function of an INode (INode) storing basic information of the file when the TTL information is stored in the file storage system. The TTL information of the file is stored by using the INode, so that the TTL information of the file is easier to manage. Further, for more convenient management of TTL information, TTL information of a file may be stored in a data block where an extended attribute (xattr) of the INode is located.
The present disclosure describes the implementation process of storing TTL information as described above with an application example.
The TTL information is stored in the data block where xattr of the INode is located. The xattr is an extended attribute provided by the file storage system, and an array string of "key value" may be filled in a data block where the xattr is located. For example, the present disclosure may store TTL information in a data block where xattr of the INode resides in a manner as shown in FIG. 5. The TTL information includes information indicating whether to start a file clearing function; expiration time information; indicating whether to clear the information of the directory file after the directory file is expired when the directory file is empty; and indicating whether to clear the related information of the subdirectory file after the subdirectory file is expired when the subdirectory file is empty.
The following describes the above procedure for clearing expired files with an application example.
In the present disclosure, it is assumed that the INode includes a directory file INode, or includes a directory file INode and a sub-directory file INode belonging to a directory file, and TTL information is stored in the INode.
In one example, TTL information is stored in each INode in a nested manner. For example, assume that the directory tree corresponding to the existing directory file is: A/B/E,/A/C and/A/D. Namely, a sub-directory file B and data files C and D are arranged under the directory file A. And a data file E is under directory file B. Suppose that the user sets the TTL of the directory file a to 2 days, the TTL of the directory file B to 3 days, the TTL of the data file E to 1 day, and the TTL of the data file C and the TTL of the data file D are not set, and store the TTL information corresponding to each in the INode corresponding to each. When the expired file is cleared, it is determined that the data file E will be cleared after 1 day based on the TTL information stored in the INode, where TTL information setting from the data file E itself is used. After 2 days, data file C and data file D will be cleared, using the TTL information setting of inherited directory a, at which time directory file a itself will not be cleared since it is not empty. After 3 days, directory file B will be cleared due to its own TTL expiration. Directory file B is cleared since the setting of directory file a has expired and directory file a has become an empty directory.
According to the method for clearing the file, the expired file is determined through the TTL information acquired from the file storage system based on the TTL information of the file stored in the file storage system, and the expired file is cleared, so that interaction with the outside is not needed when the file is cleared, a database used for storing the TTL information does not need to be separately deployed, and system maintenance is more convenient. The TTL information is acquired in the thread based on the resident background of the file storage system, so that the complexity of file cleaning is further reduced, the complexity of file cleaning maintenance in the later period is further reduced, and the file cleaning is more convenient and easier to operate.
Based on the same inventive concept, the disclosure also provides a device for clearing files.
FIG. 6 is a block diagram 600 illustrating an apparatus for clearing a file, according to an example embodiment. Referring to fig. 6, an apparatus 600 for removing a file, applied to a file storage system, the apparatus 600 for removing a file includes: an acquisition unit 601, a determination unit 602, and a processing unit 603. Wherein, the obtaining unit 601 is configured to obtain TTL information of a file from a file storage system in which the TTL information is stored. A determining unit 602 configured to determine an expired file according to the TTL information. A processing unit 603 configured to clear expired files.
In an example, the obtaining unit 601 is configured to obtain a file access request indicating to access a target file, and obtain TTL information of the target file in a file storage system. The determining unit 602 is configured to determine an expired file in the target file based on TTL information of the target file.
In one example, the TTL information is stored in the data block where the file storage system inode extended attribute is located; the obtaining unit 601 is configured to scan the data block at a preset time through a thread resident in a background of the file storage system, and obtain TTL information from the data block through scanning.
In one example, the TTL information is stored in an array string and includes one or more of the following information:
information indicating whether a clear file function is turned on; expiration time information; indicating whether to clear the information of the directory file after the directory file is expired when the directory file is empty; and indicating whether the information of the subdirectory file is removed after the subdirectory file is expired or not when the subdirectory file is empty.
In one example, the inode comprises a directory file inode, or the inode comprises: a directory file inode and a subdirectory file inode that belongs to a directory file. The processing unit 603 clears the expired file as follows: when TTL information stored in a directory file index node represents that a directory file is overdue, if the directory file is empty, the directory file is removed; when TTL information stored in the directory file index node represents that the directory file is expired, if the directory file is not empty, the directory file is cleared after the next-level subdirectory file belonging to the directory file is expired and cleared.
In one example, if the expired file includes: a next level of sub-directory files belonging to the directory file; the processing unit 603 clears the expired file as follows: clearing the TTL information stored by the index node based on the file of the next-level subdirectory; or clearing the TTL information of the inherited directory file based on the next level subdirectory file.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
FIG. 7 is a block diagram illustrating an apparatus 700 for clearing files in accordance with an example embodiment. For example, the apparatus 700 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, an exercise device, a personal digital assistant, and the like.
Referring to fig. 7, apparatus 700 may include one or more of the following components: a processing component 702, a memory 704, a power component 706, a multimedia component 708, an audio component 710, an input/output (I/O) interface 712, a sensor component 714, and a communication component 716.
The processing component 702 generally controls overall operation of the device 700, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 702 may include one or more processors 720 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 702 may include one or more modules that facilitate interaction between the processing component 702 and other components. For example, the processing component 702 may include a multimedia module to facilitate interaction between the multimedia component 708 and the processing component 702.
The memory 704 is configured to store various types of data to support operation at the device 700. Examples of such data include instructions for any application or method operating on device 700, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 704 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 706 provides power to the various components of the device 700. The power components 706 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power supplies for the apparatus 700.
The multimedia component 708 includes a screen that provides an output interface between the device 700 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 708 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the device 700 is in an operating mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 710 is configured to output and/or input audio signals. For example, audio component 710 includes a Microphone (MIC) configured to receive external audio signals when apparatus 700 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signal may further be stored in the memory 704 or transmitted via the communication component 716. In some embodiments, audio component 710 also includes a speaker for outputting audio signals.
The I/O interface 712 provides an interface between the processing component 702 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
The sensor assembly 714 includes one or more sensors for providing status assessment of various aspects of the apparatus 700. For example, sensor assembly 714 may detect an open/closed state of device 700, the relative positioning of components, such as a display and keypad of apparatus 700, sensor assembly 714 may also detect a change in position of apparatus 700 or a component of apparatus 700, the presence or absence of user contact with apparatus 700, orientation or acceleration/deceleration of apparatus 700, and a change in temperature of apparatus 700. The sensor assembly 714 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 714 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 714 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 716 is configured to facilitate wired or wireless communication between the apparatus 700 and other devices. The apparatus 700 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 716 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 716 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the apparatus 700 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer readable storage medium comprising instructions, such as the memory 704 comprising instructions, executable by the processor 720 of the device 700 to perform the above-described method is also provided. For example, the non-transitory computer readable storage medium may be a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
It is further understood that the use of "a plurality" in this disclosure means two or more, as other terms are analogous. "and/or" describes the association relationship of the associated objects, meaning that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. The character "/" generally indicates that the former and latter associated objects are in an "or" relationship. The singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It is further to be understood that while operations are depicted in the drawings in a particular order, this is not to be understood as requiring that such operations be performed in the particular order shown or in serial order, or that all illustrated operations be performed, to achieve desirable results. In certain environments, multitasking and parallel processing may be advantageous.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (14)

1. A method for clearing files is applied to a file storage system and comprises the following steps:
acquiring time-to-live (TTL) information of a file from a file storage system, wherein the TTL information is stored in the file storage system;
determining an expired file according to the TTL information;
and clearing the expired file.
2. The method of claim 1, wherein said determining an expired file based on said TTL information comprises:
acquiring a file access request, wherein the file access request indicates to access a target file;
acquiring TTL information of the target file in the file storage system;
and determining the expired file in the target file based on the TTL information of the target file.
3. The method of claim 1 wherein the TTL information is stored in the data block in which the file storage system inode extended attribute is located;
the obtaining of the time-to-live value TTL information of the file from the file storage system includes:
scanning the data block at a preset moment through a thread resident in a background of the file storage system;
and acquiring the TTL information from the data block through the scanning.
4. The method of claim 3, wherein the TTL information is stored in an array string and includes one or more of the following:
information indicating whether a clear file function is turned on;
expiration time information;
indicating whether to clear the information of the directory file after the directory file is expired when the directory file is empty;
and indicating whether the information of the subdirectory file is removed after the subdirectory file is expired or not when the subdirectory file is empty.
5. The method of claim 4, wherein the inode comprises a directory file inode, or wherein the inode comprises: directory file index nodes and subdirectory file index nodes belonging to the directory files;
the clearing the expired file comprises:
when TTL information stored in a directory file index node represents that a directory file is overdue, if the directory file is empty, the directory file is cleared;
when TTL information stored in a directory file index node represents that a directory file is expired, if the directory file is not empty, the directory file is cleared after a next-level subdirectory file belonging to the directory file is expired and cleared.
6. The method of claim 5, wherein if the expired file comprises: a next level subdirectory file belonging to the directory file;
the clearing of the expired file comprises the following steps:
clearing the TTL information stored by the index node based on the next-level subdirectory file; or
And based on the next level subdirectory file inheriting the TTL information of the directory file, clearing.
7. An apparatus for clearing a file, applied to a file storage system, comprising:
an obtaining unit configured to obtain time-to-live (TTL) information of a file from the file storage system, wherein the TTL information is stored in the file storage system;
a determining unit configured to determine an expired file according to the TTL information;
a processing unit configured to clear the expired file.
8. The apparatus of claim 7, wherein the obtaining unit is configured to:
acquiring a file access request, wherein the file access request indicates to access a target file, and acquiring TTL information of the target file in the file storage system;
the determination unit is configured to:
and determining the expired file in the target file based on the TTL information of the target file.
9. The apparatus of claim 7 wherein the TTL information is stored in the data block in which the file storage system inode extended attribute is located;
the acquisition unit is configured to:
scanning the data block at a preset moment through a thread resident in a background of the file storage system;
and acquiring the TTL information from the data block through scanning.
10. The apparatus of claim 9, wherein the TTL information is stored in an array string and includes one or more of the following information:
information indicating whether a clear file function is turned on;
expiration time information;
indicating whether to clear the information of the directory file after the directory file is expired when the directory file is empty;
and indicating whether the information of the subdirectory file is removed after the subdirectory file is expired or not when the subdirectory file is empty.
11. The apparatus of claim 10, wherein the inode comprises a directory file inode, or wherein the inode comprises: directory file index nodes and subdirectory file index nodes belonging to the directory files;
the processing unit clears the expired file in the following way:
when TTL information stored in a directory file index node represents that a directory file is overdue, if the directory file is empty, the directory file is cleared;
when TTL information stored in a directory file index node represents that a directory file is expired, if the directory file is not empty, the directory file is cleared after a next-level subdirectory file belonging to the directory file is expired and cleared.
12. The apparatus of claim 11, wherein if the expired file comprises: a next level subdirectory file belonging to the directory file;
the processing unit clears the expired files in the following way:
clearing the TTL information stored by the index node based on the next-level subdirectory file; or
And based on the next level subdirectory file inheriting the TTL information of the directory file, clearing.
13. An apparatus for clearing a document, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to: performing the method of clearing a file of any of claims 1-6.
14. A non-transitory computer-readable storage medium storing computer-executable instructions that, when executed by a processor, perform the method of any one of claims 1-6.
CN201911008294.1A 2019-10-22 2019-10-22 Method and device for clearing file and storage medium Pending CN110795401A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911008294.1A CN110795401A (en) 2019-10-22 2019-10-22 Method and device for clearing file and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911008294.1A CN110795401A (en) 2019-10-22 2019-10-22 Method and device for clearing file and storage medium

Publications (1)

Publication Number Publication Date
CN110795401A true CN110795401A (en) 2020-02-14

Family

ID=69440950

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911008294.1A Pending CN110795401A (en) 2019-10-22 2019-10-22 Method and device for clearing file and storage medium

Country Status (1)

Country Link
CN (1) CN110795401A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182332A1 (en) * 2002-03-21 2003-09-25 International Business Machines Corporation System and method for designating and deleting expired files
US20080034003A1 (en) * 2006-08-01 2008-02-07 International Business Machines Corporation Efficient non-database file-expiration management for document retention
US7680830B1 (en) * 2005-05-31 2010-03-16 Symantec Operating Corporation System and method for policy-based data lifecycle management
US20130275391A1 (en) * 2012-04-17 2013-10-17 Fusion-Io, Inc. Data Expiry in a Non-Volatile Device
CN107077572A (en) * 2014-10-30 2017-08-18 微软技术许可有限责任公司 Access control based on handle due data

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030182332A1 (en) * 2002-03-21 2003-09-25 International Business Machines Corporation System and method for designating and deleting expired files
US7680830B1 (en) * 2005-05-31 2010-03-16 Symantec Operating Corporation System and method for policy-based data lifecycle management
US20080034003A1 (en) * 2006-08-01 2008-02-07 International Business Machines Corporation Efficient non-database file-expiration management for document retention
US20130275391A1 (en) * 2012-04-17 2013-10-17 Fusion-Io, Inc. Data Expiry in a Non-Volatile Device
CN107077572A (en) * 2014-10-30 2017-08-18 微软技术许可有限责任公司 Access control based on handle due data

Similar Documents

Publication Publication Date Title
US10292004B2 (en) Method, device and medium for acquiring location information
WO2016033955A1 (en) Upgrading method, apparatus and device
RU2633189C2 (en) Method and device to provide compatibility of application for router control of and built-in router software
US10810172B2 (en) Data clearing method, apparatus and storage medium
RU2649936C2 (en) Method and apparatus for connecting external device
US11361586B2 (en) Method for sending warning information, storage medium and terminal
EP3099042A1 (en) Methods and devices for sending cloud card
KR20160077011A (en) Method and apparatus for adjusting operating status of smart home device
CN109388625B (en) Method and device for processing configuration file in multi-distributed file system
CN104462296B (en) File management method and device and terminal
KR20170023750A (en) Method and apparatus for recommending contact information
US10313537B2 (en) Method, apparatus and medium for sharing photo
CN111031177A (en) Screen recording method, device and readable storage medium
RU2642843C2 (en) Method and device for processing recording contacts
JP2017518008A (en) Telephone calling method, device, program and recording medium based on cloud card
CN104850643B (en) Picture comparison method and device
CN106506808B (en) Method and device for prompting communication message
CN108027821B (en) Method and device for processing picture
CN110764847A (en) User information processing method and device, electronic equipment and storage medium
CN107894909B (en) Method, device and storage medium for limiting Activity starting
CN106658412B (en) Positioning method and device
CN110941670B (en) Mark state detection method, device, equipment and storage medium
CN110795401A (en) Method and device for clearing file and storage medium
CN109246322B (en) Information processing method and system
CN109067959B (en) Address book management method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20200214

RJ01 Rejection of invention patent application after publication