CN114356296A - Resource packaging method and device, electronic equipment and storage medium - Google Patents
Resource packaging method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN114356296A CN114356296A CN202111647999.5A CN202111647999A CN114356296A CN 114356296 A CN114356296 A CN 114356296A CN 202111647999 A CN202111647999 A CN 202111647999A CN 114356296 A CN114356296 A CN 114356296A
- Authority
- CN
- China
- Prior art keywords
- packaged
- resource
- packaging
- resources
- increment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 148
- 238000004806 packaging method and process Methods 0.000 title claims abstract description 113
- 230000008569 process Effects 0.000 claims abstract description 105
- 238000012858 packaging process Methods 0.000 claims abstract description 83
- 238000001514 detection method Methods 0.000 claims abstract description 45
- 238000004590 computer program Methods 0.000 claims description 6
- 238000012360 testing method Methods 0.000 abstract description 7
- 238000011161 development Methods 0.000 abstract description 6
- 230000000694 effects Effects 0.000 abstract description 6
- 238000004904 shortening Methods 0.000 abstract description 6
- 238000012856 packing Methods 0.000 description 33
- 230000006870 function Effects 0.000 description 20
- 238000012545 processing Methods 0.000 description 7
- 238000010586 diagram Methods 0.000 description 6
- 230000003287 optical effect Effects 0.000 description 6
- 230000004044 response Effects 0.000 description 4
- 239000013307 optical fiber Substances 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000000644 propagated effect Effects 0.000 description 2
- 238000003491 array Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000008901 benefit Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000006835 compression Effects 0.000 description 1
- 238000007906 compression Methods 0.000 description 1
- 230000008707 rearrangement Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 238000013522 software testing Methods 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 239000000725 suspension Substances 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Landscapes
- Debugging And Monitoring (AREA)
Abstract
The embodiment of the invention discloses a resource packaging method and device, electronic equipment and a storage medium. The method comprises the following steps: responding to the resource packaging request, and creating an increment detection process; acquiring a full amount of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the full amount of resources to be packaged; and creating an increment packaging process based on the increment to-be-packaged resource, and packaging the increment to-be-packaged resource based on the increment packaging process. The technical scheme of the embodiment of the invention solves the technical problems of larger memory resource consumption and longer packaging time consumption in the conventional resource packaging method, reduces the consumption of the memory resource, and shortens the resource packaging time, thereby achieving the technical effect of shortening the development period and the test period of the software project.
Description
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a resource packaging method and device, electronic equipment and a storage medium.
Background
Currently, most of software projects developed based on application programs need to use resource files. In the related art, the manner in which an application packs resource files in a software project is generally full-volume packing, so-called full-volume packing, that is, packing all resource files contained in a software project. In the software testing process, if the resource files in the software project need to be adjusted, all the resource files in the software project need to be packaged again before each test.
Because the number of resource files contained in a software project in an application program is large, the technical problems of large memory resource consumption and long packaging time consumption exist in each resource packaging process, and therefore the development cycle and the test cycle of the project are greatly influenced.
Disclosure of Invention
The embodiment of the invention provides a resource packaging method, a resource packaging device, electronic equipment and a storage medium, which are used for reducing the consumption of memory resources and shortening the resource packaging time, thereby achieving the technical effects of shortening the development period and the test period of a software project.
In a first aspect, an embodiment of the present invention provides a resource packing method, where the method includes:
responding to the resource packaging request, and creating an increment detection process;
acquiring a full amount of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the full amount of resources to be packaged;
and creating an increment packaging process based on the increment to-be-packaged resource, and packaging the increment to-be-packaged resource based on the increment packaging process.
In a second aspect, an embodiment of the present invention further provides a resource packaging apparatus, where the apparatus includes:
the incremental process creating module is used for responding to the resource packaging request and creating an incremental detection process;
an increment to-be-packaged resource determining module, configured to obtain, based on the increment detection process, a full amount of resources to be packaged corresponding to the resource packaging request, and determine an increment to-be-packaged resource in the full amount of resources to be packaged;
and the increment to-be-packaged resource packaging module is used for creating an increment packaging process based on the increment to-be-packaged resource and packaging the increment to-be-packaged resource based on the increment packaging process.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
storage means for storing one or more programs;
when executed by the processor, cause the processor to implement a resource packaging method as provided by any of the embodiments of the invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the resource packaging method provided in any embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, the incremental detection process is established in response to the resource packaging request, so that the resources to be packaged contained in the total resources to be packaged can be detected. And then, based on the increment detection process, acquiring the total amount of resources to be packaged corresponding to the resource packaging request, and determining the increment resources to be packaged in the total amount of resources to be packaged, so that the packaged resources can be prevented from being packaged again. After the increment to-be-packaged resource is determined, an increment packaging process can be created based on the increment to-be-packaged resource, and then the increment to-be-packaged resource can be packaged based on the increment packaging process, so that the technical problems that in the prior art, the resource packaging method has high memory resource consumption and long resource packaging time are solved, the memory resource consumption is reduced, the resource packaging time is shortened, and the technical effects of shortening the development period and the test period of a software project are achieved.
Drawings
In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, a brief description is given below of the drawings used in describing the embodiments. It should be clear that the described figures are only views of some of the embodiments of the invention to be described, not all, and that for a person skilled in the art, other figures can be derived from these figures without inventive effort.
Fig. 1 is a flowchart illustrating a resource packaging method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a resource packaging method according to a second embodiment of the present invention;
fig. 3 is an exemplary diagram of packing incremental resources to be packed based on a resource packing method according to a second embodiment of the present invention;
fig. 4 is a schematic structural diagram of a resource packaging apparatus according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
It should be further noted that, for the convenience of description, only some but not all of the relevant aspects of the present invention are shown in the drawings. Before discussing exemplary embodiments in more detail, it should be noted that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although a flowchart may describe the operations (or steps) as a sequential process, many of the operations can be performed in parallel, concurrently or simultaneously. In addition, the order of the operations may be re-arranged. The process may be terminated when its operations are completed, but may have additional steps not included in the figure. The processes may correspond to methods, functions, procedures, subroutines, and the like.
Example one
Fig. 1 is a flowchart of a resource packaging method according to an embodiment of the present invention, where the embodiment is applicable to packaging resources, especially packaging incremental resources, and the method may be executed by a resource packaging apparatus, where the resource packaging apparatus may be implemented by software and/or hardware, and may be integrated in an electronic device such as a computer or a server.
As shown in fig. 1, the method of the present embodiment includes:
and S110, responding to the resource packaging request, and creating an increment detection process.
The resource packaging request can be understood as a request requiring resource packaging. The increment detection process can be understood as an executable file which is in a running state and has the function of detecting the increment to-be-packaged resource. The executable file with the function of detecting the incremental resources to be packaged can be an executable file obtained by compiling a program file with the function of detecting the incremental resources to be packaged. The number of incremental detection processes may be one, two, or more than two.
Specifically, for a received resource packaging request, a program file corresponding to the resource packaging request and having a function of detecting incremental resources to be packaged may be determined. And then loading the program file with the function of detecting the incremental resources to be packaged into the memory and allocating Central Processing Unit (CPU) resources to the program file with the function of detecting the incremental resources to be packaged. After the CPU resource is allocated to the program file having the function of detecting the incremental resource to be packaged, a process having the function of detecting the incremental resource to be packaged may be generated, that is, an incremental detection process may be generated.
It should be noted that there are various ways to generate a resource packaging request, and the specific way to generate the resource packaging request is not limited herein, for example, the resource packaging request may be generated when a resource packaging application is triggered, or a packaging instruction for resource packaging input by a user may be received, and the resource packaging request may be generated based on the received packaging instruction.
S120, acquiring the total quantity of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the total quantity of resources to be packaged.
Wherein, the total amount of resources to be packaged can be understood as all resources to be packaged contained in the software project. The incremental resources to be packaged can be understood as unpacked resources to be packaged. The total resource to be packaged may include the incremental resource to be packaged, or may not include the incremental resource to be packaged.
Specifically, after the incremental detection process is created, the incremental detection process in the ready state can be obtained. And storing the increment detection process in the ready state to a ready process queue in the system. The process in the ready state can be selected from the ready process queue by calling a preset process scheduling algorithm. When the process in the ready state selected from the ready process queue is an increment detection process, the state of the increment detection process can be adjusted from the ready state to an execution state. Furthermore, the full amount of resources to be packaged corresponding to the resource packaging request can be acquired through the increment detection process in the execution state, that is, all the resources to be packaged corresponding to the resource packaging request can be determined. And then all the resources to be packaged can be detected. After the detection, incremental resources to be packaged in all resources to be packaged can be determined.
It should be noted that the ready process queue may be understood as a queue for the presence of the incremental detection process in the ready state. It should be further noted that, in the embodiment of the present invention, the preset Process scheduling algorithm may be a First Come First Served (FCFS) algorithm, a short task priority (SPN) algorithm, a high Response Ratio priority (HRRN) algorithm, a Round Robin (RR) algorithm or a Virtual Round Robin (VRR) algorithm, which is not limited herein.
In order to facilitate management of the increment detection process in the execution state, after the state of the increment detection process is adjusted from the ready state to the execution state, the increment detection process in the execution state may be stored in a running process queue in the system. The running process queue may be understood as a queue for storing the incremental detection process in an execution state.
In order to reduce the occupation of the memory space, after determining the increment to-be-packed resource in the total to-be-packed resource, the increment detection process can be adjusted from the execution state to the suspension state. And then the increment detection process in the suspended state can be obtained. After the increment detection process in the suspended state is obtained, the increment detection process in the suspended state can be swapped out from the memory to the external memory, so that enough memory space is made for other processes.
Optionally, determining the incremental resources to be packaged in the full amount of resources to be packaged in the following manner:
and determining whether the resources to be packaged consistent with the resources to be packaged exist in the packaged resources or not aiming at each resource to be packaged in the full amount of resources to be packaged, and if not, taking the resources to be packaged as the incremental resources to be packaged.
Wherein, a packed resource can be understood as a resource that has completed packing. The full amount of resources to be packaged can include packaged resources and incremental resources to be packaged.
Specifically, after the full amount of resources to be packaged is obtained, each resource to be packaged in the full amount of resources to be packaged can be detected for each resource to be packaged in the full amount of resources to be packaged. And then whether the packaged resources exist in the total amount of resources to be packaged can be determined. If the packaged resources exist in the total amount of the resources to be packaged, whether the resources to be packaged consistent with the resources to be packaged exist in the packaged resources can be determined. If the resource to be packaged which is consistent with the resource to be packaged does not exist in the packaged resources, the resource to be packaged which is inconsistent with the packaged resource can be used as the incremental resource to be packaged.
Illustratively, the full amount of resources to be packaged comprises a resource to be packaged W1, a resource to be packaged W2, a resource to be packaged W3 and a resource to be packaged W4. Among the packaged resources are the resource to be packaged W1 and the resource to be packaged W2. Then the resource to be packaged W3 and the resource to be packaged W4 are incremental resources to be packaged.
Optionally, if the packed resources do not exist in the full amount of resources to be packed, the full amount of resources to be packed may be used as the incremental resources to be packed, so that the full amount of resources to be packed may be packed.
Optionally, if a resource to be packaged consistent with the resource to be packaged exists in the packaged resources, the resource to be packaged consistent with the packaged resource may be determined. After the determination, the resource to be packaged consistent with the packaged resource can be labeled, so that the resource to be packaged consistent with the packaged resource can be rapidly identified in the subsequent resource packaging process, and the resource packaging efficiency is improved.
Optionally, how to determine whether there is a resource to be packaged consistent with the resource to be packaged in the packaged resources is described by the following steps:
step one, determining a preset Hash algorithm corresponding to the resource to be packaged, and calculating the current Hash value of the resource to be packaged according to the preset Hash algorithm.
The predetermined Hash Algorithm may be various, for example, a fifth generation Message Digest Algorithm (Message Digest Algorithm MD5, MD5), a RACE original integrity check Message Digest (ripem 160), a Secure Hash Algorithm 1(Secure Hash Algorithm 1, SHA-1), or a Secure Hash Algorithm 2(Secure Hash Algorithm 2, SHA-2), and the specific Algorithm is not limited herein. The preset hash algorithm can be used for calculating the hash value of the resource to be packaged. The current hash value can be understood as the hash value of the resource to be packaged currently. It should be noted that the hash algorithms corresponding to different types of resources to be packaged may be the same or different.
Specifically, the corresponding relationship between the type of the resource to be packaged and the hash algorithm may be preset. For each resource to be packaged in the total amount of resources to be packaged, the type of the current resource to be packaged can be determined. And then determining the hash algorithm corresponding to the current resource to be packaged according to the preset corresponding relation between the type of the resource to be packaged and the hash algorithm. After the hash algorithm of the current resource to be packaged is determined, the hash value of the current resource to be packaged can be calculated by calling the hash algorithm corresponding to the current resource to be packaged, that is, the current hash value of the resource to be packaged can be obtained.
In order to more quickly determine whether the packaged resources have the resources to be packaged consistent with the resources to be packaged, the current hash value of the resources to be packaged can be calculated according to a preset hash algorithm in the following way:
and reading a target character string in the character string to be converted corresponding to the resource to be packaged according to the length of the preset character string, and converting the target character string into a current hash value through a preset hash algorithm.
The preset character length may be set according to an actual situation, for example, the preset character length may be 16 blocks. It should be noted that the preset character lengths corresponding to different types of resources to be packaged may be the same or different. The character string to be converted may be a character string corresponding to the resource content included in the resource to be packaged. The target character string may be a character string with a preset character string length in a character string to be converted corresponding to the resource to be packaged, and may be used to calculate a current hash value of the resource to be packaged. In practical applications, the target character string may be selected by selecting a character string with a preset character string length from the initial character string of the character string to be converted.
Specifically, by reading the resource content of the resource to be packaged, the character string to be converted of the resource to be packaged can be determined according to the resource content of the resource to be packaged. And then reading the character string in the character string to be converted of the resource to be packaged according to the preset length of the character string. And then the target character string in the character string to be converted corresponding to the resource to be packaged can be read. After the target character string is read, the hash value of the target character string can be calculated through a preset hash algorithm, and the calculated hash value is used as the current hash value of the resource to be packaged.
Optionally, for preset hash algorithms corresponding to different types of preset resources to be packaged, before the target character string is converted into the current hash value by the preset hash algorithm, the type of the resource to be packaged may be determined. And then determining the hash algorithm corresponding to the resource to be packaged according to the type of the resource to be packaged. After the hash algorithm of the resource to be packaged is determined, the target character string corresponding to the resource to be packaged can be converted into the current hash value of the resource to be packaged by calling the hash algorithm corresponding to the resource to be packaged, that is, the hash value of the resource to be packaged is calculated by calling the hash algorithm corresponding to the resource to be packaged.
And step two, determining whether the packaged resources have the resources to be packaged consistent with the resources to be packaged according to the resource identifiers of the resources to be packaged and the current hash values of the resources to be packaged.
Wherein, the resource identifier can be understood as the resource name of the resource to be packaged. In order to facilitate faster determination of the resource identifier and/or the current hash value of the resource to be packaged, the resource identifier and the current hash value of the resource to be packaged may be spliced based on a preset splicer, where the preset splicer may be multiple, and is not limited herein, such as, +, _ or-, etc. It should be further noted that the resource identifier of the resource to be packaged may be before or after the preset connector, and is not specifically limited herein, for example, the resource identifier + the current hash value, or the current hash value + the resource identifier.
Specifically, a resource identifier and a current hash value of the resource to be packaged are determined, and a resource identifier and a hash value of the packaged resource are determined. After the determination, the resource identifier of the resource to be packaged and the resource identifier of the packaged resource may be compared, and the current hash value of the resource to be packaged and the hash value of the packaged resource may be compared. And then determining whether the packaged resources have the resources to be packaged consistent with the resources to be packaged.
How to determine whether the resources to be packaged consistent with the resources to be packaged exist in the packaged resources according to the resource identifiers of the resources to be packaged and the current hash values of the resources to be packaged is introduced in the following two ways:
as an optional embodiment of the present invention, the resource identifier of the resource to be packaged and the resource identifier of the packaged resource may be compared, and if the resource identifiers are not consistent, it may be determined that the resource to be packaged which is consistent with the resource to be packaged does not exist in the packaged resource. If the resource identifiers are in accordance with each other, the current hash value of the resource to be packaged can be compared with the hash value of the packaged resource, and if the hash values are not in accordance with each other, it can be determined that the resource to be packaged which is in accordance with the resource to be packaged does not exist in the packaged resource. If the hash values are consistent in comparison, it can be determined that one type of resource to be packaged exists in the packaged resources.
As an optional embodiment in the embodiment of the present invention, the current hash value of the resource to be packaged and the hash value of the packaged resource may be compared. If the hash values are not consistent, determining that the resource to be packaged consistent with the resource to be packaged exists in the packaged resource. If the hash values are consistent in comparison, the resource identifier of the resource to be packaged and the resource identifier of the packaged resource can be compared. If the hash values are consistent in comparison, it can be determined that the resource to be packaged consistent with the resource to be packaged exists in the packaged resource. If the hash value comparison is inconsistent, it can be determined that the resource to be packaged which is consistent with the resource to be packaged does not exist in the packaged resource.
Optionally, determining whether the resource to be packaged consistent with the resource to be packaged exists in the packaged resource according to the resource identifier of the resource to be packaged and the current hash value of the resource to be packaged in the following manner:
and if the resource identifier of the resource to be packaged and the current hash value of the resource to be packaged are consistent with the resource identifier of the packaged resource and the stored hash value stored in the resource information storage list, determining that the resource to be packaged consistent with the resource to be packaged exists in the packaged resource, otherwise, determining that the resource to be packaged consistent with the resource to be packaged does not exist in the packaged resource.
The resource information storage list may be a storage list generated based on the resource identifier and the hash value of the packaged resource, and is used for storing the resource identifier and the hash value of the packaged resource, so as to facilitate uniform management of the packaged resource. Optionally, the resource information storage list may store at least one of a resource type, a resource format, and a resource size.
Specifically, whether a resource identifier consistent with the resource identifier of the resource to be packaged exists can be queried from the resource information storage list. If so, comparing the current hash value with a stored hash value stored in the resource information storage list and corresponding to the resource identifier. If the hash values are consistent, determining that the resources to be packaged consistent with the resources to be packaged exist in the packaged resources. Otherwise, it may be determined that there is no resource to be packed in the packed resources that is consistent with the resource to be packed.
Illustratively, the resource information storage list is table 1.
TABLE 1
Resource identification | Hash value |
Resource identification A1 | Hash value A2 |
Resource identification B1 | Hash value B2 |
If the resource identifier of the resource to be packaged is the resource identifier C1, and the current hash value is the hash value C2. The resource identifications a1 and B1 in table 1 are not consistent with the resource identification C1 of the resource to be packaged. Then the resource may be identified as resource identification C1 and the resource to be packaged with the current hash value of hash value C2 may be treated as the incremental resource to be packaged. If the resource identification of the resource to be packaged is A1, the current hash value is A3. If the resource identifier a1 exists in table 1, comparing the hash value a2 corresponding to the resource identifier a1 with the current hash value A3 of the resource to be packaged, it may be determined that the resource to be packaged having the resource identifier a1 and the current hash value A3 is the incremental resource to be packaged.
It is understood that whether a hash value consistent with the current hash value of the resource to be packaged exists can be queried from the resource information storage list. If so, the resource identifier can be compared with the resource identifier corresponding to the current hash value stored in the resource information storage list. If the resource identifiers are consistent in comparison, it can be determined that the to-be-packaged resource consistent with the to-be-packaged resource exists in the packaged resource. Otherwise, it may be determined that the resource to be packaged corresponding to the resource to be packaged does not exist in the packaged resources.
Optionally, after the current resource to be packaged is packaged, the resource identifier and the hash value of the currently packaged resource to be packaged may be stored in the resource information storage list, so as to update the information stored in the resource information storage list, so as to package the incremental resource to be packaged subsequently.
S130, creating an increment packaging process based on the increment to-be-packaged resource, and packaging the increment to-be-packaged resource based on the increment packaging process.
The increment packaging process can be understood as an executable file which is in a running state and has a function of packaging the increment to-be-packaged file, wherein the executable file which has the function of packaging the increment to-be-packaged file can be an executable file obtained by compiling a program file which has the function of packaging the increment to-be-packaged file. The incremental packaging process may be used to package the incremental resources to be packaged. The number of incremental packing processes may be one, two, or more than two.
Specifically, after determining the incremental to-be-packaged resource, a program file having a function of packaging the incremental to-be-packaged file may be loaded. After the loading of the program file is completed, the program file with the function of packaging the incremental file to be packaged can be compiled. And then an executable file with a function of packaging the incremental files to be packaged can be generated. And then the executable file with the function of packaging the incremental files to be packaged can be run, namely an incremental packaging process is created. After the creation of the increment packaging process is completed, the created increment packaging process can be stored to a ready process queue in the system. When the process selected from the ready process queue is an increment packaging process, the ready state of the increment packaging process can be adjusted to the execution state. And then the increment packaging process in the execution state can package the increment to-be-packaged resource.
Optionally, after the incremental packaging process completes packaging of all the incremental resources to be packaged, the incremental packaging process may be adjusted from the execution state to the suspended state. And then the increment packaging process in the suspended state can be obtained. After the increment packaging process in the suspended state is obtained, the increment packaging process in the suspended state can be swapped out from the internal memory to the external memory, so that enough internal memory space is made for other processes.
In order to improve the security of the resources, before the incremental resources to be packaged are packaged, the incremental resources to be packaged can be encrypted by calling a predefined encryption algorithm. On the basis, in order to reduce the occupation of the resource storage space, the incremental resource to be packaged can be compressed by calling a preset compression algorithm.
According to the technical scheme of the embodiment of the invention, the incremental detection process is established in response to the resource packaging request, so that the resources to be packaged contained in the total resources to be packaged can be detected. And then, the full amount of resources to be packaged corresponding to the resource packaging request can be obtained based on the increment detection process, the increment resources to be packaged in the full amount of resources to be packaged are determined, and the packaged resources can be prevented from being packaged again. After the increment to-be-packaged resource is determined, an increment packaging process can be created based on the increment to-be-packaged resource, and then the increment to-be-packaged resource can be packaged based on the increment packaging process, so that the technical problems that in the prior art, the resource packaging method has high memory resource consumption and long resource packaging time are solved, the memory resource consumption is reduced, the resource packaging time is shortened, and the technical effects of shortening the development period and the test period of a software project are achieved.
Example two
Fig. 2 is a flowchart of a resource packing method provided in the second embodiment of the present invention, and on the basis of the foregoing embodiment, optionally, the creating an incremental packing process based on the incremental resource to be packed includes: and determining the creating number of the incremental packaging processes based on the incremental to-be-packaged resources and the process configuration information, and creating the incremental packaging processes according to the creating number of the incremental packaging processes. The technical terms that are the same as or corresponding to the above embodiments are not repeated herein.
As shown in fig. 2, the method of the embodiment may specifically include:
s210, responding to the resource packaging request, and creating an increment detection process.
S220, acquiring the total quantity of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the total quantity of resources to be packaged.
S230, determining the creating number of the incremental packaging processes based on the incremental resources to be packaged and the process configuration information, and creating the incremental packaging processes according to the creating number of the incremental packaging processes.
The process configuration information may include a corresponding relationship between the number of incremental resources to be packed and the number of incremental packing processes, for example, 500 incremental resources to be packed correspond to 1 incremental packing process. Or, the corresponding relationship between the size of the increment to-be-packed resource and the number of the increment packing processes, for example, an increment to-be-packed resource of 10M corresponds to 1 increment packing process. The size of the incremental resource to be packaged may be a single incremental resource to be packaged, or may be the sum of the sizes of the incremental resources to be packaged. In this embodiment, the advantage of setting the process configuration information is that the incremental packaging process can be flexibly configured.
In one embodiment, the process configuration information includes a correspondence between the number of incremental resources to be packed and the number of incremental packing processes, and after determining the incremental resources to be packed, the total number of the incremental resources to be packed may be determined. And then, the creating number of the incremental packaging processes can be determined based on the corresponding relation between the number of the incremental resources to be packaged and the number of the incremental packaging processes preset in the process configuration information. And then the increment packaging process can be created according to the creation number of the increment packaging process. On the basis, the created quantity of increment packaging processes are stored into a ready process queue in the system, so that the increment to-be-packaged resources are packaged based on the created increment packaging processes.
In another embodiment, the process configuration information includes a corresponding relationship between the size of the incremental resource to be packaged and the number of incremental packaging processes, and after the incremental resource to be packaged is determined, the size of the incremental resource to be packaged can be determined. And then determining the creating number of the increment packaging processes based on the corresponding relation between the size of the increment to-be-packaged resource included in the process configuration information and the number of the increment packaging processes. The incremental packaging process can then be created based on the number of incremental packaging processes created.
Optionally, an incremental packaging process is created according to the number of created incremental packaging processes in the following manner:
and creating the increment packaging process according to the creation number of the increment packaging processes and the available memory space at the current moment, so that the creation of invalid increment packaging processes can be avoided.
S240, when the number of the created increment packaging processes is two or more, packaging the increment to-be-packaged resources in parallel through the two or more increment packaging processes.
The method for packaging the incremental resource to be packaged in parallel through two or more incremental packaging processes can be understood as that one incremental packaging process packages the incremental resource to be packaged in a first time period, and another one or more incremental packaging processes package the incremental resource to be packaged in a second time period, wherein the first time period and the second time period have overlapped time periods, and a first time period and a second time period before the first time period and the second time period are to be described to distinguish different time periods, not to sort the time periods or to limit the content. It can be understood that each increment packing process packs the increment to-be-packed resource corresponding to each increment.
Exemplary incremental resource groups include incremental resource group S1, incremental resource group S2, and incremental resource group S3. Wherein each incremental resource group can comprise one or more incremental resources to be packaged. The number of resource packing processes is 2, and is increment packing process T1, increment packing process T2 and increment packing process T3 respectively. Referring to fig. 3, the increment packing process T1 packs the increment to-be-packed resources in the increment resource group S1 in the time period T1-T3, and the increment packing process T2 packs the increment to-be-packed resources in the increment resource group S2 in the time period T2-T4, where there is an overlapping time period T2-T3 between the time period T1-T3 and the time period T2-T4.
In practical application, the number of the increment packing processes is large, so that in order to avoid the occurrence of the previous packing process in a deadlock state, corresponding system resources can be allocated to each increment packing process before the increment to-be-packed resources are packed in parallel through two or more increment packing processes, and the condition that a plurality of increment packing processes strive for the system resources can be avoided.
According to the technical scheme of the embodiment of the invention, after the increment to-be-packaged resources in the full amount of to-be-packaged resources are determined, the creation number of the increment packaging processes can be determined based on the increment to-be-packaged resources and the process configuration information. The process configuration information can flexibly configure the number of processes to be created. After determining the number of incremental packaging processes to create, an incremental packaging process can be created based on the number of incremental packaging processes to create. When the number of the created increment packaging processes is two or more, the increment resources to be packaged can be packaged in parallel through the two or more increment packaging processes, the technical problems that in the resource packaging method in the prior art, the packaging speed is low, the resource packaging time is long, and the resource packaging flexibility is low are solved, and the technical effect of more flexibly, quickly and effectively packaging the increment resources to be packaged is realized.
EXAMPLE III
Fig. 4 is a schematic structural diagram of a resource packaging apparatus according to a third embodiment of the present invention, where the present invention provides a resource packaging apparatus, including: an increment process creation module 310, an increment to-be-packaged resource determination module 320, and an increment to-be-packaged resource packaging module 330.
The incremental process creating module 310 is configured to create an incremental detection process in response to the resource packaging request; an increment to-be-packaged resource determining module 320, configured to obtain, based on the increment detection process, a full amount of resources to be packaged corresponding to the resource packaging request, and determine an increment to-be-packaged resource in the full amount of resources to be packaged; and the increment to-be-packaged resource packaging module 330 is configured to create an increment packaging process based on the increment to-be-packaged resource, and package the increment to-be-packaged resource based on the increment packaging process.
According to the technical scheme of the embodiment of the invention, the incremental process creating module responds to the resource packaging request to create the incremental detection process, so that the resources to be packaged contained in the full amount of resources to be packaged can be detected. And then, the incremental to-be-packaged resource determining module can acquire the full amount of to-be-packaged resources corresponding to the resource packaging request based on the incremental detection process, determine the incremental to-be-packaged resources in the full amount of to-be-packaged resources, and avoid packaging the packaged resources again. After the increment to-be-packaged resource is determined, an increment packaging process can be created based on the increment to-be-packaged resource through an increment to-be-packaged resource packaging module, and then the increment to-be-packaged resource can be packaged based on the increment packaging process, so that the technical problems that in the prior art, the resource packaging method has large memory resource consumption and long resource packaging time are solved, the memory resource consumption is reduced, the resource packaging time is shortened, and the technical effects of shortening the development period and the test period of a software project are achieved.
Optionally, the incremental resource-to-be-packaged determining module 320 is configured to determine, for each resource-to-be-packaged in the full amount of resources-to-be-packaged, whether a resource-to-be-packaged consistent with the resource-to-be-packaged exists in the packaged resources, and if not, take the resource-to-be-packaged as the incremental resource-to-be-packaged.
Optionally, the incremental resource to be packaged determining module 320 is configured to determine a preset hash algorithm corresponding to the resource to be packaged, and calculate a current hash value of the resource to be packaged according to the preset hash algorithm; and determining whether the packaged resources have the resources to be packaged consistent with the resources to be packaged according to the resource identifiers of the resources to be packaged and the current hash values of the resources to be packaged.
Optionally, the incremental resource-to-be-packaged determining module 320 is configured to determine that a resource to be packaged consistent with the resource to be packaged exists in the packaged resource if the resource identifier of the resource to be packaged and the current hash value of the resource to be packaged are consistent with the resource identifier of the packaged resource and the stored hash value stored in the resource information storage list, and otherwise, determine that a resource to be packaged consistent with the resource to be packaged does not exist in the packaged resource.
Optionally, the incremental resource to be packaged determining module 320 is configured to read a target character string in a character string to be converted corresponding to the resource to be packaged according to a preset character string length, and convert the target character string into the current hash value through the preset hash algorithm.
Optionally, the incremental packaging-to-be-packaged resource packaging module 330 is configured to determine the number of created incremental packaging processes based on the incremental packaging-to-be-packaged resources and the process configuration information, and create the incremental packaging processes according to the number of created incremental packaging processes.
Optionally, the incremental resource to be packed packing module 330 is configured to pack the incremental resource to be packed in parallel through two or more incremental packing processes when the number of the created incremental packing processes is two or more.
The device can execute the resource packing method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the resource packing method.
It should be noted that, the units and modules included in the resource packaging apparatus are merely divided according to the functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the embodiment of the invention.
Example four
Fig. 5 is a schematic structural diagram of an electronic device according to a fourth embodiment of the present invention. FIG. 5 illustrates a block diagram of an exemplary electronic device 12 suitable for use in implementing any of the embodiments of the present invention. The electronic device 12 shown in fig. 5 is only an example and should not bring any limitation to the function and the scope of use of the embodiment of the present invention. The device 12 is typically an electronic device that undertakes the processing of configuration information.
As shown in FIG. 5, electronic device 12 is embodied in the form of a general purpose computing device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that couples the various components (including the memory 28 and the processing unit 16).
The processing unit 16 executes various functional applications and data processing by executing programs stored in the memory 28, for example, implementing the resource packaging method provided by the above-described embodiment of the present invention, the method includes:
responding to the resource packaging request, and creating an increment detection process; acquiring a full amount of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the full amount of resources to be packaged; and creating an increment packaging process based on the increment to-be-packaged resource, and packaging the increment to-be-packaged resource based on the increment packaging process.
Of course, those skilled in the art can understand that the processor can also implement the technical solution of the resource packing method provided in any embodiment of the present invention.
EXAMPLE five
An embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor, and is characterized in that, for example, the resource packaging method provided in the foregoing embodiment of the present invention includes:
responding to the resource packaging request, and creating an increment detection process; acquiring a full amount of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the full amount of resources to be packaged; and creating an increment packaging process based on the increment to-be-packaged resource, and packaging the increment to-be-packaged resource based on the increment packaging process.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims (10)
1. A method for resource packaging, comprising:
responding to the resource packaging request, and creating an increment detection process;
acquiring a full amount of resources to be packaged corresponding to the resource packaging request based on the increment detection process, and determining the increment resources to be packaged in the full amount of resources to be packaged;
and creating an increment packaging process based on the increment to-be-packaged resource, and packaging the increment to-be-packaged resource based on the increment packaging process.
2. The method of claim 1, wherein the determining incremental to-be-packaged resources of the full amount of to-be-packaged resources comprises:
and determining whether the packaged resources have the resources to be packaged consistent with the resources to be packaged or not aiming at each resource to be packaged in the total resources to be packaged, and if not, taking the resources to be packaged as the incremental resources to be packaged.
3. The method of claim 2, wherein the determining whether the packaged resource has a resource to be packaged consistent with the resource to be packaged comprises:
determining a preset hash algorithm corresponding to the resource to be packaged, and calculating the current hash value of the resource to be packaged according to the preset hash algorithm;
and determining whether the packaged resources have the resources to be packaged consistent with the resources to be packaged according to the resource identifiers of the resources to be packaged and the current hash values of the resources to be packaged.
4. The method of claim 3, wherein the determining whether the resource to be packaged consistent with the resource to be packaged exists in the packaged resource according to the resource identifier of the resource to be packaged and the current hash value of the resource to be packaged comprises:
and if the resource identifier of the resource to be packaged and the current hash value of the resource to be packaged are consistent with the resource identifier of the packaged resource and the storage hash value stored in the resource information storage list, determining that the resource to be packaged consistent with the resource to be packaged exists in the packaged resource, otherwise, determining that the resource to be packaged consistent with the resource to be packaged does not exist in the packaged resource.
5. The method according to claim 3, wherein the calculating the current hash value of the resource to be packaged according to the preset hash algorithm comprises:
and reading a target character string in the character string to be converted corresponding to the resource to be packaged according to the length of the preset character string, and converting the target character string into a current hash value through the preset hash algorithm.
6. The method of claim 1, wherein creating a delta packaging process based on the delta to be packaged resource comprises:
and determining the creating number of the incremental packaging processes based on the incremental to-be-packaged resources and the process configuration information, and creating the incremental packaging processes according to the creating number of the incremental packaging processes.
7. The method of claim 6, wherein the packaging the incremental resources to be packaged based on the incremental packaging process comprises:
and when the number of the created increment packaging processes is two or more, packaging the increment resources to be packaged in parallel through the two or more increment packaging processes.
8. A resource packaging apparatus, comprising:
the incremental process creating module is used for responding to the resource packaging request and creating an incremental detection process;
an increment to-be-packaged resource determining module, configured to obtain, based on the increment detection process, a full amount of resources to be packaged corresponding to the resource packaging request, and determine an increment to-be-packaged resource in the full amount of resources to be packaged;
and the increment to-be-packaged resource packaging module is used for creating an increment packaging process based on the increment to-be-packaged resource and packaging the increment to-be-packaged resource based on the increment packaging process.
9. An electronic device, characterized in that the electronic device comprises:
one or more processors;
storage means for storing one or more programs;
when executed by the processor, cause the processor to implement the resource packaging method of any of claims 1-7.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method for packaging resources according to any one of claims 1 to 7.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111647999.5A CN114356296A (en) | 2021-12-30 | 2021-12-30 | Resource packaging method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111647999.5A CN114356296A (en) | 2021-12-30 | 2021-12-30 | Resource packaging method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114356296A true CN114356296A (en) | 2022-04-15 |
Family
ID=81103208
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111647999.5A Pending CN114356296A (en) | 2021-12-30 | 2021-12-30 | Resource packaging method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114356296A (en) |
Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090276770A1 (en) * | 2008-04-30 | 2009-11-05 | International Business Machines Corporation | Systems, methods and computer program products for automating packaging and provisioning of j2ee web modules to eclipse-based rich clients |
US20140208320A1 (en) * | 2013-01-24 | 2014-07-24 | International Business Machines Corporation | Creating a virtual resource package |
WO2015126079A1 (en) * | 2014-02-21 | 2015-08-27 | 주식회사 안랩 | Method and apparatus for detecting repackaging |
CN110347398A (en) * | 2018-04-08 | 2019-10-18 | 阿里巴巴集团控股有限公司 | A kind of packaging method and device of application program |
CN111104150A (en) * | 2019-11-28 | 2020-05-05 | 浪潮金融信息技术有限公司 | Software increment packaging method based on SVN file comparison technology |
CN111651193A (en) * | 2020-06-03 | 2020-09-11 | 上海米哈游天命科技有限公司 | Information packaging method, device, equipment and medium |
CN111796861A (en) * | 2020-06-28 | 2020-10-20 | 上海米哈游天命科技有限公司 | Packaging method and device, electronic equipment and storage medium |
WO2020233057A1 (en) * | 2019-05-21 | 2020-11-26 | 深圳壹账通智能科技有限公司 | File packaging method, apparatus and device, and storage medium |
CN111991811A (en) * | 2020-07-06 | 2020-11-27 | 广州西山居世游网络科技有限公司 | Deep multi-process packaging method and device based on Unity and readable medium |
CN112035187A (en) * | 2020-09-16 | 2020-12-04 | 北京思明启创科技有限公司 | Resource loading and packing method, device, equipment and medium |
CN112732314A (en) * | 2020-12-30 | 2021-04-30 | 北京一亩田新农网络科技有限公司 | Plug-in differential packaging method and device based on android, electronic equipment and computer readable medium |
CN113127050A (en) * | 2021-04-28 | 2021-07-16 | 上海米哈游璃月科技有限公司 | Application resource packaging process monitoring method, device, equipment and medium |
-
2021
- 2021-12-30 CN CN202111647999.5A patent/CN114356296A/en active Pending
Patent Citations (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20090276770A1 (en) * | 2008-04-30 | 2009-11-05 | International Business Machines Corporation | Systems, methods and computer program products for automating packaging and provisioning of j2ee web modules to eclipse-based rich clients |
US20140208320A1 (en) * | 2013-01-24 | 2014-07-24 | International Business Machines Corporation | Creating a virtual resource package |
WO2015126079A1 (en) * | 2014-02-21 | 2015-08-27 | 주식회사 안랩 | Method and apparatus for detecting repackaging |
CN110347398A (en) * | 2018-04-08 | 2019-10-18 | 阿里巴巴集团控股有限公司 | A kind of packaging method and device of application program |
WO2020233057A1 (en) * | 2019-05-21 | 2020-11-26 | 深圳壹账通智能科技有限公司 | File packaging method, apparatus and device, and storage medium |
CN111104150A (en) * | 2019-11-28 | 2020-05-05 | 浪潮金融信息技术有限公司 | Software increment packaging method based on SVN file comparison technology |
CN111651193A (en) * | 2020-06-03 | 2020-09-11 | 上海米哈游天命科技有限公司 | Information packaging method, device, equipment and medium |
CN111796861A (en) * | 2020-06-28 | 2020-10-20 | 上海米哈游天命科技有限公司 | Packaging method and device, electronic equipment and storage medium |
CN111991811A (en) * | 2020-07-06 | 2020-11-27 | 广州西山居世游网络科技有限公司 | Deep multi-process packaging method and device based on Unity and readable medium |
CN112035187A (en) * | 2020-09-16 | 2020-12-04 | 北京思明启创科技有限公司 | Resource loading and packing method, device, equipment and medium |
CN112732314A (en) * | 2020-12-30 | 2021-04-30 | 北京一亩田新农网络科技有限公司 | Plug-in differential packaging method and device based on android, electronic equipment and computer readable medium |
CN113127050A (en) * | 2021-04-28 | 2021-07-16 | 上海米哈游璃月科技有限公司 | Application resource packaging process monitoring method, device, equipment and medium |
Non-Patent Citations (2)
Title |
---|
U011480276: "游戏增量包打包工具", pages 1 - 4, Retrieved from the Internet <URL:《https://blog.csdn.net/zslblog/article/details/97628155》> * |
环境保护部环境监测司等: "《国家重点生态功能区县域生态环境质量考核工作手册》", 31 December 2012, 北京:中国环境科学出版社, pages: 370 - 372 * |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110297689B (en) | Intelligent contract execution method, device, equipment and medium | |
US9582312B1 (en) | Execution context trace for asynchronous tasks | |
US9465734B1 (en) | Coalition based memory management | |
CN110908697B (en) | Resource packaging method, device, server and storage medium | |
CN105278996A (en) | Log collection method and device and log service system | |
CN109358956B (en) | Service calling method | |
US11016886B2 (en) | Multi-ring shared, traversable, and dynamic advanced database | |
CN108062235B (en) | Data processing method and device | |
CN113010265A (en) | Pod scheduling method, scheduler, memory plug-in and system | |
US20240095174A1 (en) | Method for detecting error of operating system kernel memory in real time | |
US9870314B1 (en) | Update testing by build introspection | |
WO2021218208A1 (en) | Resource allocation method and apparatus, storage medium, and electronic device | |
CN110908707A (en) | Resource packaging method, device, server and storage medium | |
CN113050984A (en) | Resource calling method and device, electronic equipment and storage medium | |
CN115309499A (en) | Method and device for processing numerical groups in virtual machine, electronic equipment and readable storage medium | |
CN118250206A (en) | High concurrency pressure testing method and related device based on flow playback | |
US20090055807A1 (en) | Fast image loading mechanism in cell spu | |
US9064042B2 (en) | Instrumenting computer program code by merging template and target code methods | |
CN114356296A (en) | Resource packaging method and device, electronic equipment and storage medium | |
CN114020414B (en) | Android system and bottom Linux symbiotic method and device, electronic equipment and storage medium | |
CN106991058B (en) | Method and device for processing pre-fetched files | |
CN113312120B (en) | Method, device, electronic equipment and medium for executing C + + task in virtual machine | |
CN110879747B (en) | Resource management method and device | |
CN114091111B (en) | Method and device for storing intelligent contracts of block chains | |
CN112084827B (en) | Data processing method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |