CN111488194B - Container preservation method, device, computer equipment and storage medium - Google Patents

Container preservation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN111488194B
CN111488194B CN202010165088.8A CN202010165088A CN111488194B CN 111488194 B CN111488194 B CN 111488194B CN 202010165088 A CN202010165088 A CN 202010165088A CN 111488194 B CN111488194 B CN 111488194B
Authority
CN
China
Prior art keywords
content
modification
modified
partition
current
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.)
Active
Application number
CN202010165088.8A
Other languages
Chinese (zh)
Other versions
CN111488194A (en
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.)
Guangzhou Weride Technology Co Ltd
Original Assignee
Guangzhou Weride 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 Guangzhou Weride Technology Co Ltd filed Critical Guangzhou Weride Technology Co Ltd
Priority to CN202010165088.8A priority Critical patent/CN111488194B/en
Publication of CN111488194A publication Critical patent/CN111488194A/en
Application granted granted Critical
Publication of CN111488194B publication Critical patent/CN111488194B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/067Distributed or networked storage systems, e.g. storage area networks [SAN], network attached storage [NAS]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances

Landscapes

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

Abstract

The application relates to a container storage method, a container storage device, a computer device and a storage medium. The method comprises the following steps: obtaining target modification content of a target container, dividing the target modification content to obtain a plurality of partition modification content lists, and modifying and storing the current target container according to the partition modification content lists in sequence to obtain a corresponding target mirror image. In the method, the size of each partition modified content list obtained after division is smaller than the preset threshold, so that the size of the single-layer image in the target image obtained according to each partition modified content list is also smaller than the preset threshold, and in practical application, the target image can be directly uploaded to any cloud image warehouse because the preset threshold is a limit value of the storage size of the cloud image warehouse for the single-layer image, and the size of the single-layer image in the target image cannot exceed the limit of the cloud image warehouse due to excessive modified content of a container.

Description

Container preservation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a container preservation method, a device, a computer apparatus, and a storage medium.
Background
Container technology is becoming a yet further hot-hand technology following big data and cloud computing, and will be very popular for a considerable period of time in the future. Therefore, the container technology is one of technologies that offline software developers are urgently required to grasp.
In the application of container technology, a container user configures the environment inside the container according to different task environment requirements. In order to preserve the environment configuration to prevent the problem of sudden cluster, node and container content loss, the container user often needs to store the container, and especially after the original container is modified, the mirror image corresponding to the modified container needs to be uploaded to a cloud mirror image warehouse normally so as to update the function of the container in time, thereby expanding the application range of the container. The current method for perfectly storing the modified container is to store the modified content of all the readable and writable layers after the container is established as a new mirror image layer in the storage process by the container operation instruction provided by the authorities, so that the container is stored to the new mirror image, and the storage of the container is realized.
However, in the storage mode of the container, after some containers with more modifications are stored, the corresponding images are difficult to directly upload to the cloud image warehouse, so that the application range of the images corresponding to the containers is greatly limited.
Disclosure of Invention
Accordingly, in view of the above-mentioned technical problems, it is necessary to provide a method, a device, a computer device and a storage medium for storing a container, which can effectively upload the image corresponding to the stored container to a cloud image warehouse directly, and particularly, after the container with more modifications is stored, can effectively upload the image corresponding to the container to the cloud image warehouse.
In a first aspect, a method of preserving containers, the method comprising:
acquiring target modification content of a target container; the target modification content comprises modification content of a readable and writable layer in the target container;
dividing the target modified content to obtain a plurality of partition modified content lists, so that the size of the storage space occupied by the modified content contained in each partition modified content list is smaller than a preset threshold; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
modifying and storing the current target container according to the content list modified by the multiple partitions in sequence to obtain a corresponding target mirror image; the current target container is created from the original image to which the target container corresponds.
In one embodiment, the dividing the target modified content to obtain a plurality of partition modified content lists includes:
Reading the modification content of the current line in the target modification content;
dividing the modification content of the current line into corresponding partition modification content lists according to the type of the modification content of the current line and the operation type of the modification content of the current line.
In one embodiment, dividing the modification content of the current line into the corresponding partition modification content list according to the type of the modification content of the current line and the operation type of the modification content of the current line includes:
if the type of the modified content of the current line is a folder and the operation type of the modified content of the current line is adding or deleting, the modified content of the current line is added into the first partition modified content list.
In one embodiment, dividing the modification content of the current line into the corresponding partition modification content list according to the type of the modification content of the current line and the operation type of the modification content of the current line includes:
if the type of the modified content of the current line is a file and the operation type of the modified content of the current line is deletion, adding the modified content of the current line into a first partition modified content list;
if the type of the modified content of the current line is a file and the operation type of the modified content of the current line is addition or modification, judging whether the sum of the size of the modified content of the current line and the size of the first partition modified content list is larger than a preset threshold value, and dividing the modified content of the current line into corresponding partition modified content lists according to a judging result.
In one embodiment, dividing the modification content of the current line into the corresponding partition modification content list according to the judgment result includes:
if the judgment result is that the sum of the size of the modified content of the current row and the size of the first partition modified content list is larger than a preset threshold value, adding all the content in the first partition modified content list into a second partition modified content list, adding the modified content of the current row into the emptied first partition modified content list, and setting the size of the first partition modified content list after adding the content as the size of the modified content of the current row;
and if the judgment result is that the sum of the size of the modified content of the current line and the size of the first partition modified content list is smaller than or equal to the preset threshold value, adding the modified content of the current line into the first partition modified content list.
In one embodiment, modifying and saving the current target container according to the content list modified by the plurality of partitions in turn to obtain a corresponding target image, including:
sequentially traversing a plurality of subareas to modify the content list;
modifying and storing the current target container according to the current traversed partition modification content list to obtain a current mirror image;
Judging whether all the partition modified content lists are traversed;
if yes, determining the current mirror image as a target mirror image;
if not, creating a new container according to the current mirror image, taking the new container as a current target container, taking the next traversed partition modification content list as a current traversed partition modification content list, and returning to execute the step of modifying and storing the current target container according to the current traversed partition modification content list to obtain the current mirror image.
In one embodiment, modifying and saving the current target container according to the current traversed partition modification content list to obtain the current mirror image, including:
reading the modification content of each row in the partition modification content list which is currently traversed;
if the operation type of the modified content of each row is deleting, deleting the content in the corresponding directory in the current target container;
if the operation type of the modified content of each row is adding and the type of the modified content of each row is a folder, creating a new folder under a corresponding directory in the current target container;
if the operation type of the modified content of each row is addition or modification and the type of the modified content of each row is a file, copying the content in the corresponding directory of the target container to the corresponding directory in the current target container;
And storing the modified current target container to obtain the current mirror image.
In one embodiment, obtaining target modified content of a target container includes:
according to the identification of the target container, calling a container operation instruction to extract all modified contents in the target container;
and screening the modified contents of the readable and writable layer from all the modified contents to serve as target modified contents.
In a second aspect, a container holding device, the device comprising:
the acquisition module is used for acquiring target modification content of the target container; the target modification content comprises modification content of a readable and writable layer in the target container;
the dividing module is used for dividing the target modified content to obtain a plurality of partition modified content lists, so that the size of the storage space occupied by the modified content contained in each partition modified content list is smaller than a preset threshold value; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
the storage module is used for sequentially modifying and storing the current target container according to the partition modification content lists to obtain a corresponding target mirror image; the current target container is created from an original image corresponding to the target container.
In a third aspect, a computer device includes a memory storing a computer program and a processor implementing the container saving method according to any embodiment of the first aspect when the processor executes the computer program.
In a fourth aspect, a computer readable storage medium has stored thereon a computer program, which when executed by a processor implements the container saving method according to any embodiment of the first aspect.
The application provides an image recognition method, an image recognition device, computer equipment and a storage medium, which comprise the following steps: obtaining target modification content of a target container, dividing the target modification content to obtain a plurality of partition modification content lists, and modifying and storing the current target container according to the partition modification content lists in sequence to obtain a corresponding target mirror image. In the method, the size of the storage space occupied by the modified content in each divided partition modified content list is smaller than the preset threshold, so that the size of the single-layer image in the target image obtained according to the modified content in each divided partition modified content list is also smaller than the preset threshold, and in practical application, the target image can be directly uploaded to any cloud image warehouse because the preset threshold is a limit value of the cloud image warehouse to the storage size of the single-layer image, and the size of the single-layer image in the target image cannot exceed the limit of the cloud image warehouse due to excessive modified content of a container, so that the single-layer image cannot be normally uploaded to the cloud image warehouse. Therefore, the container preservation method provided by the application not only can be suitable for local application, but also can be suitable for network application in various fields, and has strong popularization and application.
Drawings
FIG. 1 is a schematic diagram of an internal structure of a computer device according to one embodiment;
FIG. 2 is a flow chart of a method for preserving containers according to one embodiment;
FIG. 3 is a flow chart of one implementation of S102 in the embodiment of FIG. 2;
FIG. 4 is a flow chart of one implementation of S202 in the embodiment of FIG. 3;
FIG. 5 is a flow chart of one implementation of S303 in the embodiment of FIG. 4;
FIG. 6 is a flow chart of a partitioning method provided by one embodiment;
FIG. 7 is a flow chart of one implementation of S103 in the embodiment of FIG. 2;
FIG. 8 is a flow chart of one implementation of S502 in the embodiment of FIG. 7;
FIG. 9 is a flow chart of one implementation of S602 in the embodiment of FIG. 2;
FIG. 10 is a flow chart of a method for preserving containers provided by one embodiment;
fig. 11 is a schematic structural view of a container storing device according to an embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The container preservation method provided by the application can be applied to the computer equipment shown in figure 1. The computer device may be a terminal, and its internal structure may be as shown in fig. 1. The computer device includes a processor, a memory, a network interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a container saving method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the architecture shown in fig. 1 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements may be implemented, as a particular computer device may include more or less components than those shown, or may be combined with some components, or may have a different arrangement of components.
The current method for perfectly storing the modified content of the container is completed through the container operation instruction provided by the authorities, and particularly in the storing process, the modified content of all the readable and writable layers after the container is built is used as a new mirror image layer, so that the container is stored to a new mirror image. However, the container preservation method described above has the following drawbacks: first, there are many cloud mirror image storage servers in the industry at present that limit the single-layer mirror image space, so that the above container storage method cannot flexibly store according to the single-layer mirror image space limit. When the modified file size in the readable and writable layer of the container exceeds the single-layer mirror image space limit, the obtained mirror image cannot be directly uploaded to the cloud mirror image warehouse even if the modified container is stored. Such a mirror image that can only be used locally does not exert its value in the industrial field. Meanwhile, in most of the existing cloud mirror warehouse services, pushing is repeatedly attempted when the mirror exceeding the size limit is pushed to a cloud server, which is quite troublesome for building the mirror uploading service which is increasingly automated in the industry. Therefore, due to the limitation of the cloud mirror warehouse and the size requirement of the mirror structure when the user stores the container, a feasible scheme is needed to meet the different requirements of the single-layer mirror size when the container is stored, and the application provides a container storage method for solving the technical problems.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail by examples and with reference to the accompanying drawings. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.
Fig. 2 is a flowchart of a method for storing a container, where the method is implemented by the computer device in fig. 1, and the method relates to a specific process of storing a modified container by the computer device. As shown in fig. 2, the method specifically includes:
s101, acquiring target modification content of a target container; the target modification content includes modification content of a read-write layer in the target container.
The container is a standard software unit containing file resources, system resources and development environment dependence, and each container can directly use the CPU, the memory and the hard disk on the physical machine where the container is located, and the performance of the container is close to that of the physical machine. The target container is a container that has been modified and needs to be saved.
In this embodiment, the computer device may create a container based on a preset mirror image, and then modify the container, so as to obtain the target container. Further, when the computer device needs to store the modified container, that is, the target container, the computer device may directly extract the target modified content from the readable and writable layer of the target container through the container operation instruction issued by the authority, optionally, the computer device may also extract the modified content of all layers from the target container through the container operation instruction issued by the authority, and further extract the target modified content in the readable and writable layer therefrom, so as to execute the operation of storing the target container according to the target modified content in the readable and writable layer. Each row of modified content in the readable and writable layer, namely, the extracted target modified content comprises a file modification operation and a file modification object, and the file modification object comprises a file directory and a specific file. File modification operations may be categorized as C (modification), D (deletion), a (addition). The target modification content may be presented in any form, e.g., list, collection, member, etc. For another example, the target modification content may be represented in table 1 below:
TABLE 1
A/root/config
C/root/.cache
D/urs/local/lib/python3.0/dist-packages/grpcio-1.21.1.dist-info
S102, dividing target modified content to obtain a plurality of partition modified content lists, so that the size of a storage space occupied by modified content contained in each partition modified content list is smaller than a preset threshold; the preset threshold is determined according to the size of the single-layer mirror image storage space of the cloud mirror image warehouse.
The cloud mirror image warehouse is a place for storing mirror image files in a centralized mode, a plurality of cloud mirror image warehouses are often stored on a cloud warehouse server, and different cloud mirror image warehouses often have different limits on the size of a storage single-layer mirror image. In practical application, the preset threshold is a storage limit value of the cloud mirror warehouse on a single-layer mirror image when the cloud mirror warehouse mirrors the storage container, and different cloud mirror warehouses correspond to different preset thresholds.
In this embodiment, when the computer device obtains the target modified content of the target container, the target modified content may be further divided, and specifically, the computer device may divide a plurality of rows of modified content included in the target modified content into groups, or partition the modified content into partitions, and the sizes of the modified content included in each group or each partition may be the same or different, but are smaller than the preset threshold. After the computer device divides the target modified content, the divided modified contents of multiple groups or multiple partitions may be written into a preset table, so as to obtain multiple partition modified content lists each containing multiple lines of modified content, and finally the above dividing operation makes the size of the storage space occupied by the modified content contained in each partition modified content list smaller than a preset threshold.
S103, modifying and storing the current target container according to the multiple partition modification content lists in sequence to obtain a corresponding target mirror image; the current target container is created from the original image to which the target container corresponds.
Wherein the current target container is an unmodified container that can be created based on the original image by the container operation instructions used to create the container. In this embodiment, the computer device may first create a current target container based on the original image corresponding to the target container, when the computer device obtains the multiple partition modified content lists, may first select one partition modified content list from the multiple partition modified content lists, modify and store the current target container according to the modified content in the modified content list, then select one partition modified content list from the multiple partition modified content list, modify and store the last stored container according to the modified content in the modified content list, and perform the cyclic operation in this manner until the multiple partition modified content lists are traversed, and finally obtain the modified and stored container, that is, the target image, where the size of each layer of image in the target image is smaller than the preset threshold.
The container preservation method provided in this embodiment includes: obtaining target modification content of a target container, dividing the target modification content to obtain a plurality of partition modification content lists, and modifying and storing the current target container according to the partition modification content lists in sequence to obtain a corresponding target mirror image. In the method, the size of the storage space occupied by the modified content in each divided partition modified content list is smaller than the preset threshold, so that the size of the single-layer image in the target image obtained according to the modified content in each divided partition modified content list is also smaller than the preset threshold, and in practical application, the target image can be directly uploaded to any cloud image warehouse because the preset threshold is a limit value of the cloud image warehouse to the storage size of the single-layer image, and the size of the single-layer image in the target image cannot exceed the limit of the cloud image warehouse due to excessive modified content of a container, so that the single-layer image cannot be normally uploaded to the cloud image warehouse. Therefore, the container preservation method provided by the application not only can be suitable for local application, but also can be suitable for network application in various fields, and has strong popularization and application.
Optionally, the present application further provides a specific embodiment of S102, as shown in fig. 3, where S102 "divides the target modified content to obtain a plurality of partition modified content lists", and includes: and executing a dividing operation on each row of modified content in the target modified content to obtain a plurality of partition modified content lists. As shown in fig. 3, for the modified content of the current line, the corresponding dividing operation includes the following steps:
s201, reading the modification content of the current line in the target modification content.
In particular, when dividing according to the target modified contents, the computer device may read the modified contents of each line in the target modified contents line by line in units of lines so as to perform different dividing operations on the modified contents of each line later.
S202, dividing the modification content of the current line into a corresponding partition modification content list according to the type of the modification content of the current line and the operation type of the modification content of the current line.
Wherein the types of modified content include files and folders; the operation types of modifying the content include modification, deletion, addition, and the like. In this embodiment, when the computer device obtains the target modified content, the modified content of each line may be read line by line, and according to the type of the modified content of each line and the operation type of the modified content, a corresponding dividing operation is performed on the modified content of each line, and the modified content of each line is divided into corresponding partition modified content lists, so as to finally obtain a plurality of partition modified content lists.
The following embodiment describes a specific implementation of the dividing operation by taking the modification content of the current line as a reading, that is, the specific implementation of S202 described above, as shown in fig. 4, including:
s301, if the type of the modified content of the current row is a folder and the operation type of the modified content of the current row is adding or deleting, adding the modified content of the current row into a first partition modified content list.
The first partition modified content list is a blank one-dimensional list prepared by the computer equipment in advance and is used for storing modified content of the current row read by the computer equipment, the initial value of the modified content is zero, and the size of the modified content increases with the addition of the modified content. In practical application, since the folder does not occupy any space, according to the characteristic, the computer device may directly add the modified content to the first partition modified content list when the type of the modified content in the current row is the folder and the operation type of the modified content is addition; accordingly, the operation of deleting the folder does not increase the size of the readable and writable mirror layer, and thus, according to this feature, the computer device can directly add the modified content to the first partition modified content list when the type of the modified content of the current line is the folder and the operation type of the modified content is the deletion.
S302, if the type of the modified content of the current line is a file and the operation type of the modified content of the current line is deletion, adding the modified content of the current line into a first partition modified content list.
The above operation of deleting a file does not increase the size of the readable and writable mirror layer, and thus, according to this feature, the computer device can directly add the modified content to the first partition modified content list when the type of the modified content of the current line is a file and the operation type of the modified content is deletion.
S303, if the type of the modified content of the current line is a file and the operation type of the modified content of the current line is addition or modification, judging whether the sum of the size of the modified content of the current line and the size of the first partition modified content list is greater than a preset threshold value, and dividing the modified content of the current line into corresponding partition modified content lists according to a judging result.
The above-mentioned operation of adding or modifying a file may directly affect the size of the readable and writable mirror layer, especially if the added file is larger or the modified file is larger, so, based on this feature, the computer device may further determine whether the sum of the size of the modified content of the current line and the size of the first partition modified content list is greater than a preset threshold when the type of the modified content of the current line is a file and the operation type of the modified content is addition or modification, and then divide the modified content of the current line into corresponding partition modified content lists according to the determination result, so that the size of each partition modified content list is smaller than the preset threshold, even if the size of each partition modified content list is within the storage limit range of the mirror cloud repository for the single-layer mirror layer.
Specifically, in S303, the "dividing the modification content of the current line into the corresponding partition modification content list according to the determination result" includes, as shown in fig. 5:
s401, if the judgment result is that the sum of the size of the modified content of the current line and the size of the first partition modified content list is larger than a preset threshold value, adding all the content in the first partition modified content list to the second partition modified content list, adding the modified content of the current line to the emptied first partition modified content list, and setting the size of the first partition modified content list after the content is added as the size of the modified content of the current line.
The second partition modified content list is a blank two-dimensional list prepared by the computer equipment in advance and is used for storing modified contents of a plurality of rows, which are removed from the first partition modified content list by the computer equipment, of which the initial value is zero and the size is changed with the increase of added modified contents.
The present embodiment relates to an application scenario in which the result of the determination is that the sum of the size of the modified content of the current line and the size of the first partition modified content list is greater than a preset threshold, where the scenario indicates that the size of the modified content of the added lines in the first partition modified content list is smaller than the preset threshold, but if the modified content of the current line is added again, the modified content of the added lines in the first partition modified content list exceeds the preset threshold, which is equivalent to exceeding the storage limit of the cloud mirror warehouse on the single-layer mirror, so that in the application scenario, the computer device may add all the modified content in the first partition modified content list to the second partition modified content list at this time to obtain a partition modified content list, and then the size of the partition modified content list is smaller than the preset threshold. Then, the computer device empties the first partition modified content list, adds the modified content of the current line to the emptied first partition modified content list, then sets the size of the first partition modified content list to the size of the modified content of the current line, so as to update the size of the first partition modified content list in time, and then accurately obtains the judgment result.
And S402, if the judgment result is that the sum of the size of the modified content of the current line and the size of the first partition modified content list is smaller than or equal to a preset threshold value, adding the modified content of the current line into the first partition modified content list.
The embodiment relates to an application scenario in which the result of the judgment is that the sum of the size of the modified content of the current line and the size of the first partition modified content list is smaller than or equal to a preset threshold, the scenario indicates that the size of the modified content of the added lines in the first partition modified content list is smaller than the preset threshold, and even if the modified content of the current line is added to the first partition modified content list, the modified content of the added lines in the first partition modified content list fails to exceed the preset threshold, and indicates that the modified content contained in the first partition modified content list at this time cannot meet the requirement of being divided, so in the application scenario, the computer device adds the modified content of the current line to the first partition modified content list to continue to realize the division operation of the modified content of the current line.
2-5 above, the partitioning of the target modified content described above is illustrated, as shown in FIG. 6, and includes:
S1001, acquiring target modification content of a target container.
S1002, reading the modification content of the current line in the target modification content, and acquiring the size delta of the modification content of the current line.
S1003, judging the type of the modification content of the current line, if the modification content of the current line is a folder, executing step S1004, and if the modification content of the current line is a file, executing step S1005.
S1004, judging the operation type of the modified content of the current line, and executing step S1006 if the operation type of the modified content of the current line is addition or deletion; if the operation type of the modified contents of the current line is modification, step S1007 is performed.
S1005, judging the operation type of the modified content of the current line, and executing step S1006 if the operation type of the modified content of the current line is deleting; if the operation type of the modified content of the current line is modification or addition, step S1008 is performed.
S1006, adding the modification content of the current line to the first partition modification content list.
S1007, no operation is performed.
S1008, acquiring the size S of the first partition modification content list, judging whether delta+s is larger than a preset threshold S, if yes, executing step S1009, and if no, executing step S1006.
S1009, adding all contents in the first partition modification content list to the second partition modification content list, and adding the modification content of the current line to the emptied first partition modification content list, and setting the size S of the first partition modification content list after adding the contents to be the size delta of the modification content of the current line.
S1010, reading the modified content of the next row in the target modified content, taking the modified content of the next row as the modified content of the current row, returning to the step S1003 and the following steps until the modified content of all rows in the target modified content is traversed, and obtaining a plurality of partition modified content lists.
Fig. 7 is a flowchart of one implementation of S103 in the embodiment of fig. 2, where the embodiment relates to a specific process of modifying and saving a current target container by a computer device based on a plurality of partition modified content lists, and as shown in fig. 7, S103 "modifying and saving the current target container according to the plurality of partition modified content lists in turn, and obtaining a corresponding target image" includes:
s501, sequentially traversing a plurality of partitions to modify the content list.
And the container storing operation currently executed is based on a new container and a corresponding new mirror image obtained after the container is modified in the previous time, which is equivalent to adopting an iterative method to realize the storage of the target container.
S502, modifying and storing the current target container according to the current traversed partition modification content list to obtain the current mirror image.
The current target container is a container which needs to be modified currently, and the current target container can be a container which is obtained after the original image corresponding to the target container is created, or can be a container which is obtained after the image corresponding to the container after each modification is created. The current mirror image is the mirror image which needs to be modified currently, and can be the mirror image obtained after the current target container is modified and stored for the first time, or the mirror image obtained after the container modified each time is modified and stored again. The current traversed partition modified content list is a modified content list that needs to be referenced each time a container needs to be modified. In this embodiment, when the computer device obtains the partition modification content list currently traversed, the corresponding current target container to be modified may be modified according to the modification content of each line in the partition modification content list through the corresponding container operation instruction, and then the modified content is saved to generate the corresponding current mirror image.
S503, judging whether all the partition modification content lists are traversed, if yes, executing S504, and if not, executing S505.
S504, determining the current mirror image as a target mirror image.
The embodiment relates to an application scenario in which the computer device traverses and completes all partition modification content lists, and the application scenario indicates that the computer device has completed modification to a container, so that the current mirror image obtained at this time is the target mirror image corresponding to the target container which is finally modified and stored.
S505, creating a new container according to the current mirror image, taking the new container as a current target container, taking the next traversed partition modification content list as a current traversed partition modification content list, and returning to execute the step of modifying and storing the current target container according to the current traversed partition modification content list to obtain the current mirror image.
The embodiment relates to an application scenario in which the computer device has not traversed and completed all partition modification content lists, and the application scenario indicates that the computer device has not completed modifying a container, so the computer device needs to continuously modify and save the container created by the current image based on the current image until all partition modification content lists are traversed and completed, and a target image is obtained.
The above embodiment is a process of iteratively modifying and saving the current target container, and each modification and saving of the current target container is performed on the basis of the current target container modified last time, so that the size of the current mirror image obtained after each modification and saving of the current target container does not exceed the preset threshold. The target images obtained through the iterative process not only contain all changes in the target container, but also each layer of images accords with the upper limit (preset threshold) of the size required by the cloud image warehouse for storing the single-layer images. Therefore, the container storage method provided by the application is not limited by the single-layer image storage of the conventional cloud image warehouse, and the corresponding image can be directly uploaded to the cloud image warehouse after the container is stored.
FIG. 8 is a flowchart of one implementation of S502 in the embodiment of FIG. 7, where the embodiment relates to a specific process of modifying and saving a current target container by a computer device, and as shown in FIG. 8, S502 "modify and save the current target container according to a partition modification content list currently traversed to obtain a current mirror image" includes:
s601, reading the modification content of each row in the partition modification content list which is currently traversed.
In particular, when the current target container is modified and saved according to a partition modification content list, the computer device may traverse the modification content of each line in the partition modification content list line by line in units of lines, so as to perform a modification operation on the current target container according to the modification content of each line.
S602, if the operation type of the modified content of each row is deleting, deleting the content under the corresponding directory in the current target container.
When the operation type of the modified content of each row obtained by the computer equipment is deleting, the corresponding deleting operation can be correspondingly carried out on the current target container through the container operation instruction related to deleting, and the content under the corresponding directory of the current target container is deleted, whether the type of the modified content is a folder or a file.
S603, if the operation type of the modified content of each row is adding and the type of the modified content of each row is a folder, creating a new folder under the corresponding directory in the current target container.
When the operation type of the modified content of each row is added and the type of the modified content of each row is a folder, the computer equipment indicates that a new folder needs to be created in the current target container at the moment, and specifically, the computer equipment can create the new folder under the corresponding directory in the current target container through the corresponding container operation instruction.
It will be appreciated that when the type of operation in which the computer device obtains the modified content for each row is a modification and the type of modified content for each row is a folder, the computer device need not perform any operation because the immediately following file modified content is the operation that is actually required to be performed under the folder.
S604, if the operation type of the modified content of each row is adding or modifying, and the type of the modified content of each row is a file, copying the content in the corresponding directory of the target container to the corresponding directory in the current target container.
When the operation type of the modified content of each row is added and the type of the modified content of each row is a file, the computer equipment indicates that new file content needs to be added in the current target container at the moment, and specifically, the computer equipment can copy the file content needing to be added from the target container to the corresponding directory in the current target container through the corresponding container operation instruction so as to complete the file adding operation of the current target container.
When the operation type of the modified content of each row is modification and the type of the modified content of each row is file, the computer equipment indicates that the original file content needs to be modified in the current target container at the moment, and specifically, the computer equipment can copy the modified file content from the target container to the corresponding directory in the current target container through the corresponding container operation instruction so as to complete the file modification operation of the current target container.
S605, storing the modified current target container to obtain the current mirror image.
When the computer equipment obtains the modified current target container, the modified current target container can be saved through the container operation instruction related to the saved container issued by the authorities, and the mirror image corresponding to the current target container, namely the current mirror image, is obtained.
In the process of storing the container, each partition modifies each layer of content of the newly added target image when the content list corresponds to the container, so that the size of the newly added image layer obtained by modifying the content list according to each partition in the target image is smaller than a preset threshold.
Fig. 9 is a flowchart of an implementation manner of S101 in the embodiment of fig. 2, where the embodiment relates to a specific process of obtaining target modification content by a computer device, and as shown in fig. 9, the manner includes:
S701, according to the identification of the target container, calling a container operation instruction to extract all modified contents in the target container.
In actual operation, the computer device firstly acquires the identification of the container (target container) to be stored, and then invokes the container operation instruction to extract all the modified contents in the target container, namely the modified contents of each layer, from the target container according to the identification of the target container.
S702, screening the modified contents of the readable and writable layer from all the modified contents to serve as target modified contents.
Further, the computer device may screen the real modification content of the readable/writable layer from all the modification content through the path of the readable/writable layer, so as to use the modification content as the target modification content for subsequent operations.
7-9 above, the process of modifying and saving the current target container to obtain the target image is illustrated, and as shown in FIG. 10, the process includes:
s2001, selecting one partition modification content list from the partition modification content lists as a partition modification content list which is traversed currently.
S2002, reading the modification content of each row in the partition modification content list which is currently traversed.
Step S2003, determining the operation type of the modified content of each line, if the operation type of the modified content of each line is deletion, executing step S2004, if the operation type of the modified content of each line is addition, executing step S2005, and if the operation type of the modified content of each line is modification, executing step S2006.
And S2004, deleting the content in the corresponding directory in the current target container.
S2005, judging the type of the modified content of each line, if the modified content of each line is a folder, executing step S2007, and if the modified content of each line is a file, executing step S2008.
Step S2006, determine the type of the modified content of each line, if the modified content of each line is a folder, execute step S2009, and if the modified content of each line is a file, execute step S2008.
S2007, creating a new folder under the corresponding directory in the current target container.
S2008, copying the content in the corresponding directory of the target container to the corresponding directory in the current target container.
S2009, no operation is performed.
S2010, if the modified contents of all the rows in the partition modified content list which is currently traversed are read to carry out modification and storage operations, selecting another different partition modified content list from the partition modified content lists as the partition modified content list which is currently traversed, returning to execute the steps S2002 and later until all the partition modified content lists are traversed, and determining the current mirror image obtained in the last operation as a target mirror image.
In summary, the container storing method provided by the application provides a convenient and practical method for a container user to store the container with larger modification quantity of the readable and writable layer, and can flexibly store the container according to the actual requirement on the single-layer mirror image size when storing the container mirror image. Compared with the traditional container preservation method, all changes of a readable and writable layer are preserved as one-layer mirror image, the container preservation method provided by the application partitions the mirror image requirement according to the changed contents and the cloud mirror image warehouse, so that the modified contents contained in each partition are smaller than a preset threshold value, and the corresponding container preservation step is changed from single preservation to repeated iterative update preservation, so that not only are all the modified contents of the container to be preserved maintained, but also the size requirement of each layer of mirror image of the obtained target mirror image is ensured.
It should be understood that, although the steps in the flowcharts of fig. 2-10 are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in FIGS. 2-10 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor does the order in which the sub-steps or stages are performed necessarily occur in sequence.
In one embodiment, as shown in fig. 11, there is provided a container holding device comprising: an acquisition module 11, a division module 12 and a preservation module 13, wherein:
an obtaining module 11, configured to obtain target modification content of a target container; the target modification content comprises modification content of a readable and writable layer in the target container;
the dividing module 12 is configured to divide the target modified content to obtain a plurality of partition modified content lists, so that the size of the storage space occupied by the modified content included in each partition modified content list is smaller than a preset threshold; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
the storage module 13 is configured to modify and store the current target container according to the partition modification content lists in sequence to obtain a corresponding target mirror image; the current target container is created from an original image corresponding to the target container.
For specific limitations on container preservation, reference may be made to the limitations hereinabove for one container preservation method, and no further description is given herein. The respective modules in the above container holding device may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of:
acquiring target modification content of a target container; the target modification content comprises modification content of a readable and writable layer in the target container;
dividing the target modified content to obtain a plurality of partition modified content lists, so that the size of a storage space occupied by modified content contained in each partition modified content list is smaller than a preset threshold; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
modifying and storing the current target container according to the partition modification content list in turn to obtain a corresponding target mirror image; the current target container is created from an original image corresponding to the target container.
The computer device provided in the foregoing embodiments has similar implementation principles and technical effects to those of the foregoing method embodiments, and will not be described herein in detail.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor further performs the steps of:
Acquiring target modification content of a target container; the target modification content comprises modification content of a readable and writable layer in the target container;
dividing the target modified content to obtain a plurality of partition modified content lists, so that the size of a storage space occupied by modified content contained in each partition modified content list is smaller than a preset threshold; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
modifying and storing the current target container according to the partition modification content list in turn to obtain a corresponding target mirror image; the current target container is created from an original image corresponding to the target container.
The foregoing embodiment provides a computer readable storage medium, which has similar principles and technical effects to those of the foregoing method embodiment, and will not be described herein.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.

Claims (10)

1. A method of preserving a container, the method comprising:
acquiring target modification content of a target container; the target modification content comprises modification content of a readable and writable layer in the target container;
reading the modification content of the current line in the target modification content, and dividing the modification content of the current line into corresponding partition modification content lists according to the type of the modification content of the current line and the operation type of the modification content of the current line so that the size of a storage space occupied by the modification content contained in each partition modification content list is smaller than a preset threshold; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
Modifying and storing the current target container according to the partition modification content list in turn to obtain a corresponding target mirror image; the current target container is created by an original image corresponding to the target container, and the size of each layer of image in the target image is smaller than the preset threshold.
2. The method according to claim 1, wherein the dividing the modification contents of the current line into the corresponding partition modification content list according to the type of the modification contents of the current line and the operation type of the modification contents of the current line includes:
and if the type of the modified content of the current line is a folder and the operation type of the modified content of the current line is adding, adding the modified content of the current line into a first partition modified content list.
3. The method according to claim 2, wherein the dividing the modification contents of the current line into the corresponding partition modification content list according to the type of the modification contents of the current line and the operation type of the modification contents of the current line includes:
if the type of the modified content of the current line is a file and the operation type of the modified content of the current line is addition or modification, judging whether the sum of the size of the modified content of the current line and the size of the first partition modified content list is larger than the preset threshold value, and dividing the modified content of the current line into corresponding partition modified content lists according to a judging result.
4. The method of claim 3, wherein dividing the modified content of the current line into the corresponding partition modified content list according to the determination result comprises:
if the judging result is that the sum of the size of the modified content of the current row and the size of the first partition modified content list is larger than the preset threshold value, adding all the content in the first partition modified content list into a second partition modified content list, adding the modified content of the current row into the emptied first partition modified content list, and setting the size of the first partition modified content list after adding the content as the size of the modified content of the current row;
and if the judging result is that the sum of the size of the modified content of the current line and the size of the first partition modified content list is smaller than or equal to the preset threshold value, adding the modified content of the current line into the first partition modified content list.
5. The method according to claim 1, wherein the modifying and saving the current target container according to the content list modified by the plurality of partitions in turn to obtain the corresponding target image includes:
Sequentially traversing a plurality of the subareas to modify the content list;
modifying and storing the current target container according to the current traversed partition modification content list to obtain a current mirror image;
judging whether all the partition modified content lists are traversed;
if yes, determining the current mirror image as the target mirror image;
if not, creating a new container according to the current mirror image, taking the new container as the current target container, taking the next traversed partition modification content list as the current traversed partition modification content list, and returning to execute the step of modifying and storing the current target container according to the current traversed partition modification content list to obtain the current mirror image.
6. The method of claim 5, wherein modifying and saving the current target container according to the currently traversed partition modification content list to obtain a current mirror image comprises:
reading the modification content of each row in the currently traversed partition modification content list;
if the operation type of the modified content of each row is deleting, deleting the content under the corresponding directory in the current target container;
If the operation type of the modified content of each row is adding and the type of the modified content of each row is a folder, creating a new folder under a corresponding directory in the current target container;
if the operation type of the modified content of each row is modification and the type of the modified content of each row is a file, copying the content in the corresponding directory of the target container to the corresponding directory in the current target container;
and storing the modified current target container to obtain the current mirror image.
7. The method of claim 1, wherein the obtaining the target modification content of the target container comprises:
according to the identification of the target container, calling a container operation instruction to extract all modified contents in the target container;
and screening the modified contents of the readable and writable layer from all the modified contents to serve as the target modified contents.
8. A container holding device, the device comprising:
the acquisition module is used for acquiring target modification content of the target container; the target modification content comprises modification content of a readable and writable layer in the target container;
The dividing module is used for reading the modification content of the current line in the target modification content, and dividing the modification content of the current line into corresponding partition modification content lists according to the type of the modification content of the current line and the operation type of the modification content of the current line so that the size of the storage space occupied by the modification content contained in each partition modification content list is smaller than a preset threshold value; the preset threshold is determined according to the size of a single-layer mirror image storage space of the cloud mirror image warehouse;
the storage module is used for sequentially modifying and storing the current target container according to the partition modification content lists to obtain a corresponding target mirror image; the current target container is created by an original image corresponding to the target container, and the size of each layer of image in the target image is smaller than the preset threshold.
9. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 7.
CN202010165088.8A 2020-03-11 2020-03-11 Container preservation method, device, computer equipment and storage medium Active CN111488194B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010165088.8A CN111488194B (en) 2020-03-11 2020-03-11 Container preservation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010165088.8A CN111488194B (en) 2020-03-11 2020-03-11 Container preservation method, device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111488194A CN111488194A (en) 2020-08-04
CN111488194B true CN111488194B (en) 2023-12-01

Family

ID=71791406

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010165088.8A Active CN111488194B (en) 2020-03-11 2020-03-11 Container preservation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111488194B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109947450A (en) * 2019-03-19 2019-06-28 深圳创维-Rgb电子有限公司 System file upgrade method, device, mobile terminal and readable storage medium storing program for executing
CN110569218A (en) * 2019-08-01 2019-12-13 厦门市美亚柏科信息股份有限公司 offline modification method and device for EXT file system and storage medium
CN110704156A (en) * 2019-08-16 2020-01-17 北京奇艺世纪科技有限公司 Docker mirror image construction method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109947450A (en) * 2019-03-19 2019-06-28 深圳创维-Rgb电子有限公司 System file upgrade method, device, mobile terminal and readable storage medium storing program for executing
CN110569218A (en) * 2019-08-01 2019-12-13 厦门市美亚柏科信息股份有限公司 offline modification method and device for EXT file system and storage medium
CN110704156A (en) * 2019-08-16 2020-01-17 北京奇艺世纪科技有限公司 Docker mirror image construction method and device

Also Published As

Publication number Publication date
CN111488194A (en) 2020-08-04

Similar Documents

Publication Publication Date Title
CN107180092B (en) File system control method and device and terminal
CN106407207B (en) Real-time newly-added data updating method and device
US11580061B2 (en) System and method for file archiving using machine learning
US8984027B1 (en) Systems and methods for migrating files to tiered storage systems
CN108763572A (en) A kind of method and apparatus for realizing Apache Solr read and write abruptions
KR20160100211A (en) Method and device for constructing on-line real-time updating of massive audio fingerprint database
CN109033365B (en) Data processing method and related equipment
US10114579B2 (en) Data migration tool with intermediate incremental copies
CN111382011B (en) File data access method and device and computer readable storage medium
CN115840731A (en) File processing method, computing device and computer storage medium
CN111488194B (en) Container preservation method, device, computer equipment and storage medium
CN113688139A (en) Object storage method, gateway, device and medium
CN113448946A (en) Data migration method and device and electronic equipment
CN102955808A (en) Data acquisition method and distributed file system
WO2023235040A1 (en) File system improvements for zoned storage device operations
CN106339183A (en) Data retrieving method and server
CN116578410A (en) Resource management method, device, computer equipment and storage medium
CN113326262B (en) Data processing method, device, equipment and medium based on key value database
CN109582938B (en) Report generation method and device
CN115061726A (en) Script file batch processing method, device, equipment, medium and program product
CN115421856A (en) Data recovery method and device
CN111435342B (en) Poster updating method, poster updating system and poster management system
EP4359943A1 (en) Configuration of default sensitivity labels for network file storage locations
CN114489481A (en) Method and system for storing and accessing data in hard disk
US20170147256A1 (en) Memory storage recycling

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
GR01 Patent grant
GR01 Patent grant