Image deletion and push method, system, electronic device and storage medium
By obtaining the mirror deletion instructions and the mirror layer composition list, the layer files of the mirror layer are directly deleted, which solves the problem of time-consuming image physical deletion in the existing technology, real-time physical deletion of the mirror and efficient storage resource release.
Patent Information
- Application Number
- CN201910334787.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-04-24
- Publication Date
- 2025-04-15
- Estimated Expiration
- 2039-04-24
AI Technical Summary
In the prior art, using gc to physically delete the mirror in the mirror center takes a long time, affecting the mirror center service.
By obtaining the image deletion instruction and the image layer composition list, the layer files of the image layer are directly deleted, and push information is managed to achieve real-time physical deletion of the image.
Real-time physical deletion of mirrors is realized, saving deletion time, not affecting the service of the mirror center, and avoiding the risk of mistaken deletion.
Smart Images

Figure CN111857939B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of virtualization, and in particular relates to a method, system, electronic device and storage medium for deleting and pushing images. Background Art
[0002] In the era of cloud computing, virtualization technology is the cornerstone of the entire information technology. Virtualization technology can be implemented through hardware simulation or operating system. Docker is a cloud open source project based on the Go language. Its goal is to achieve "package once, run everywhere" at the application component level. That is, virtualized applications are realized through the management of the life cycle of packaging, distribution, deployment and operation of application components. The above application components can be a Web (general term for the Internet) application, a set of database services, or even an operating system or compiler.
[0003] At present, the process of deleting an image from the image center (registry, used to store docker images, including image hierarchy and image source data) currently only deletes the tag corresponding to the image through the sha256 (hash value) of the corresponding layer of the image tag (version information). The actual layer file of the deleted image metadata is not processed and is considered as soft deletion. If you want to physically delete a docker image from the image center, you need to set the registry to read-only mode or stop the registry service after the registry has run for a period of time on the basis of soft deletion, and then run gc (garbage collection mechanism). The gc first scans the metadata layer of all recorded images in the storage directory of the image center, and then scans all the image data layers in the storage directory. Finally, the image data layers that are not in the image center are screened out and deleted, thereby realizing the physical deletion of the image and completely releasing storage space.
[0004] Physical deletion of existing images has the following problems:
[0005] Because push and pull of images are concurrent, if during the process of deleting a layer, another push thread mistakenly believes that the layer already exists and does not upload the layer file, the image pushed by the second thread will not work properly (because the layer is missing) after deleting the first image that needs to be deleted. This requires that the registry service must be stopped or the registry must be set to read-only mode before running gc, that is, the push process (write operations on storage) is prohibited. In addition, because gc is to scan and screen all images in the image center, when the image scale is large enough, gc will be a long process. During this process, it cannot be pushed, and the image center can hardly provide services, which seriously affects the business. Summary of the invention
[0006] The technical problem to be solved by the embodiments of the present invention is to overcome the defects in the prior art that it takes a long time to physically delete images in the image center using GC and affects the image center service, and to provide a method, system, electronic device and storage medium for image deletion and push.
[0007] The embodiment of the present invention solves the above technical problems through the following technical solutions:
[0008] An embodiment of the present invention provides a method for real-time physical deletion of an image, the method comprising:
[0009] Obtaining an image deletion instruction, wherein the image deletion instruction includes marking information of an image to be deleted;
[0010] Obtain an image layer composition list of the image corresponding to the tag information, wherein the image layer composition list includes layer information of the image layers constituting the image;
[0011] Delete the layer file of the image layer corresponding to the layer information.
[0012] Preferably, the marking information includes image version information.
[0013] Preferably, the real-time physical deletion method of the image further comprises:
[0014] After deleting the layer file of the image layer corresponding to the layer information, the image layer composition list is deleted.
[0015] Preferably, the step of deleting the layer file of the image layer corresponding to the layer information specifically includes:
[0016] Obtaining first push information of the image layer corresponding to the layer information, where the first push information includes a first cumulative number of push times of the image layer;
[0017] Calculate the first cumulative number of pushes minus N1, where N1 is the number of the image layer corresponding to the layer information;
[0018] Determine whether the first cumulative number of pushes after deduction is equal to the cumulative initial value. If so, then:
[0019] Deleting the first push information;
[0020] Delete the layer file of the image layer corresponding to the layer information;
[0021] And / or, the step of deleting the image layer composition list specifically includes:
[0022] Obtaining second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list;
[0023] Calculate the second cumulative number of pushes minus N2, where N2 is the number of image layer composition lists;
[0024] Determine whether the second cumulative number of pushes after deduction is equal to the cumulative initial value. If so, then:
[0025] Deleting the second push information;
[0026] Delete the image layer composition list.
[0027] Preferably, the real-time physical deletion method of the image further comprises:
[0028] After acquiring the first push information, locking the first push information to prohibit reading and writing operations on the first push information;
[0029] After calculating the first cumulative number of pushes minus N1, unlocking the first push information to release the prohibition on the read and write operations;
[0030] And / or, the real-time physical deletion method of the image further includes:
[0031] After acquiring the second push information, locking the second push information to prohibit reading and writing operations on the second push information;
[0032] After calculating the second cumulative number of pushes minus N2, the second push information is unlocked to lift the prohibition on the read and write operations.
[0033] Preferably, the real-time physical deletion method of the image further comprises:
[0034] When the first push information is successfully deleted but the layer file is failed to be deleted, traverse the first push information of all image layers and delete the layer file corresponding to the image layer that lacks the first push information;
[0035] And / or, the real-time physical deletion method of the image further includes:
[0036] When the second push information is successfully deleted but the image layer composition list is failed to be deleted, the second push information of all image layer composition lists are traversed, and the image layer composition lists that lack the second push information are deleted.
[0037] Preferably, the image layers constituting the image include: a data layer of the image and a configuration file layer of the image, the data layer includes image data, and the configuration file layer includes image configuration information.
[0038] The embodiment of the present invention also provides a mirror image push method, including:
[0039] Push the layer files that make up the image layer of the image;
[0040] Acquire first push information of the image layer, where the first push information includes a first cumulative number of push times of the image layer;
[0041] Pushing an image layer composition list of the image, wherein the image layer composition list includes layer information of the image layer;
[0042] Obtaining second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list;
[0043] Calculate a new first cumulative number of pushes, where the new first cumulative number of pushes is equal to the first cumulative number of pushes plus N1, where N1 is the number of pushed image layers;
[0044] Calculate a new second cumulative number of pushes, where the new second cumulative number of pushes is equal to the second cumulative number of pushes plus N2, where N2 is the number of the image layer composition list.
[0045] Preferably, the step of obtaining the first push information of the image layer specifically includes:
[0046] Determine whether the first push information of the image layer exists;
[0047] If it exists, obtaining the first push information;
[0048] If not, creating the first push information for the image layer, and setting the first cumulative number of pushes in the first push information to a cumulative initial value;
[0049] And / or, the step of obtaining the second push information of the image layer composition list specifically includes:
[0050] Determine whether the second push information of the image layer composition list exists;
[0051] If it exists, obtaining the second push information;
[0052] If not, creating the second push information for the image layer composition list, and setting the second cumulative push times in the second push information to the cumulative initial value.
[0053] Preferably, the image push method further includes:
[0054] After acquiring the first push information, locking the first push information to prohibit reading and writing operations on the first push information;
[0055] After calculating a new first cumulative number of pushes, unlocking the first push information to lift the prohibition on the read and write operations;
[0056] And / or, the image push method further includes:
[0057] After acquiring the second push information, locking the second push information to prohibit reading and writing operations on the second push information;
[0058] After calculating the new second cumulative number of pushes, the second push information is unlocked to lift the prohibition on the read and write operations.
[0059] The embodiment of the present invention further provides a system for real-time physical deletion of an image, the system comprising:
[0060] An instruction acquisition module, used to acquire an image deletion instruction, wherein the image deletion instruction includes marking information of the image to be deleted;
[0061] A list acquisition module, used to obtain an image layer composition list of the image corresponding to the tag information, wherein the image layer composition list includes layer information of the image layers constituting the image;
[0062] The image deletion module is used to delete the layer file of the image layer corresponding to the layer information.
[0063] Preferably, the marking information includes image version information.
[0064] Preferably, the image real-time physical deletion system further comprises:
[0065] The list deletion module is used to delete the image layer composition list after deleting the layer file of the image layer corresponding to the layer information.
[0066] Preferably, the image deletion module specifically includes:
[0067] A first acquiring unit, configured to acquire first push information of the image layer corresponding to the layer information, wherein the first push information includes a first accumulated number of push times of the image layer;
[0068] A first calculation unit, configured to calculate the first cumulative number of pushes minus N1, where N1 is the number of image layers corresponding to the layer information;
[0069] A first judging unit is configured to judge whether the first cumulative number of pushes after deduction is equal to the cumulative initial value, and if so, firstly delete the first push information and then delete the layer file of the image layer corresponding to the layer information;
[0070] And / or, the list deletion module specifically includes:
[0071] A second acquiring unit, configured to acquire second push information of the image layer composition list, wherein the second push information includes a second accumulated number of push times of the image layer composition list;
[0072] A second calculation unit, used to calculate the second cumulative number of pushes minus N2, where N2 is the number of the image layer composition list;
[0073] The second judgment unit is used to judge whether the second cumulative push number after subtraction is equal to the cumulative initial value, and if so, first delete the second push information and then delete the image layer composition list.
[0074] Preferably, the image real-time physical deletion system further comprises:
[0075] A first locking module, used for locking the first push information after acquiring the first push information, so as to prohibit the reading and writing operations on the first push information;
[0076] The first locking module is further used to unlock the first push information after calculating the first cumulative number of pushes minus N1, so as to lift the prohibition on the read and write operations;
[0077] And / or, the image real-time physical deletion system further includes:
[0078] A second locking module, used for locking the second push information after acquiring the second push information, so as to prohibit the reading and writing operations on the second push information;
[0079] The second locking module is further used to unlock the second push information after calculating the second cumulative number of pushes minus N2, so as to lift the prohibition on the read and write operations.
[0080] Preferably, the image real-time physical deletion system further comprises:
[0081] An image optimization and deletion module, configured to traverse the first push information of all image layers and delete the layer files corresponding to the image layers lacking the first push information when the first push information is successfully deleted but the layer files are failed to be deleted;
[0082] And / or, the image real-time physical deletion system further includes:
[0083] The list optimization and deletion module is used to traverse the second push information of all image layer composition lists and delete the image layer composition lists that lack the second push information when the second push information is successfully deleted but the image layer composition list is failed to be deleted.
[0084] Preferably, the image layers constituting the image include: a data layer of the image and a configuration file layer of the image, the data layer includes image data, and the configuration file layer includes image configuration information.
[0085] The embodiment of the present invention also provides an image push system, including:
[0086] A first push module, used to push layer files constituting the image layer of the image;
[0087] The first acquisition module is used to acquire the first push information of the image layer, wherein the first push information includes the first cumulative number of pushes of the image layer
[0088] A second push module is used to push the image layer composition list of the image, where the image layer composition list includes layer information of the image layer;
[0089] A second acquisition module is used to acquire second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list;
[0090] A first calculation module is used to calculate a new first cumulative number of pushes, where the new first cumulative number of pushes is equal to the first cumulative number of pushes plus N1, where N1 is the number of pushed image layers;
[0091] The second calculation module is used to calculate a new second cumulative push count, where the new second cumulative push count is equal to the second cumulative push count plus N2, where N2 is the number of the image layer composition list.
[0092] Preferably, the first acquisition module is specifically used for:
[0093] Determine whether the first push information of the image layer exists;
[0094] If it exists, obtaining the first push information;
[0095] If not, creating the first push information for the image layer, and setting the first cumulative number of pushes in the first push information to a cumulative initial value;
[0096] And / or, the second acquisition module is specifically used for:
[0097] Determine whether the second push information of the image layer composition list exists;
[0098] If it exists, obtaining the second push information;
[0099] If not, creating the second push information for the image layer composition list, and setting the second cumulative push times in the second push information to the cumulative initial value.
[0100] Preferably, the image push system further includes:
[0101] A third locking module, configured to lock the first push information after acquiring the first push information, so as to prohibit the reading and writing operations on the first push information;
[0102] The third locking module is further used to unlock the first push information after calculating a new first cumulative number of pushes, so as to lift the prohibition on the read and write operations;
[0103] And / or, the image push system further includes:
[0104] a fourth locking module, configured to lock the second push information after acquiring the second push information, so as to prohibit the reading and writing operations on the second push information;
[0105] The fourth locking module is further configured to unlock the second push information after calculating a new second cumulative number of pushes, so as to lift the prohibition on the read and write operations.
[0106] An embodiment of the present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the image real-time physical deletion method or the image push method as described above is implemented.
[0107] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the program implements the steps of the above-mentioned image real-time physical deletion method or the above-mentioned image push method.
[0108] On the basis of being in accordance with the common sense in the art, the above-mentioned preferred conditions can be arbitrarily combined to obtain the preferred embodiments of the present invention.
[0109] The positive progress effect of the embodiments of the present invention is that some embodiments of the present invention obtain the image layer composition list of the image through the marking information of the image and delete the layer files of the image layer included in the image composition list, thereby realizing real-time physical deletion of the image. Compared with running GC, it saves a lot of time and does not affect the service of the image center; further, the version information of the image is also used to uniquely and definitively delete the image to avoid the huge mistake of accidental deletion; further, the push information of the image layer / image composition list is managed, and it is determined whether to delete the layer file / image composition list of the image layer according to the cumulative number of pushes, thereby avoiding the deletion of the layer file / image composition list and causing other images that are not specified to be deleted to be unusable.
[0110] Some embodiments of the present invention optimize the image push method by performing statistical management on the push information of the image layer / image layer composition list after the image layer / image layer composition list is pushed, which can be coordinated with the real-time physical deletion of the image to provide a basis for image deletion. BRIEF DESCRIPTION OF THE DRAWINGS
[0111] Figure 1 This is a flowchart of an image push method according to Embodiment 1 of the present invention;
[0112] Figure 2 This is a flowchart of an image push method according to Embodiment 2 of the present invention;
[0113] Figure 3 This is a flowchart of an image push method according to Embodiment 3 of the present invention;
[0114] Figure 4 This is a flow chart of a method for real-time physical deletion of an image according to Embodiment 4 of the present invention;
[0115] Figure 5 This is a flow chart of a method for real-time physical deletion of an image according to Embodiment 5 of the present invention;
[0116] Figure 6 This is a flow chart of a method for real-time physical deletion of an image according to Embodiment 6 of the present invention;
[0117] Figure 7 This is a schematic block diagram of an image push system according to Embodiment 7 of the present invention;
[0118] Figure 8 This is a schematic block diagram of a system for real-time physical deletion of an image according to Embodiment 8 of the present invention;
[0119] Fig. 9 This is a schematic diagram of the structure of an electronic device according to Embodiment 9 of the present invention. DETAILED DESCRIPTION
[0120] The present invention is further described below by way of examples, but the present invention is not limited to the scope of the examples.
[0121] Example 1
[0122] This embodiment provides a mirror push method. Figure 1 As shown, the image push method includes:
[0123] Step 110: Push the layer files that make up the image layer of the image.
[0124] Step 120: Obtain first push information of the image layer, where the first push information includes a first cumulative number of push times of the image layer.
[0125] Step 130: Push the image layer composition list of the image, where the image layer composition list includes layer information of the image layer.
[0126] Step 140: Obtain second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list.
[0127] Step 150: Calculate a new first cumulative number of pushes, where the new first cumulative number of pushes is equal to the first cumulative number of pushes plus N1, where N1 is the number of pushed image layers.
[0128] Step 160: Calculate a new second cumulative push count, where the new second cumulative push count is equal to the second cumulative push count plus N2, where N2 is the number of the image layer composition list.
[0129] Usually, a complete image includes several image layers and an image layer composition list, wherein the several image layers include several data layers (such as the blob layer of the image based on docker) and a configuration file layer (such as the config layer of the image based on docker), the data layer includes image data, and the configuration file layer includes image configuration information. The image layer composition list is equivalent to the image index (such as the manifest layer of the image based on docker). When pushing the image to the image center, the order of pushing the image layer and the image layer composition list is usually as described in the process of this embodiment, first push the image layer, then push the image layer composition list, and only after the image composition list is successfully pushed, it means that a complete image has been successfully pushed. Based on the consideration of the order of pushing the image, this embodiment deliberately calculates the new first cumulative push count and the second cumulative push count after the image layer and the image layer composition list are successfully pushed to the image center, so that the values of the first cumulative push count and the second cumulative push count can truly and accurately reflect the push counts of the image layer and the image layer composition list in the image center. Of course, if an error occurs during the image push process, the image needs to be pushed again.
[0130] The first push information and the second push information can be stored in a database inserted into the mirror center, and the database can be used to store and manage the push information, accumulate the number of pushes, facilitate information query, and improve query efficiency.
[0131] This embodiment optimizes the push method of the image by performing statistical management on the first push information of the image layer and the second push information of the image layer composition list after the layer file and the image composition list of the image layer are pushed, especially updating and calculating the first cumulative push number of the image layer and the second cumulative push number of the image layer composition list.
[0132] Example 2
[0133] This embodiment is a further improvement on the image push method of embodiment 1, and optimizes the acquisition of push information. Figure 2 As shown, the image push method of this embodiment is basically the same as that of embodiment 1, except that:
[0134] In the image push method of this embodiment, step 120 specifically includes:
[0135] Step 1201: Determine whether the first push information of the image layer exists. If yes, execute step 1202; if no, execute step 1203.
[0136] Step 1202: Obtain the first push information, and then execute step 130.
[0137] Step 1203: Create the first push information for the image layer, set the first cumulative number of pushes in the first push information to a cumulative initial value, and then execute step 130.
[0138] Step 140 in this embodiment specifically includes:
[0139] Step 1401: Determine whether the second push information of the image layer composition list exists. If so, execute step 1402; if not, execute step 1403.
[0140] Step 1402: Obtain the second push information, and then execute step 150.
[0141] Step 1403: Create the second push information for the image layer composition list, set the second cumulative push count in the second push information to the cumulative initial value, and then execute step 150.
[0142] In this embodiment, the first cumulative push count and the second cumulative push count are the accumulation of the cumulative initial value, that is, when the layer file of the image layer or the image layer composition list is pushed for the first time, the first cumulative push count of the image layer or the second cumulative push count of the image layer composition list is equal to the cumulative initial value, and the cumulative initial value can be set to -1, 0, 1 or any other value as required. In the continuous push of different images, the first cumulative push count of the same image layer and the second cumulative push count of the same image composition list are constantly increasing.
[0143] Of course, in other embodiments, in order to simplify the process or other needs, the image push method can also only use steps 1201-1203 to implement step 120, or only use steps 1401-1403 to implement step 140, so as to optimize only one of step 120 or step 140.
[0144] Example 3
[0145] This embodiment is a further improvement on the image push method of embodiment 1, and optimizes the modification of push information. Figure 3 As shown, the image push method of this embodiment is basically the same as that of embodiment 1, except that the image push method in this embodiment further includes:
[0146] Step 121 is inserted after step 120: locking the first push information to prohibit reading and writing operations on the first push information.
[0147] Step 151 is inserted after step 150: unlocking the first push information to lift the prohibition on the read and write operations.
[0148] The image push method in this embodiment also includes:
[0149] Step 141 is inserted after step 140: locking the second push information to prohibit reading and writing operations on the second push information.
[0150] Step 161 is inserted after step 160: unlocking the second push information to lift the prohibition on the read and write operations.
[0151] In this embodiment, the first push information and the second push information are locked and unlocked, so that other users can be prevented from performing read and write operations on the first push information and the second push information when calculating the new first cumulative push number and the new second cumulative push number. For the first push information and the second push information stored in the database, a row-level read-write lock can be added to the first push information and the second push information, and locking and unlocking operations can be performed.
[0152] Of course, in other embodiments, in order to simplify the process or other requirements, the mirror push method can also selectively use only steps 121 and 151 to add or remove the lock on the first push information, or only use steps 141-161 to add or remove the lock on the second push information. In addition, in this embodiment or the other embodiments mentioned above, step 120 can be further implemented by steps 1201-1203 in embodiment 2, and step 140 can be further implemented by steps 1401-1403 in embodiment 2 to achieve better technical effects.
[0153] Example 4
[0154] Figure 4 A method for real-time physical deletion of an image in this embodiment is shown. The method for real-time physical deletion of an image includes:
[0155] Step 210: Obtain an image deletion instruction, where the image deletion instruction includes marking information of the image to be deleted.
[0156] Step 220: Obtain an image layer composition list of the image corresponding to the mark information, wherein the image layer composition list includes layer information of the image layers constituting the image.
[0157] Step 230: Delete the layer file of the image layer corresponding to the layer information.
[0158] Usually, a complete image includes several image layers and an image layer composition list, wherein the several image layers include several data layers (such as blob layers of images based on Docker) and a configuration file layer (such as config layer of images based on Docker), the data layer includes image data, and the configuration file layer includes image configuration information. The image layer composition list is equivalent to the image index (such as the manifest layer of images based on Docker).
[0159] This embodiment implements physical deletion of the image without running GC through the above steps, which greatly saves deletion time, does not affect the services of the image center, and can achieve real-time physical deletion of the image.
[0160] Example 5
[0161] This embodiment is a further improvement on the image real-time physical deletion method of embodiment 4. The specific improvement is that: the marking information includes the image version information. Figure 5 As shown, the real-time physical deletion method of the image in this embodiment is basically the same as that in Embodiment 4, except that:
[0162] Step 210 specifically includes step 2101: obtaining an image deletion instruction, where the image deletion instruction includes image version information of the image to be deleted, such as image layer tag field information based on Docker.
[0163] Step 220 specifically includes step 2201: obtaining an image layer composition list of the image corresponding to the image version information, wherein the image layer composition list includes layer information of the image layers constituting the image.
[0164] It should be noted that what is usually used to distinguish image layers in the image center is the digest field information (i.e., the sha256 code (hash value) of the image layer composition list of the image), and images with the same image name and the same digest field information may have different tag field information. These tag field information share the same digest field information. When technicians in this field routinely delete the image layer composition list corresponding to the digest field information, all image layers corresponding to the tag field information of the same digest field information will be deleted, causing major mistakes. To address this problem, this embodiment includes the tag field information of the image to be deleted in the image deletion instruction, and obtains and reads the image layer composition list through the tag field information. Of course, the content included in the image deletion instruction is not limited to this, and the image deletion instruction can also include the image name of the image to be deleted.
[0165] Example 6
[0166] This embodiment is a further improvement on embodiment 4. The deletion of the layer files of the image layer is optimized. Figure 6 As shown, the real-time physical deletion method of the image in this embodiment is basically the same as that in Embodiment 4, except that:
[0167] In the real-time physical deletion method of an image in this embodiment, step 230 specifically includes:
[0168] Step 2301: Obtain first push information of the image layer corresponding to the layer information, where the first push information includes a first accumulated number of push times of the image layer.
[0169] Step 2302: Calculate the first cumulative number of pushes minus N1, where N1 is the number of the image layer corresponding to the layer information.
[0170] Step 2303: Determine whether the first cumulative number of pushes after deduction is equal to the cumulative initial value. If so, execute step 2304; otherwise, only update the first cumulative number of pushes without executing subsequent deletion operations.
[0171] Step 2304: Delete the first push information.
[0172] Step 2305: Delete the layer file of the image layer corresponding to the layer information.
[0173] In addition, in this embodiment, the image real-time physical deletion method further includes deleting the image layer composition list after step 230. The step of deleting the image layer composition list specifically includes:
[0174] Step 2401: Obtain second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list.
[0175] Step 2402: Calculate the second cumulative number of pushes minus N2, where N2 is the number of the image layer composition list.
[0176] Step 2403: Determine whether the second cumulative number of pushes after deduction is equal to the cumulative initial value. If so, execute step 2404; otherwise, only update the first cumulative number of pushes without executing subsequent deletion operations.
[0177] Step 2404: Delete the second push information.
[0178] Step 2405: Delete the image layer composition list.
[0179] The first push information and the second push information can be generated after the image layer and the image layer composition list are pushed to the image center. For the description of the first push information and the second push information, please refer to Examples 1-3, which will not be repeated here. The first push information and the second push information can be stored in a database inserted into the image center. The database can be used to store and manage the push information, calculate the cumulative number of pushes, facilitate information query, and improve query efficiency.
[0180] In this embodiment, the first cumulative number of pushes / the second cumulative number of pushes rolls back to the cumulative initial value, indicating that the layer file / image layer composition list of the corresponding image layer is no longer used by any image. In this case, the corresponding push information and the layer file / image layer composition list of the image layer can be safely deleted without affecting other images.
[0181] In addition, this embodiment also specifically deletes the layer file of the image layer corresponding to the layer information after deleting the first push information, and deletes the image composition list after deleting the second push information, which can facilitate the rollback operation when an error occurs in deleting the push information.
[0182] In addition, in this embodiment, the real-time physical deletion method of the image further includes:
[0183] After step 2301, the first push information is locked to prohibit reading and writing operations on the first push information.
[0184] After step 2302, the first push information is unlocked to lift the prohibition on the read and write operations.
[0185] The real-time physical deletion method of the image also includes:
[0186] After step 2401, the second push information is locked to prohibit reading and writing operations on the second push information.
[0187] After step 2402, the second push information is unlocked to lift the prohibition on the read and write operations.
[0188] In this embodiment, the first push information and the second push information are locked and unlocked, so that other users can be prevented from performing read and write operations on the first push information and the second push information when calculating the new first cumulative push number and the new second cumulative push number. For the first push information and the second push information stored in the database, a row-level read-write lock can be added to the first push information and the second push information, and locking and unlocking operations can be performed.
[0189] In order to achieve real deletion of the image layer and avoid image layer deletion failure, the image real-time physical deletion method also includes:
[0190] When the first push information is successfully deleted but the layer file is failed to be deleted, the first push information of all image layers is traversed, and the layer files corresponding to the image layers that lack the first push information are deleted.
[0191] Similarly, in order to truly delete the image layer composition list and avoid the failure of deleting the image layer composition list, the image real-time physical deletion method also includes:
[0192] When the second push information is successfully deleted but the image layer composition list is failed to be deleted, the second push information of all image layer composition lists are traversed, and the image layer composition lists that lack the second push information are deleted.
[0193] Specifically, the database storing the first push information and the second push information can be traversed by gc, and the layer files corresponding to the image layer lacking the first push information and the image layer composition list lacking the second push information in the database can be deleted in the image center. As an auxiliary means of image physical deletion, gc can delete the erroneous files by traversing the database instead of traversing the entire file system, which can not only ensure the accuracy of image physical deletion, but also improve the timeliness of gc deleting image files.
[0194] Of course, in other embodiments, in order to simplify the process or other requirements, the real-time physical deletion method of the image can also selectively only lock or unlock the first push information, or only lock or unlock the second push information. In addition, in this embodiment or the other embodiments mentioned above, step 210 can be further implemented by step 2101 in embodiment 5, and step 220 can be further implemented by step 2201 in embodiment 5 to achieve better technical effects.
[0195] Example 7
[0196] This embodiment provides a mirror push system. Figure 7 As shown, the image push system includes: a first push module 310 , a first acquisition module 320 , a second push module 330 , a second acquisition module 340 , a first calculation module 350 and a second calculation module 360 .
[0197] The first push module 310 is used to push layer files of the image layer that constitutes the image.
[0198] The first acquisition module 320 is used to acquire first push information of the image layer, where the first push information includes a first accumulated number of push times of the image layer.
[0199] The second pushing module 330 is used to push the image layer composition list of the image, where the image layer composition list includes layer information of the image layer.
[0200] The second acquisition module 340 is used to acquire second push information of the image layer composition list, where the second push information includes a second accumulated number of push times of the image layer composition list.
[0201] The first calculation module 350 is used to calculate a new first cumulative number of pushes, where the new first cumulative number of pushes is equal to the first cumulative number of pushes plus N1, where N1 is the number of pushed image layers.
[0202] The second calculation module 360 is used to calculate a new second cumulative push count, where the new second cumulative push count is equal to the second cumulative push count plus N2, where N2 is the number of the image layer composition list.
[0203] Usually, a complete image includes several image layers and an image layer composition list, wherein the several image layers include several data layers (such as the blob layer of the image based on docker) and a configuration file layer (such as the config layer of the image based on docker), the data layer includes image data, and the configuration file layer includes image configuration information. The image layer composition list is equivalent to the image index (such as the manifest layer of the image based on docker). When pushing the image to the image center, the order of pushing the image layer and the image layer composition list is usually that the first push module 310 pushes the image layer first, and then the second push module 330 pushes the image layer composition list. Only after the image composition list is successfully pushed, it indicates that a complete image has been successfully pushed. Based on the consideration of the order of pushing the image, this embodiment specifically calculates the new first cumulative push count and the second cumulative push count after the image layer and the image layer composition list are successfully pushed to the image center, so that the values of the first cumulative push count and the second cumulative push count can truly and accurately reflect the push counts of the image layer and the image layer composition list in the image center. Of course, if an error occurs during the image push process, the image needs to be pushed again.
[0204] The first push information and the second push information can be stored in a database inserted into the mirror center, and the database can be used to store and manage the push information, accumulate the number of pushes, facilitate information query, and improve query efficiency.
[0205] This embodiment optimizes the push system of the image by performing statistical management on the first push information of the image layer and the second push information of the image layer composition list after the layer file and the image composition list of the image layer are pushed, especially updating and calculating the first cumulative push number of the image layer and the second cumulative push number of the image layer composition list.
[0206] In order to optimize the acquisition of push information, the first acquisition module 320 of this embodiment can be specifically used for:
[0207] Determine whether the first push information of the image layer exists;
[0208] If it exists, obtaining the first push information;
[0209] If not, creating the first push information for the image layer, and setting the first cumulative push times in the first push information to a cumulative initial value.
[0210] The second acquisition module 340 may be specifically used for:
[0211] Determine whether the second push information of the image layer composition list exists;
[0212] If it exists, obtaining the second push information;
[0213] If not, creating the second push information for the image layer composition list, and setting the second cumulative push times in the second push information to the cumulative initial value.
[0214] In this embodiment, the first cumulative push count and the second cumulative push count are the accumulation of the cumulative initial value, that is, when the layer file of the image layer or the image layer composition list is pushed for the first time, the first cumulative push count of the image layer or the second cumulative push count of the image layer composition list is equal to the cumulative initial value, and the cumulative initial value can be set to -1, 0, 1 or any other value as required. In the continuous push of different images, the first cumulative push count of the same image layer and the second cumulative push count of the same image composition list are constantly increasing.
[0215] Of course, in other embodiments, in order to simplify the system or for other requirements, the image push system may also optimize only one of the first acquisition module 320 or the second acquisition module 340 .
[0216] In order to optimize the modification of the push information, the image push system may further include: a third lock module 370 and a fourth lock module 380 .
[0217] The third lock module 370 is used to lock the first push information after acquiring the first push information, so as to prohibit the read and write operations on the first push information. The third lock module is also used to unlock the first push information after calculating a new first cumulative number of pushes, so as to lift the prohibition on the read and write operations.
[0218] The fourth lock module 380 is used to lock the second push information after acquiring the second push information, so as to prohibit the read and write operations on the second push information. The fourth lock module is also used to unlock the second push information after calculating a new second cumulative number of pushes, so as to lift the prohibition on the read and write operations.
[0219] In this embodiment, the first push information and the second push information are locked and unlocked, so that other users can be prevented from performing read and write operations on the first push information and the second push information when calculating the new first cumulative push number and the new second cumulative push number. For the first push information and the second push information stored in the database, a row-level read-write lock can be added to the first push information and the second push information, and locking and unlocking operations can be performed.
[0220] Of course, in other embodiments, in order to simplify the system or other requirements, the image push system can also selectively use only the third lock module 370 to lock or unlock the first push information, or only use the fourth lock module 380 to lock or unlock the second push information.
[0221] Example 8
[0222] Figure 8 The embodiment of the present invention shows a real-time physical deletion system for an image, which includes: an instruction acquisition module 410 , a list acquisition module 420 and an image deletion module 430 .
[0223] The instruction acquisition module 410 is used to acquire an image deletion instruction, where the image deletion instruction includes tag information of an image to be deleted.
[0224] The list acquisition module 420 is used to obtain an image layer composition list of the image corresponding to the mark information, where the image layer composition list includes layer information of the image layers constituting the image.
[0225] The image deletion module 430 is used to delete the layer file of the image layer corresponding to the layer information.
[0226] This embodiment uses the above modules to achieve physical deletion of the image without running GC, which greatly saves the deletion time, does not affect the services of the image center, and can achieve real-time physical deletion of the image.
[0227] In this embodiment, the tag information may specifically include image version information. The instruction acquisition module 410 acquires an image deletion instruction, and the image deletion instruction includes the image version information of the image to be deleted, such as the image layer tag field information based on Docker. The list acquisition module 420 acquires the image layer composition list of the image corresponding to the image version information, and the image layer composition list includes the layer information of the image layer constituting the image.
[0228] It should be noted that what is usually used to distinguish image layers in the image center is the digest field information (i.e., the sha256 code (hash value) of the image layer composition list of the image), and images with the same image name and the same digest field information may have different tag field information. These tag field information share the same digest field information. When technicians in this field routinely delete the image layer composition list corresponding to the digest field information, all image layers corresponding to the tag field information of the same digest field information will be deleted, causing major mistakes. To address this problem, this embodiment includes the tag field information of the image to be deleted in the image deletion instruction, and obtains and reads the image layer composition list through the tag field information. Of course, the content included in the image deletion instruction is not limited to this, and the image deletion instruction can also include the image name of the image to be deleted.
[0229] In order to optimize the deletion of layer files of the image layer, the image deletion module 430 specifically includes: a first acquisition unit 4301 , a first calculation unit 4302 and a first judgment unit 4303 .
[0230] The first acquisition unit 4301 is used to acquire first push information of the image layer corresponding to the layer information, where the first push information includes a first accumulated number of push times of the image layer;
[0231] The first calculation unit 4302 is used to calculate the first cumulative number of pushes minus N1, where N1 is the number of the image layer corresponding to the layer information;
[0232] The first determining unit 4303 is used to determine whether the first cumulative number of pushes after subtraction is equal to the cumulative initial value. If so, firstly delete the first push information and then delete the layer file of the image layer corresponding to the layer information.
[0233] In addition, in this embodiment, the image real-time physical deletion system further includes: a list deletion module 440 .
[0234] The list deletion module 440 is used to delete the image layer composition list after deleting the layer file of the image layer corresponding to the layer information. The list deletion module 440 may specifically include: a second acquisition unit 4401, a second calculation unit 4402 and a second judgment unit 4403.
[0235] The second acquiring unit 4401 is used to acquire second push information of the image layer composition list, where the second push information includes a second accumulated number of push times of the image layer composition list.
[0236] The second calculation unit 4402 is used to calculate the second cumulative number of push times minus N2, where N2 is the number of the image layer composition list.
[0237] The second determining unit 4403 is used to determine whether the subtracted second cumulative number of pushes is equal to the cumulative initial value. If so, first delete the second push information and then delete the image layer composition list.
[0238] The first push information and the second push information may be generated after the image layer and the image layer composition list are pushed to the image center. For the description of the first push information and the second push information, please refer to Example 7, which will not be repeated here. The first push information and the second push information may be stored in a database inserted into the image center, and the database is used to store and manage the push information, calculate the cumulative number of pushes, facilitate information query, and improve query efficiency.
[0239] In this embodiment, the first cumulative number of pushes / the second cumulative number of pushes rolls back to the cumulative initial value, indicating that the layer file / image layer composition list of the corresponding image layer is no longer used by any image. In this case, the corresponding push information and the layer file / image layer composition list of the image layer can be safely deleted without affecting other images.
[0240] In addition, this embodiment also specifically deletes the layer file of the image layer corresponding to the layer information after deleting the first push information, and deletes the image composition list after deleting the second push information, which can facilitate the rollback operation when an error occurs in deleting the push information.
[0241] In addition, in this embodiment, the image real-time physical deletion system further includes: a first lock module 450 and a second lock module 460 .
[0242] The first lock module 450 is used to lock the first push information after acquiring the first push information, so as to prohibit the read and write operations on the first push information. The first lock module 450 is also used to unlock the first push information after calculating the first cumulative number of pushes minus N1, so as to lift the prohibition on the read and write operations;
[0243] The second lock module 460 is used to lock the second push information after acquiring the second push information, so as to prohibit the read and write operations on the second push information. The second lock module 460 is also used to unlock the second push information after calculating the second cumulative number of pushes minus N2, so as to lift the prohibition on the read and write operations.
[0244] In this embodiment, the first push information and the second push information are locked and unlocked, so that other users can be prevented from performing read and write operations on the first push information and the second push information when calculating the new first cumulative push number and the new second cumulative push number. For the first push information and the second push information stored in the database, a row-level read-write lock can be added to the first push information and the second push information, and locking and unlocking operations can be performed.
[0245] In order to achieve real deletion of the image layer and avoid image layer deletion failure, the image real-time physical deletion system also includes: an image optimization deletion module 470.
[0246] The image optimization and deletion module 470 is used to traverse the first push information of all image layers and delete the layer files corresponding to the image layers that lack the first push information when the first push information is successfully deleted but the layer files are failed to be deleted.
[0247] Similarly, in order to truly delete the image layer composition list and avoid the image layer composition list deletion failure, the image real-time physical deletion system further includes: a list optimization deletion module 480.
[0248] The list optimization and deletion module 480 is used for traversing the second push information of all image layer composition lists and deleting the image layer composition lists that lack the second push information when the second push information is successfully deleted but the image layer composition list is failed to be deleted.
[0249] Specifically, the database storing the first push information and the second push information can be traversed by gc, and the layer files corresponding to the image layer lacking the first push information and the image layer composition list lacking the second push information in the database can be deleted in the image center. As an auxiliary means of image physical deletion, gc can delete the erroneous files by traversing the database instead of traversing the entire file system, which can not only ensure the accuracy of image physical deletion, but also improve the timeliness of gc deleting image files.
[0250] Of course, in other embodiments, in order to simplify the system or for other needs, the image real-time physical deletion system may selectively only lock or unlock the first push information, or only lock or unlock the second push information.
[0251] Example 9
[0252] Fig. 9 A schematic diagram of the structure of an electronic device provided in Embodiment 9 of the present invention. The electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the program, the image push method of Embodiments 1-3 or the image real-time physical deletion method of Embodiments 4-6 is implemented. Fig. 9The electronic device 50 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0253] like Fig. 9 As shown, the electronic device 50 may be in the form of a general-purpose computing device, for example, it may be a server device. The components of the electronic device 50 may include, but are not limited to: at least one processor 51, at least one memory 52, and a bus 53 connecting different system components (including the memory 52 and the processor 41).
[0254] The bus 53 includes a data bus, an address bus, and a control bus.
[0255] The memory 52 may include a volatile memory, such as a random access memory (RAM) 521 and / or a cache memory 522 , and may further include a read-only memory (ROM) 523 .
[0256] The memory 52 may also include a program / utility 525 having a set (at least one) of program modules 524, such program modules 524 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.
[0257] The processor 51 executes various functional applications and data processing by running the computer programs stored in the memory 52, such as the image push method of embodiments 1-3 of the present invention or the image real-time physical deletion method of embodiments 4-6.
[0258] The electronic device 50 may also communicate with one or more external devices 54 (e.g., keyboards, pointing devices, etc.). Such communication may be performed via an input / output (I / O) interface 55. Furthermore, the model generating device 50 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 56. Fig. 9 As shown, the network adapter 56 communicates with other modules of the model-generated device 50 via the bus 53. It should be understood that, although not shown in the figure, other hardware and / or software modules can be used in conjunction with the model-generated device 50, including but not limited to: microcode, device drivers, redundant processors, external disk drive arrays, RAID (disk array) systems, tape drives, and data backup storage systems, etc.
[0259] It should be noted that although several units / modules or sub-units / modules of the electronic device are mentioned in the above detailed description, this division is merely exemplary and not mandatory. In fact, according to an embodiment of the present invention, the features and functions of two or more units / modules described above can be embodied in one unit / module. Conversely, the features and functions of one unit / module described above can be further divided into multiple units / modules to be embodied.
[0260] Example 10
[0261] This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps of the image push method of embodiments 1-3 or the image real-time physical deletion method of embodiments 4-6 are implemented.
[0262] The readable storage medium may include but is not limited to: a portable disk, a hard disk, a random access memory, a read-only memory, an erasable programmable read-only memory, an optical storage device, a magnetic storage device or any suitable combination of the above.
[0263] In a possible implementation manner, the present invention can also be implemented in the form of a program product, which includes a program code. When the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps in the image push method of embodiments 1-3 or the image real-time physical deletion method of embodiments 4-6.
[0264] The program code for executing the present invention may be written in any combination of one or more programming languages, and may be executed entirely on a user device, partially on a user device, as an independent software package, partially on a user device and partially on a remote device, or entirely on a remote device.
[0265] Although the specific embodiments of the present invention are described above, those skilled in the art should understand that these are only examples, and the protection scope of the present invention is defined by the appended claims. Those skilled in the art may make various changes or modifications to these embodiments without departing from the principles and essence of the present invention, but these changes and modifications all fall within the protection scope of the present invention.
Claims
1. A method for real-time physical deletion of an image, characterized in that: The real-time physical deletion method of the image includes: Obtaining an image deletion instruction, wherein the image deletion instruction includes marking information of an image to be deleted; Obtain an image layer composition list of the image corresponding to the mark information, wherein the image layer composition list includes layer information of the image layers constituting the image; Delete the layer file of the image layer corresponding to the layer information; The step of deleting the layer file of the image layer corresponding to the layer information specifically includes: Obtaining first push information of the image layer corresponding to the layer information, where the first push information includes a first cumulative number of push times of the image layer; Calculate the first cumulative number of pushes minus N1, where N1 is the number of the image layer corresponding to the layer information; Determine whether the first cumulative number of pushes after deduction is equal to the cumulative initial value. If so, then: Deleting the first push information; Delete the layer file of the image layer corresponding to the layer information.
2. The method for real-time physical deletion of an image according to claim 1, characterized in that: The marking information includes image version information.
3. The real-time physical deletion method of an image according to claim 1, characterized in that: The real-time physical deletion method of the image also includes: After deleting the layer file of the image layer corresponding to the layer information, the image layer composition list is deleted.
4. The real-time physical deletion method of an image according to claim 3, characterized in that: The step of deleting the image layer composition list specifically includes: Obtaining second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list; Calculate the second cumulative number of pushes minus N2, where N2 is the number of image layer composition lists; Determine whether the second cumulative number of pushes after deduction is equal to the cumulative initial value. If so, then: Deleting the second push information; Delete the image layer composition list.
5. The real-time physical deletion method of an image according to claim 4, characterized in that: The real-time physical deletion method of the image also includes: After acquiring the first push information, locking the first push information to prohibit reading and writing operations on the first push information; After calculating the first cumulative number of pushes minus N1, unlocking the first push information to release the prohibition on the read and write operations; And / or, the real-time physical deletion method of the image further includes: After acquiring the second push information, locking the second push information to prohibit reading and writing operations on the second push information; After calculating the second cumulative number of pushes minus N2, the second push information is unlocked to lift the prohibition on the read and write operations.
6. The real-time physical deletion method of an image according to claim 4, characterized in that: The real-time physical deletion method of the image also includes: When the first push information is successfully deleted but the layer file is failed to be deleted, traverse the first push information of all image layers and delete the layer file corresponding to the image layer that lacks the first push information; And / or, the real-time physical deletion method of the image further includes: When the second push information is successfully deleted but the image layer composition list is failed to be deleted, the second push information of all image layer composition lists are traversed, and the image layer composition lists that lack the second push information are deleted.
7. The real-time physical deletion method of an image according to claim 1, characterized in that: The image layers constituting the image include: a data layer of the image and a configuration file layer of the image, the data layer includes image data, and the configuration file layer includes image configuration information.
8. A mirror image push method, characterized in that: include: Push the layer files that make up the image layer of the image; Acquire first push information of the image layer, where the first push information includes a first cumulative number of push times of the image layer; Pushing an image layer composition list of the image, wherein the image layer composition list includes layer information of the image layer; Obtaining second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list; Calculate a new first cumulative number of pushes, where the new first cumulative number of pushes is equal to the first cumulative number of pushes plus N1, where N1 is the number of pushed image layers; Calculate a new second cumulative number of pushes, where the new second cumulative number of pushes is equal to the second cumulative number of pushes plus N2, where N2 is the number of the image layer composition list.
9. The image push method according to claim 8, characterized in that: The step of obtaining the first push information of the image layer specifically includes: Determine whether the first push information of the image layer exists; If it exists, obtaining the first push information; If not, creating the first push information for the image layer, and setting the first cumulative number of pushes in the first push information to a cumulative initial value; And / or, the step of obtaining the second push information of the image layer composition list specifically includes: Determine whether the second push information of the image layer composition list exists; If it exists, obtaining the second push information; If not, creating the second push information for the image layer composition list, and setting the second cumulative push times in the second push information to the cumulative initial value.
10. The image push method according to claim 8, characterized in that: The image push method also includes: After acquiring the first push information, locking the first push information to prohibit reading and writing operations on the first push information; After calculating a new first cumulative number of pushes, unlocking the first push information to lift the prohibition on the read and write operations; And / or, the image push method further includes: After acquiring the second push information, locking the second push information to prohibit reading and writing operations on the second push information; After calculating the new second cumulative number of pushes, the second push information is unlocked to lift the prohibition on the read and write operations.
11. A real-time physical deletion system for images, characterized in that: The image real-time physical deletion system comprises: An instruction acquisition module, used to acquire an image deletion instruction, wherein the image deletion instruction includes marking information of the image to be deleted; A list acquisition module, used to obtain an image layer composition list of the image corresponding to the tag information, wherein the image layer composition list includes layer information of the image layers constituting the image; An image deletion module, used to delete the layer file of the image layer corresponding to the layer information; The image deletion module specifically includes: A first acquiring unit, configured to acquire first push information of the image layer corresponding to the layer information, wherein the first push information includes a first accumulated number of push times of the image layer; A first calculation unit, configured to calculate the first cumulative number of pushes minus N1, where N1 is the number of image layers corresponding to the layer information; The first judgment unit is used to judge whether the first cumulative number of pushes after subtraction is equal to the cumulative initial value. If so, first delete the first push information and then delete the layer file of the image layer corresponding to the layer information.
12. The image real-time physical deletion system according to claim 11, characterized in that: The marking information includes image version information.
13. The image real-time physical deletion system according to claim 11, characterized in that: The image real-time physical deletion system also includes: The list deletion module is used to delete the image layer composition list after deleting the layer file of the image layer corresponding to the layer information.
14. The image real-time physical deletion system according to claim 13, characterized in that: The list deletion module specifically includes: A second acquiring unit, configured to acquire second push information of the image layer composition list, wherein the second push information includes a second accumulated number of push times of the image layer composition list; A second calculation unit, used to calculate the second cumulative number of pushes minus N2, where N2 is the number of the image layer composition list; The second judgment unit is used to judge whether the second cumulative push number after subtraction is equal to the cumulative initial value, and if so, first delete the second push information and then delete the image layer composition list.
15. The image real-time physical deletion system according to claim 14, characterized in that: The mirror real-time physical deletion system also includes: A first locking module, used for locking the first push information after acquiring the first push information, so as to prohibit the reading and writing operations on the first push information; The first locking module is further used to unlock the first push information after calculating the first cumulative number of pushes minus N1, so as to lift the prohibition on the read and write operations; And / or, the image real-time physical deletion system further includes: A second locking module, used for locking the second push information after acquiring the second push information, so as to prohibit the reading and writing operations on the second push information; The second locking module is further used to unlock the second push information after calculating the second cumulative number of pushes minus N2, so as to lift the prohibition on the read and write operations.
16. The image real-time physical deletion system according to claim 14, characterized in that: The image real-time physical deletion system also includes: An image optimization and deletion module, configured to traverse the first push information of all image layers and delete the layer files corresponding to the image layers lacking the first push information when the first push information is successfully deleted but the layer files are failed to be deleted; And / or, the image real-time physical deletion system further includes: The list optimization and deletion module is used to traverse the second push information of all image layer composition lists and delete the image layer composition lists that lack the second push information when the second push information is successfully deleted but the image layer composition list is failed to be deleted.
17. The image real-time physical deletion system according to claim 11, characterized in that: The image layers constituting the image include: a data layer of the image and a configuration file layer of the image, the data layer includes image data, and the configuration file layer includes image configuration information.
18. An image push system, characterized in that: include: A first push module, used to push layer files constituting the image layer of the image; A first acquisition module is used to acquire first push information of the image layer, wherein the first push information includes a first cumulative number of push times of the image layer A second push module is used to push the image layer composition list of the image, where the image layer composition list includes layer information of the image layer; A second acquisition module is used to acquire second push information of the image layer composition list, where the second push information includes a second cumulative number of pushes of the image layer composition list; A first calculation module, used to calculate a new first cumulative number of pushes, where the new first cumulative number of pushes is equal to the first cumulative number of pushes plus N1, where N1 is the number of pushed image layers; The second calculation module is used to calculate a new second cumulative push count, where the new second cumulative push count is equal to the second cumulative push count plus N2, where N2 is the number of the image layer composition list.
19. The image push system according to claim 18, characterized in that: The first acquisition module is specifically used for: Determine whether the first push information of the image layer exists; If it exists, obtaining the first push information; If it does not exist, creating the first push information for the image layer, and setting the first cumulative push times in the first push information to a cumulative initial value; And / or, the second acquisition module is specifically used for: Determine whether the second push information of the image layer composition list exists; If it exists, obtaining the second push information; If not, creating the second push information for the image layer composition list, and setting the second cumulative push times in the second push information to the cumulative initial value.
20. The image push system according to claim 18, characterized in that: The image push system also includes: A third locking module is used to lock the first push information after acquiring the first push information, so as to prohibit the reading and writing operations on the first push information; The third locking module is further used to unlock the first push information after calculating a new first cumulative number of pushes, so as to lift the prohibition on the read and write operations; And / or, the image push system further includes: a fourth locking module, configured to lock the second push information after acquiring the second push information, so as to prohibit the reading and writing operations on the second push information; The fourth locking module is further configured to unlock the second push information after calculating a new second cumulative number of pushes, so as to lift the prohibition on the read and write operations.
21. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the image real-time physical deletion method described in any one of claims 1 to 7 or the image push method described in any one of claims 8 to 10 is implemented.
22. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the image real-time physical deletion method described in any one of claims 1 to 7 or the image push method described in any one of claims 8 to 10 are implemented.
Citation Information
Patent Citations
Image management method, device and system
CN105740048A