CN112527740A - File resource processing method and device, storage medium and electronic equipment - Google Patents

File resource processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112527740A
CN112527740A CN201910878148.8A CN201910878148A CN112527740A CN 112527740 A CN112527740 A CN 112527740A CN 201910878148 A CN201910878148 A CN 201910878148A CN 112527740 A CN112527740 A CN 112527740A
Authority
CN
China
Prior art keywords
original file
file resource
resource
module
resources
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
CN201910878148.8A
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 Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology 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 Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201910878148.8A priority Critical patent/CN112527740A/en
Publication of CN112527740A publication Critical patent/CN112527740A/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/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1748De-duplication implemented within the file system, e.g. based on file segments

Abstract

The invention discloses a file resource processing method and device, a storage medium and electronic equipment. Wherein, the method comprises the following steps: when the original file resource needs to be deleted, acquiring the quantity of hard links pointing to the original file resource, wherein the hard links are created between a processing module for referencing the original file resource and the original file resource; judging whether the number of the hard links is smaller than a preset value or not; if so, the original file resource is deleted. The invention solves the technical problems of increased system cost and reduced processing accuracy caused by processing the file resources in a mode of copying the file resources or adding a resource reference management module in the prior art.

Description

File resource processing method and device, storage medium and electronic equipment
Technical Field
The invention relates to the field of computers, in particular to a file resource processing method and device, a storage medium and electronic equipment.
Background
In daily development needs, the following similar scenarios are often encountered: the system mainly carries out business processing around file resources, and the system can be divided into modules A, B, C. Suppose that the resource originally entered the system is file f0, and after a processing, the output is file f 1. f1 as input to the B module, which processes the output file f2 ….
On the basis, resources used or produced by each module need to support users to independently manage the modules, for example, when a certain processing task in the module a is deleted, the related input and output also need to be deleted synchronously. If the output of the processing task is already used for the B module, the deletion of the content does not influence the correct execution of the related processing task in the B module, and the system does not have residual garbage during operation.
In order to solve the above problem, the following two schemes can be generally adopted: the first scheme is to copy the input resources of each module dependence, and each module manages its dependence; the second solution is to implement a resource reference management module, which is used to manage the dependent resources in each module, and perform garbage cleaning work when a certain resource reference is 0.
However, with the first scheme, since the copied files are consistent in content, copying all input resources occupies a doubled storage space, which results in waste of hard disk resources. By adopting the second scheme, the resource reference management can increase the code coupling of each module, the dependence management difficulty is high, the error probability is high, the garbage cleaning is carried out according to the reference, the accident situation is easy to occur, and the accuracy is reduced.
Aiming at the problems that the system cost is increased and the processing accuracy is reduced because file resources are processed in a mode of copying the file resources or adding a resource reference management module in the related art, an effective solution is not provided at present.
Disclosure of Invention
The embodiment of the invention provides a file resource processing method and device, a storage medium and electronic equipment, which are used for at least solving the technical problems of increased system cost and reduced processing accuracy caused by file resource copying or resource reference management module adding in the related art.
According to an aspect of the embodiments of the present invention, a method for processing file resources is provided, including: when the original file resource needs to be deleted, acquiring the quantity of hard links pointing to the original file resource, wherein the hard links are created between a processing module for referencing the original file resource and the original file resource; judging whether the number of the hard links is smaller than a preset value or not; if so, the original file resource is deleted.
Further, the method further comprises: receiving the uploaded original file resources; storing original file resources; determining a processing module needing to refer to original file resources; a hard link is created for each processing module to point to the original file resource such that the processing module references the original file resource through the hard link.
Further, before storing the original file resource, the method further includes: judging whether the original file resources already exist or not; if not, storing the original file resource; if so, the storage operation on the original file resource is ignored.
Further, determining whether the original file resource already exists comprises: processing original file resources by using a message digest algorithm to obtain a message digest; judging whether the message digest already exists, wherein the file name of each stored file resource comprises the message digest corresponding to the file resource; if so, determining that the original file resource already exists; if not, determining that the original file resource does not exist.
Further, before storing the original file resource, the method further includes: determining a preset position for storing original file resources; storing original file resources, comprising: and storing the original file resource at a preset position.
Further, if the number of hard links is not less than a preset value, the method further comprises: outputting prompt information, wherein the prompt information is used for reminding that the original file resources cannot be deleted; and/or locking and protecting the original file resource so that the deletion operation of the original file resource cannot be executed when the deletion operation of the original file resource is received.
Further, the method further comprises: when detecting that a new processing module needs to refer to the original file resource, automatically creating a hard link of the new processing module pointing to the original file resource; and/or deleting the hard link pointing to the original file resource by the processing module when detecting that the reference relation of the processing module to the original file resource is released.
According to another aspect of the embodiments of the present invention, there is also provided a processing apparatus for file resources, including: the acquisition module is used for acquiring the quantity of hard links pointing to the original file resources when the original file resources need to be deleted, wherein the hard links are created between the processing module for referring to the original file resources and the original file resources; the judging module is used for judging whether the number of the hard links is smaller than a preset value or not; and the deleting module is used for deleting the original file resource if the file resource is the original file resource.
Further, the above apparatus further comprises: the receiving module is used for receiving the uploaded original file resources; the storage module is used for storing original file resources; the determining module is used for determining a processing module which needs to refer to the original file resource; and the creating module is used for creating a hard link of each processing module pointing to the original file resource so that the processing module refers to the original file resource through the hard link.
Further, the judging module is also used for judging whether the original file resource exists; the storage module is also used for storing the original file resource if the original file resource is not stored, and ignoring the storage operation on the original file resource if the original file resource is stored.
Further, the judging module comprises: the processing unit is used for processing the original file resource by using a message digest algorithm to obtain a message digest; the judging unit is used for judging whether the message abstract already exists, wherein the file name of each stored file resource comprises the message abstract corresponding to the file resource; and the determining unit is used for determining that the original file resource already exists if the original file resource exists, and determining that the original file resource does not exist if the original file resource does not exist.
Further, the determining module is further configured to determine a preset location for storing the original file resource; the storage module is also used for storing the original file resource at a preset position.
Further, the above apparatus further comprises: the output module is used for outputting prompt information if the number of the hard links is not less than a preset value, wherein the prompt information is used for reminding that the original file resources cannot be deleted; and/or the locking module is used for locking and protecting the original file resource if the number of the hard links is not less than a preset value, so that the deletion operation of the original file resource cannot be executed when the deletion operation of the original file resource is received.
Further, the above apparatus further comprises: the creating module is used for automatically creating a hard link of the new processing module pointing to the original file resource when detecting that the new processing module needs to refer to the original file resource; and/or the deleting module is further used for deleting the hard link pointing to the original file resource by the processing module when detecting that the reference relation of the processing module to the original file resource is released.
According to another aspect of the embodiments of the present invention, there is also provided a storage medium including a stored program, wherein the program executes the processing method of the file resource described above.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including at least one processor, and at least one memory and a bus connected to the processor; the processor and the memory complete mutual communication through a bus; the processor is used for calling the program instructions in the memory so as to execute the processing method of the file resource.
In the embodiment of the invention, when the original file resource needs to be deleted, the number of the hard links pointing to the original file resource can be acquired, and when the number of the hard links is less than the preset value, the original file resource is deleted, so that the aim of independently managing the file resource by the processing module is fulfilled. Because the hard link is created between the processing module for quoting the original file resource and the original file resource, the original file resource does not need to be copied, and the hard disk resource cannot be occupied by times, thereby solving the technical problems that the file resource is processed in a mode of copying the file resource or adding a resource quoting management module in the related art, the system cost is increased, the processing accuracy is reduced, and the technical effects of saving the hard disk resource, reducing the code coupling degree of each processing module and improving the stability of the system are achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method for processing file resources according to an embodiment of the invention;
FIG. 2 is a schematic diagram of a file resource processing apparatus according to an embodiment of the present invention; and
fig. 3 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some technical features in the embodiments of the present invention are explained as follows:
hard linking: hardlink, which is one or more file names of a file. The file name and the node number used by the computer file system are linked, so that a plurality of file names can be linked with the same file.
MD 5: message Digest Algorithm MD5, the fifth version of the Message Digest Algorithm, operates data (e.g., chinese characters) into another fixed length value, is a widely used hash function in the field of computer security to provide integrity protection for messages.
Example 1
In accordance with an embodiment of the present invention, there is provided a method for processing a file resource, it should be noted that the steps illustrated in the flowchart of the figure may be performed in a computer system such as a set of computer executable instructions, and that while a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 1 is a flowchart of a processing method of a file resource according to an embodiment of the present invention, as shown in fig. 1, the method includes the following steps:
step S102, when the original file resource needs to be deleted, acquiring the quantity of hard links pointing to the original file resource, wherein the hard links are created between the processing module for referring to the original file resource and the original file resource;
step S104, judging whether the number of the hard links is less than a preset value;
and step S106, if so, deleting the original file resource.
In a system for performing business processing mainly around file resources, since the system is divided into a plurality of processing modules in advance, a user needs to be supported to delete file resources that each processing module depends on (also called as references), and since a file resource that one processing module depends on may also be depended on by other processing modules, after deleting the file resource that one processing module depends on according to the requirement of the other processing module, the other processing modules that depend on the file resource cannot work normally. In order to conveniently delete the file resources depended on by a certain processing module and not influence the normal operation of other processing modules related to the certain processing module, the file resources of each processing module are managed by means of the hard links, namely, the file resources are quoted by creating the hard links, and the file resources can still be quoted without copying the file resources. The original file resource may be file data actually stored in the system.
Additionally, based on the nature of the hard link, creating a hard link will increase the reference count of the original file resource, which now has at least one reference count. When the original file resource depended by a certain processing module is deleted, the hard link for referring to the original file resource is deleted, the reference count of the original file resource is reduced, and when the number of the hard links for referring to the original file resource is reduced to 0, the original file resource is referred to by no module in the system, the reference count of the original file resource is 1, and the original file resource is automatically deleted by the system. Therefore, the above preset value may be 1.
For example, the present invention will be described in detail by taking the system divided into two modules, module 1 and module 2. Files stored in the system are f0, f1 and f2, f0 is input into the module 1, and the module 1 outputs f 1; f1 is input into module 2, and module 2 outputs f 2. After the hard links are created, the number of hard links of f0 is 1, the number of hard links of f1 is 2, and the number of hard links of f2 is 1. When file resources f0 and f1 depended on by module 1 need to be deleted, the number of hard links of f0 and f1 can be obtained, at this time, the number of hard links of f0 is reduced to 0 (i.e. the reference count of f0 is reduced to 1), and the number of hard links of f1 is reduced to 1 (i.e. the reference count of f1 is reduced to 2), so that the system can delete file f 0.
By adopting the embodiment of the invention, when the original file resource needs to be deleted, the number of the hard links pointing to the original file resource can be acquired, and when the number of the hard links is less than the preset value, the original file resource is deleted, thereby realizing the purpose that the processing module manages the file resource independently. Because the hard link is created between the processing module for quoting the original file resource and the original file resource, the original file resource does not need to be copied, and the hard disk resource cannot be occupied by times, thereby solving the technical problems that the file resource is processed in a mode of copying the file resource or adding a resource quoting management module in the related art, the system cost is increased, the processing accuracy is reduced, and the technical effects of saving the hard disk resource, reducing the code coupling degree of each processing module and improving the stability of the system are achieved.
Optionally, in the above embodiment of the present invention, the method further includes: receiving the uploaded original file resources; storing original file resources; determining a processing module needing to refer to original file resources; a hard link is created for each processing module to point to the original file resource such that the processing module references the original file resource through the hard link.
When a user uploads or copies an original file resource to the system, the system can store the original file resource, and processing modules needing to refer to the original file resource all create a hard link from the original file resource and share the same data with the original file resource. Thus, the file under this directory has at least one reference count.
Optionally, in the above embodiment of the present invention, before storing the original file resource, the method further includes: judging whether the file name of the original file resource already exists; if not, storing the original file resource; if so, the storage operation on the original file resource is ignored.
Because the original file resources uploaded or copied by the user may be duplicated, the original file resources need to be screened before being stored, and the unrepeated original file resources are stored. The repeated storage of the same file resources can be effectively reduced through the step, so that each same file resource can be stored only by one copy, the file resource is required to be referred, and the hard link is adopted, so that the resource occupation caused by file storage is effectively reduced.
Optionally, in the foregoing embodiment of the present invention, determining whether the original file resource already exists includes: processing original file resources by using a message digest algorithm to obtain a message digest; judging whether the message digest already exists, wherein the file name of each stored file resource comprises the message digest corresponding to the file resource; if so, determining that the original file resource already exists; if not, determining that the original file resource does not exist.
In order to determine whether the original file resource already exists, the content of the original file resource needs to be compared with the content of other existing file resources, which results in a large workload. And only by comparing the file names, the accuracy is reduced because the user can set the file names of the original file resources at will. Therefore, in this embodiment, each original file resource may use MD5 of the file as the file name when being stored, at this time, the file name of the original file resource is related to the content, before the original file resource is stored, it may be determined whether the same name exists, if so, it indicates that the file already exists, and the storage process may be skipped.
Optionally, in the embodiment of the present invention, before storing the original file resource, the method further includes: determining a preset position for storing original file resources; storing original file resources, comprising: and storing the original file resource at a preset position.
In this embodiment, the preset location may be a location dedicated to storing the file resource referenced by each processing module in the system, and may be different from other data storage locations.
When a user uploads or copies an original file resource to the system, the system may store the original file resource in a fixed location as a data record shared by all processing modules in the system.
Optionally, in the above embodiment of the present invention, if the number of hard links is not less than the preset value, the method further includes: outputting prompt information, wherein the prompt information is used for reminding that the original file resources cannot be deleted; and/or locking and protecting the original file resource so that the deletion operation of the original file resource cannot be executed when the deletion operation of the original file resource is received.
In this embodiment, when the number of the hard links is greater than or equal to the preset value, it indicates that there is still a module in the system that refers to the original file resource and cannot be deleted. At this time, in order to avoid the user from performing misoperation, the original file resource is deleted, which affects the normal operation of other processing modules associated with the original file resource, and the original file resource can be protected in various ways. In an optional embodiment, a prompt message may be output to notify the user that the original file resource cannot be deleted, so as to avoid a user misoperation. In another alternative embodiment, the original file resource may be locked so that the user cannot directly delete the original file resource.
Optionally, in the above embodiment of the present invention, when it is detected that a new processing module needs to refer to an original file resource, a hard link pointing to the original file resource by the new processing module is automatically created; and/or deleting the hard link pointing to the original file resource by the processing module when detecting that the reference relation of the processing module to the original file resource is released.
In this embodiment, based on the characteristics of the hard link, when a new outbound module needs to refer to an original file resource, the hard link may be created from a fixed location where the original file resource is stored, and at this time, the number of the hard links of the original file resource is increased by 1, that is, the reference count of the original file resource is increased by 1.
When a user needs to delete a processing task of a certain processing module, the file resource depended by the processing module needs to be deleted, and at the moment, only the created hard link needs to be deleted, and the original file resource does not need to be deleted.
According to the embodiment of the invention, a file resource processing device is provided.
Fig. 2 is a schematic diagram of a file resource processing apparatus according to an embodiment of the present invention, as shown in fig. 2, the apparatus includes: an acquisition module 22, a determination module 24, and a deletion module 26.
The obtaining module 22 is configured to obtain, at the obtaining module, the number of hard links pointing to the original file resource when the original file resource needs to be deleted, where a hard link is created between the processing module referring to the original file resource and the original file resource; the judging module 24 is configured to judge whether the number of the hard links is less than a preset value; the deletion module 26 is used to delete the original file resource if yes.
By adopting the embodiment of the invention, when the original file resource needs to be deleted, the number of the hard links pointing to the original file resource can be acquired, and when the number of the hard links is less than the preset value, the original file resource is deleted, thereby realizing the purpose that the processing module manages the file resource independently. Because the hard link is created between the processing module for quoting the original file resource and the original file resource, the original file resource does not need to be copied, and the hard disk resource cannot be occupied by times, thereby solving the technical problems that the file resource is processed in a mode of copying the file resource or adding a resource quoting management module in the related art, the system cost is increased, the processing accuracy is reduced, and the technical effects of saving the hard disk resource, reducing the code coupling degree of each processing module and improving the stability of the system are achieved.
Optionally, in the above embodiment of the present invention, the apparatus further includes: the device comprises a receiving module, a determining module, a storing module and a creating module.
The receiving module is used for receiving the uploaded original file resources; the storage module is used for storing original file resources; the determining module is used for determining a processing module which needs to refer to the original file resource; the creating module is used for creating a hard link pointing to the original file resource by each processing module so that the processing module refers to the original file resource through the hard link.
Optionally, in the foregoing embodiment of the present invention, the determining module is further configured to determine whether the original file resource already exists; the storage module is also used for storing the original file resource if the original file resource is not stored, and ignoring the storage operation on the original file resource if the original file resource is stored. Optionally, in the foregoing embodiment of the present invention, the determining module includes: the device comprises a processing unit, a judging unit and a determining unit.
The processing unit is used for processing the original file resource by using a message digest algorithm to obtain a message digest; the judging unit is used for judging whether the message digest already exists, wherein the file name of each stored file resource comprises the message digest corresponding to the file resource; the determining unit is used for determining that the original file resource already exists if the original file resource exists, and determining that the original file resource does not exist if the original file resource does not exist.
Optionally, in the above embodiment of the present invention, the determining module is further configured to determine a preset location for storing the original file resource; the storage module is also used for storing the original file resource at a preset position.
Optionally, in the above embodiment of the present invention, the apparatus further includes: an output module and/or a locking module.
The output module is used for outputting prompt information if the number of the hard links is not less than a preset value, wherein the prompt information is used for reminding that the original file resources cannot be deleted; and the locking module is used for locking and protecting the original file resource if the number of the hard links is not less than a preset value, so that the deletion operation of the original file resource cannot be executed when the deletion operation of the original file resource is received.
Optionally, in the above embodiment of the present invention, the apparatus further includes: a module is created.
The creating module is used for automatically creating a hard link of the new processing module pointing to the original file resource when detecting that the new processing module needs to refer to the original file resource; and/or the deleting module is further used for deleting the hard link pointing to the original file resource by the processing module when detecting that the reference relation of the processing module to the original file resource is released.
The file resource processing device comprises a processor and a memory, wherein the acquisition module, the judgment module, the deletion module, the receiving module, the storage module, the determination module, the creation module, the judgment module, the output module, the locking module and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the processing module can manage the file resources independently by adjusting the kernel parameters.
An embodiment of the present invention provides a storage medium, on which a program is stored, and the program implements a processing method of the file resource when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the processing method of the file resource is executed when the program runs.
An embodiment of the present invention provides an electronic device, as shown in fig. 3, the device 30 includes at least one processor 301, at least one memory 302 connected to the processor, and a bus 303; the processor and the memory complete mutual communication through a bus; the processor is used for calling the program instructions in the memory so as to execute the processing method of the file resource. The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform a program for initializing the following method steps when executed on a data processing device:
when the original file resource needs to be deleted, acquiring the quantity of hard links pointing to the original file resource, wherein the hard links are created between a processing module for referencing the original file resource and the original file resource; judging whether the number of the hard links is smaller than a preset value or not; if so, the original file resource is deleted.
Receiving the uploaded original file resources; storing original file resources; determining a processing module needing to refer to original file resources; a hard link is created for each processing module to point to the original file resource such that the processing module references the original file resource through the hard link.
Judging whether the original file resources already exist or not; if not, storing the original file resource; if so, the storage operation on the original file resource is ignored.
Processing original file resources by using a message digest algorithm to obtain a message digest; judging whether the message digest already exists, wherein the file name of each stored file resource comprises the message digest corresponding to the file resource; if so, determining that the original file resource already exists; if not, determining that the original file resource does not exist.
Determining a preset position for storing the original file resource before storing the original file resource; and storing the original file resource at a preset position.
If the number of the hard links is not less than the preset value, outputting prompt information, wherein the prompt information is used for reminding that the original file resources cannot be deleted; and/or locking and protecting the original file resource so that the deletion operation of the original file resource cannot be executed when the deletion operation of the original file resource is received.
When detecting that a new processing module needs to refer to the original file resource, automatically creating a hard link of the new processing module pointing to the original file resource; and/or deleting the hard link pointing to the original file resource by the processing module when detecting that the reference relation of the processing module to the original file resource is released.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a device includes one or more processors (CPUs), memory, and a bus. The device may also include input/output interfaces, network interfaces, and the like.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip. The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A processing method of file resources is characterized by comprising the following steps:
when original file resources need to be deleted, acquiring the quantity of hard links pointing to the original file resources, wherein the hard links are created between a processing module for referencing the original file resources and the original file resources;
judging whether the number of the hard links is smaller than a preset value or not;
and if so, deleting the original file resource.
2. The method of claim 1, further comprising:
receiving the uploaded original file resource;
storing the original file resource;
determining a processing module which needs to refer to the original file resource;
creating a hard link for each of the processing modules to point to the original file resource such that the processing modules reference the original file resource through the hard link.
3. The method of claim 2, wherein prior to storing the original file resource, the method further comprises:
judging whether the original file resources already exist or not;
if not, storing the original file resource;
if so, ignoring the storage operation on the original file resource.
4. The method of claim 3, wherein determining whether the original file resource already exists comprises:
processing the original file resource by using a message digest algorithm to obtain a message digest;
judging whether the message digest already exists, wherein the file name of each stored file resource comprises the message digest corresponding to the file resource;
if so, determining that the original file resource already exists;
if not, determining that the original file resource does not exist.
5. The method of claim 2, wherein prior to storing the original file resource, the method further comprises: determining a preset position for storing the original file resource;
the storing the original file resource comprises:
and storing the original file resource at the preset position.
6. The method of claim 1, wherein if the number of hard links is not less than the preset value, the method further comprises:
outputting prompt information, wherein the prompt information is used for reminding that the original file resource cannot be deleted; and/or the presence of a gas in the gas,
and locking and protecting the original file resource so that the deletion operation of the original file resource cannot be executed when the deletion operation of the original file resource is received.
7. The method of claim 1, further comprising:
when detecting that a new processing module needs to refer to the original file resource, automatically creating a hard link of the new processing module pointing to the original file resource; and/or the presence of a gas in the gas,
and when detecting that the reference relation of the processing module to the original file resource is released, deleting the hard link of the processing module pointing to the original file resource.
8. A file resource processing apparatus, comprising:
the system comprises an acquisition module, a processing module and a processing module, wherein the acquisition module is used for acquiring the number of hard links pointing to original file resources when the original file resources need to be deleted, and the hard links are created between the processing module referring to the original file resources and the original file resources;
the judging module is used for judging whether the number of the hard links is smaller than a preset value or not;
and the deleting module is used for deleting the original file resource if the original file resource is the original file resource.
9. A storage medium characterized by comprising a stored program, wherein the program executes the processing method of a file resource according to any one of claims 1 to 7.
10. An electronic device comprising at least one processor, and at least one memory, bus connected to the processor; the processor and the memory complete mutual communication through the bus; the processor is used for calling the program instructions in the memory to execute the processing method of the file resource in any one of claims 1 to 7.
CN201910878148.8A 2019-09-17 2019-09-17 File resource processing method and device, storage medium and electronic equipment Pending CN112527740A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910878148.8A CN112527740A (en) 2019-09-17 2019-09-17 File resource processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910878148.8A CN112527740A (en) 2019-09-17 2019-09-17 File resource processing method and device, storage medium and electronic equipment

Publications (1)

Publication Number Publication Date
CN112527740A true CN112527740A (en) 2021-03-19

Family

ID=74974827

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910878148.8A Pending CN112527740A (en) 2019-09-17 2019-09-17 File resource processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112527740A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022083A1 (en) * 2005-07-21 2007-01-25 International Business Machines Corporation Method of graphical display of hierarchical hardlinks to files in a file system
CN101079034A (en) * 2006-07-10 2007-11-28 腾讯科技(深圳)有限公司 System and method for eliminating redundancy file of file storage system
CN105468686A (en) * 2015-11-17 2016-04-06 北京奇虎科技有限公司 Method and device for reducing redundant data

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070022083A1 (en) * 2005-07-21 2007-01-25 International Business Machines Corporation Method of graphical display of hierarchical hardlinks to files in a file system
CN101079034A (en) * 2006-07-10 2007-11-28 腾讯科技(深圳)有限公司 System and method for eliminating redundancy file of file storage system
CN105468686A (en) * 2015-11-17 2016-04-06 北京奇虎科技有限公司 Method and device for reducing redundant data

Similar Documents

Publication Publication Date Title
US9645892B1 (en) Recording file events in change logs while incrementally backing up file systems
US11093387B1 (en) Garbage collection based on transmission object models
CN108021590B (en) Target object attribute determining method, attribute updating method and device
CN111240892B (en) Data backup method and device
GB2520361A (en) Method and system for a safe archiving of data
CN107832470A (en) A kind of object storage method and device based on storage system
CN110618974A (en) Data storage method, device, equipment and storage medium
CN114328029B (en) Backup method and device of application resources, electronic equipment and storage medium
CN112230947A (en) Upgrading method and upgrading system of operating system
US10055407B2 (en) Maintaining access control lists in non-identity-preserving replicated data repositories
CN115981574A (en) Snapshot storage method, system, equipment and storage medium
CN109783274B (en) Disk snapshot management method and device and readable storage medium
CN112527740A (en) File resource processing method and device, storage medium and electronic equipment
CN111488117A (en) Method, electronic device, and computer-readable medium for managing metadata
CN111625397B (en) Service log backup method, cluster, device, electronic equipment and storage medium
US11645333B1 (en) Garbage collection integrated with physical file verification
CN110888847B (en) Recycle bin system and file recycling method
CN110059075B (en) Method, device and equipment for migrating database and computer readable medium
JP5972455B2 (en) How to delete information
CN108038028B (en) File backup method and device and file restoration method and device
CN111625402A (en) Data recovery method and device, electronic equipment and computer readable storage medium
CN112699129A (en) Data processing system, method and device
CN112596959A (en) Distributed storage cluster data backup method and device
CN112765129A (en) Method and equipment for realizing database data version management
CN107305582B (en) Metadata processing 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