Function package generation and loading method and device, electronic equipment, medium and program product
By separating metadata files and layer files for storage, the problems of excessively large packages and high permission requirements in traditional package loading technologies are solved, enabling more efficient package loading and generation and improving user experience.
Patent Information
- Application Number
- CN202210399783.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2042-04-15
AI Technical Summary
Traditional function package loading technology has the problem of the package being too large and requiring high permissions to run, resulting in a poor user experience.
By adopting a separate storage method for metadata files and layer files, the layer files that have not been retrieved are indicated and loaded by obtaining the metadata files, thereby reducing the amount of data and enabling the loading and generation of function packages.
Reduces storage space and loading time, lowers traffic costs, adapts to various computing device environments, does not require high privileges to run, and improves user experience.
Smart Images

Figure CN114860267B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present disclosure generally relate to the field of distributed computing, and in particular, to a function package loading method, a function package generation method, an apparatus, an electronic device, a computer readable storage medium, and a computer program product. BACKGROUND
[0002] A multi-party secure computing platform allows multiple institutions to participate in jointly completing a modeling task while ensuring that the privacy data of each institution is not disclosed. In order to achieve the foregoing purpose, the multi-party secure computing platform needs to deploy one or more computing units locally at each institution. The local computing unit is used to process the local data of the institution, and can exchange random numbers or encrypted data with the computing units deployed at other institutions to achieve the purpose of jointly modeling without disclosing privacy data. In order to adapt to different modeling tasks, the multi-party secure computing platform provides a plurality of different computing units, such as a logistic regression (LR) computing unit, an Xgboost computing unit, and various preprocessing computing units, etc. Different computing units can be encapsulated into different function modules, and can be encapsulated in the form of a package. When an institution needs to use a certain function, the function package corresponding to the function to be used can be obtained in the form of real-time downloading through a network, for example.
[0003] However, the function package used by the conventional function package loading technology is usually very large, and can reach a size of several GB or even larger. In addition, the function package used by the conventional function package loading technology often requires that the corresponding computing unit be installed on a physical machine, and often requires root permission to operate normally. Therefore, the conventional function package loading technology is inconvenient for users. SUMMARY
[0004] Embodiments of the present disclosure provide a function package loading method, a function package generation method, an apparatus, an electronic device, a computer readable storage medium, and a computer program product.
[0005] In a first aspect of the present disclosure, a function package loading method is provided, which includes: obtaining a metadata file in a target function package from a function package library, the metadata file indicating at least one layer file in the target function package; and based on the metadata file and information related to the layer files that have been obtained, obtaining the layer files in the target function package that have not been obtained from the function package library.
[0006] In a second aspect of the present disclosure, a function package generation method is provided, which includes: generating a function package for at least partially implementing a predetermined function, the function package including a metadata file and at least one layer file, the metadata file indicating the at least one layer file, and the at least one layer file including an executable file.
[0007] In a third aspect of the present disclosure, a functional package loading apparatus is provided, the apparatus comprising: a first metadata obtaining module configured to obtain a metadata file in a target functional package from a functional package library, the metadata file indicating at least one layer file in the target functional package; and a first layer file obtaining module configured to obtain an unobtained layer file in the target functional package from the functional package library based on the metadata file and information about obtained layer files.
[0008] In a fourth aspect of the present disclosure, a functional package generating apparatus is provided, the apparatus comprising: a functional package generating module configured to generate a functional package for at least partially implementing a predetermined function, the functional package comprising a metadata file and at least one layer file, the metadata file indicating the at least one layer file, and the at least one layer file comprising an executable file.
[0009] In a fifth aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to the first aspect of the present disclosure or the second aspect of the present disclosure.
[0010] In a sixth aspect of the present disclosure, a computer-readable storage medium is provided, having stored thereon one or more computer instructions executable by a processor to implement the method according to the first aspect of the present disclosure or the second aspect of the present disclosure.
[0011] In a seventh aspect of the present disclosure, a computer program product is provided, comprising a computer program executable by a processor to perform the method according to the first aspect of the present disclosure or the second aspect of the present disclosure.
[0012] With the technical solution according to the present disclosure, a functional package loading and generating method is provided, and the technical solution of the present disclosure can reduce the amount of data to be obtained when loading a functional package, thereby not only saving storage space, but also reducing the time and traffic required for loading a functional package, and thus improving the user experience of users of a computing platform.
[0013] The summary section is provided to introduce selected concepts in a simplified form, which will be further described below in the detailed description. The summary section is not intended to identify key or essential features of embodiments of the present disclosure, nor is it intended to limit the scope of embodiments of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0014] The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings in which like reference characters refer to like parts throughout the several views.
[0015] Figure 1A A schematic diagram of a function package loading environment 100A in which a function package loading method in certain embodiments of the present disclosure can be implemented is shown;
[0016] Figure 1A A schematic diagram of a function package loading environment 100B in which a function package loading method in certain embodiments of the present disclosure can be implemented is shown;
[0017] Figure 2 A flowchart of a function package loading method 200 according to an embodiment of the present disclosure is shown;
[0018] Figure 3 A schematic diagram of a function package storage format 300 according to an embodiment of the present disclosure is shown;
[0019] Figure 4 A schematic diagram of a metadata file code 400 according to an embodiment of the present disclosure is shown;
[0020] Figure 5 A flowchart of another function package loading method 500 according to an embodiment of the present disclosure is shown;
[0021] Figure 6 A flowchart of a function package generation method 600 according to an embodiment of the present disclosure is shown;
[0022] Figure 7 A schematic block diagram of a function package loading apparatus 700 according to an embodiment of the present disclosure is shown;
[0023] Figure 8 A schematic block diagram of a function package generation apparatus 800 according to an embodiment of the present disclosure is shown; and
[0024] Figure 9 A schematic block diagram of an example device 900 that can be used to implement embodiments of the present disclosure is shown.
[0025] In the various drawings, like reference numerals refer to like parts throughout the several views. DETAILED DESCRIPTION
[0026] Preferred embodiments of the present disclosure will be described in greater detail below, with reference to the accompanying drawings. While preferred embodiments of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms without being limited by the embodiments set forth herein. Rather, these embodiments are provided so that the present disclosure will be thorough and complete, and will fully convey the scope of the present disclosure to those skilled in the art.
[0027] The term "include," and derivations thereof, means "including, but not limited to," as set forth herein. The term "or" means "and / or" unless specifically stated otherwise. The term "based on" means "based, at least in part, on" unless expressly specified otherwise. The term "one example embodiment" and "an embodiment" means "at least one embodiment." The term "another embodiment" means "at least one additional embodiment." The terms "a first," "a second," etc. can refer to different or the same objects. Other explicitly and implicitly recited definitions can also be found below.
[0028] As described above in the BACKGROUND, conventional function package loading techniques have the problem of function packages being too large and requiring high usage, thus causing many inconveniences for users.
[0029] Specifically, conventional function package loading techniques, for example, employ docker image technology. A docker image can be considered as a self-contained application or a special file system, which contains not only the files such as programs, libraries, resources, configurations, etc. required to support the docker image as a container runtime, but also some configuration parameters prepared for the container runtime, such as environment variable configuration parameters and user configuration parameters. The content of a docker image cannot be changed after it is built, and since all program processes included in the docker image are run in isolation in a container, it usually includes an operating system, and thus its size can reach several GB or even larger. As can be seen, a docker image contains all libraries and dependent files required for application running inside, and thus is very large, which is not only not conducive to distribution and loading through a network, but also not conducive to storage on the client and the image provider.
[0030] Further, the running of the docker image must rely on the docker service, and the docker service must be installed on the physical machine, so if the organization cannot provide the physical machine for installing the docker service to the shared intelligent application, the docker service cannot be installed, and the docker image cannot be run. At the same time, the running of the docker image must rely on obtaining root permission, because if the root permission is not obtained, the docker image cannot be run. Therefore, if some organizations prohibit the application program from obtaining root permission for running due to security or other reasons, in this case, the docker image cannot be run. Therefore, the use of the docker image has high requirements, thereby limiting the normal use of the docker image by users.
[0031] To at least partially solve one or more of the above problems and other potential problems, embodiments of the present disclosure propose a function package loading and generating method. The technical solution of the present disclosure can reduce the amount of data that needs to be obtained when loading the function package, thereby not only saving storage space, but also reducing the time and traffic required for loading the function package, and thus improving the user experience of the user of the computing platform.
[0032] Figure 1A A schematic diagram of a function package loading environment 100A in which a function package loading method in certain embodiments of the present disclosure can be implemented is shown. According to embodiments of the present disclosure, the function package loading environment 100 can be a cloud environment.
[0033] As shown in Figure 1A The function package loading environment 100 includes a computing device 110-1, a computing device 110-2, a computing device 110-3, and a computing device 110-4, which can be collectively referred to as computing devices 110. It should be understood that the four computing devices 110 are shown only for the purpose of example, and more or fewer computing devices 110 can be included in the function package loading environment 100 according to the function and user demand. According to embodiments of the present disclosure, the computing device 110 can be, for example, a desktop computer or a server device. Figure 1A
[0034] As shown in Figure 1A The function package loading environment 100 further includes a function package library 120. The function package library 120 is used to store function packages. The function package library 120 is deployed at the central end with respect to the computing devices 110, and thus can be shared by all the computing devices 110. According to embodiments of the present disclosure, the function package library 120 can be, for example, a file storage server or a memory.
[0035] A host program may be installed on the computing device 110 to support the computing device 110 in acquiring a function package from the function package library 120 and installing and executing the function package on the computing device 110 .
[0036] It should be understood that the function package loading environment 100 is merely exemplary and not restrictive, and is extensible. For example, the function package loading environment 100 may include more function package repositories 120, so that the computing device 110 can obtain function packages from one or more specific function package repositories 120, such as those closest to or with the shortest transmission time, as needed or for convenience.
[0037] According to an embodiment of the present disclosure, in the function package loading environment 100 shown in FIG. 1 , the interaction between the computing device 110 and the function package library 120 may be performed through a network.
[0038] Figure 1B A schematic diagram of a function package loading environment 100B is shown in which the function package loading method in some embodiments of the present disclosure may be implemented.
[0039] like Figure 1B As shown in , the function package loading environment 100B includes a computing device 110' and a function package library 120'. Compared with the function package loading environment 100A, in the function package loading environment 100B, the function package library 120' is privately owned by the computing device 110' and is not shared by other computing devices. Therefore, according to some embodiments of the present disclosure, the function package library 120' can be remotely arranged relative to the computing device 110'; according to other embodiments of the present disclosure, the function package library 120' can be arranged locally relative to the computing device 110'; according to still other embodiments of the present disclosure, the function package library 120' can be arranged in the computing device 110', for example, the memory in the computing device 110' can be configured as the function package library 120'.
[0040] Figure 2 A flowchart of a function package loading method 200 according to an embodiment of the present disclosure is shown. The method 200 can be implemented by the computing device 110 in the function package loading environment 100A or the computing device 110' in the function package loading environment 100B, or can be implemented by other appropriate devices. It should be understood that the function package loading method 200 may also include additional steps not shown and / or may omit the steps shown, and the scope of the embodiments of the present disclosure is not limited in this respect. The specific steps of the function package loading method 200 are explained below using the computing device 110 and the function package library 120 in the function package loading environment 100A as an example.
[0041] In block 202 , the computing device 110 obtains a metadata file in a target function package from the function package library 120 , where the metadata file indicates at least one layer file in the target function package.
[0042] According to an embodiment of the present disclosure, the target function package can be stored in the function package library 120 in the form of a file. A function package may include a metadata file and one or more layer files. The metadata file may have a variety of formats, for example, it may be a file in json format, and may include, for example, meta information about this function package. The layer file may be, for example, a compressed file, which may also be referred to as a compressed package. For example, the layer file may be a compressed file in tar format. In some embodiments, the layer file may include an executable file, a library file, a configuration file, etc. for executing the corresponding function package, thereby realizing the functions associated with this function package.
[0043] Figure 3 FIG. 3 shows a schematic diagram of a function package storage format 300 according to an embodiment of the present disclosure. Figure 3 As shown in , the function package storage format 300 includes a folder 302 named repositories and a folder 304 named layers, wherein the folder 302 is used to store metadata files, and the folder 304 is used to store layer files.
[0044] According to an embodiment of the present disclosure, the storage path of the metadata file may correspond one-to-one to the identifier of the feature package, such as the name. For example, the naming format of the identifier of the feature package may be "name:version". In this case, if the identifier of the feature package is a:b, the storage path of the metadata file may be repositories / a / b / _manifests / manifest.json.
[0045] For example, if the function package is identified as function:v1, the metadata file can be stored in the path repositories / function / v1 / _manifests / manifest.json. If the function is identified as oss-cn-hangzhou.aliyuncs.com / mpc-antbase / fascia:v0.3.0.20210323-144252-4216171-x86_64, the metadata file can be stored in the path repositories / oss-cn-hangzhou.aliyuncs.com / mpc-antbase / fascia / v0.3.0.20210323-144252-4216171-x86_64 / _manifests / manifest.json.
[0046] According to the disclosed embodiment, loading a function package or specifically obtaining a metadata file may be initiated in two ways.
[0047] According to some embodiments of the present disclosure, when the computing device 110 needs to execute a certain function, for example, in response to a user's instruction or for the purpose of performing certain tasks, if the computing device 110 determines that the function cannot be implemented, the function package associated with the function is determined as the target function package to be loaded, and then, based on the identifier of the target function package to be loaded, the metadata file in the target function package can be obtained from the function package library 120. According to the disclosed embodiments, a preset configuration file can be established for the correspondence between the function list and the function package, so that the computing device 110 can easily determine the information associated with the target function package to be loaded, such as the identifier of the target function package to be loaded, by using information such as the identifier and category of the function to be executed.
[0048] According to other embodiments of the present disclosure, when the computing device 110 receives a function package acquisition instruction, it can extract the identifier of the target function package from the function package acquisition instruction, and then, based on the identifier of the target function package, obtain the metadata file in the target function package from the function package library 120. According to embodiments of the present disclosure, the function package acquisition instruction can be generated by a user and sent to the computing device 110, can be automatically generated by the computing device 110 in response to a preset function, or can be generated by the function package library 120 and sent to the computing device 110 in some cases.
[0049] Accordingly, according to the disclosed embodiments, the computing device 110 may be configured to prohibit the acquisition of a function package, automatically acquire a function package, or manually trigger the acquisition of a function package by a user, thereby respectively completely prohibiting the acquisition of a function package, acquiring the associated function package as long as the corresponding function needs to be executed, and acquiring the function package only by receiving user instructions.
[0050] In the above embodiment, as described above, the computing device 110 may determine the storage path of the metadata file based on the identifier of the target function package, and then may obtain the metadata file from the function package library 120 according to the storage path of the metadata file.
[0051] In block 204 , the computing device 110 obtains the unobtained layer files in the target function package from the function package library 120 based on the metadata file obtained in block 202 and the information about the already obtained layer files.
[0052] According to embodiments of the present disclosure, the same layer files can be included between different function packs. For example, if the computing device 110 includes layer file A, layer file B, and layer file C in a first function pack that the computing device 110 obtains first, and includes layer file C, layer file D, and layer file E in a second function pack that the computing device 110 obtains later, since the computing device 110 has already obtained layer file C when obtaining the first function pack, the computing device 110 does not need to obtain layer file C again when obtaining the second function pack, but only needs to obtain layer file D and layer file E. In other words, the computing device 110 can only need to obtain the layer files in a target function pack that have not been obtained when obtaining the layer files in the target function pack.
[0053] Figure 4 A diagram of a metadata file code 400 is shown according to embodiments of the present disclosure. As shown in the metadata file code 400, a layer file field identifier 402 with a name of layers is included, and a layer file identifier 404 with a name of Figure 4
[0054] 54f5c5c8292a2ac159e75b4f913193b1c6cfdc47f3a02e6002ac5bb9727e4fa5 and a layer file identifier 406 with a name of
[0055] f0b2f9b3d40acd917d92933dd86e935bd088ea40b5da2da52285dfedceaacef8.
[0056] According to embodiments of the present disclosure, after the computing device 110 obtains a metadata file in a function pack, the computing device 110 can further obtain the identifiers of all the layer files in the function pack based on the metadata file. For example, after the computing device 110 obtains the metadata associated with the metadata file code 400, the computing device 110 can further obtain the layer file identifier 404 and the layer file identifier 406 included in the metadata file code 400.
[0057] Then, the computing device 110 can determine whether the layer files corresponding to the layer file identifier 404 or the layer file identifier 406 have been obtained, for example, by searching in the memory or the database of the computing device 110 whether there is a layer file identifier that is the same as the layer file identifier 404 or the layer file identifier 406.
[0058] If the computing device 110 has already acquired the layer files corresponding to the layer file identifier 404 and the layer file identifier 406, the computing device 110 does not need to perform the operation of acquiring the layer files for this function package. If the computing device 110 has not acquired at least one of the layer files corresponding to the layer file identifier 404 and the layer file identifier 406, the computing device 110 will acquire the layer files that have not been acquired from the function package repository 120.
[0059] According to an embodiment of the present disclosure, the storage path of a layer file can be one-to-one corresponding to the identifier, e.g., the name, of the layer file. In this case, the computing device 110 can determine the storage path of the corresponding layer file through the layer file identifier, and then acquire the corresponding layer file based on the storage path of the layer file. For example, the formation rule of the storage path of the layer file can be: layers / first 2 digits of the layer file identifier / full name of the layer file identifier / layer.tar. Therefore, if the layer file identifier is
[0060] 54f5c5c8292a2ac159e75b4f913193b1c6cfdc47f3a02e6002ac5bb9727e4fa5, the storage path of the corresponding layer file is
[0061] layers / 54 / 54f5c5c8292a2ac159e75b4f913193b1c6cfdc47f3a02e6002ac5bb9727e4fa5 / layer.tar.
[0062] It should be noted that the "first 2 digits of the layer file identifier" in the storage path of the layer file is only for the purpose of example, and the purpose of selecting the first 2 digits is to avoid too many sub-folders in the folder 304 named layers when storing the function package according to the function package storage format 300, so as to avoid affecting the performance of the function package repository 120 due to too many sub-folders.
[0063] Therefore, according to an embodiment of the present disclosure, when the computing device 110 acquires the layer files that have not been acquired in the target function package from the function package repository 120, the computing device 110 can first determine the identifier of the layer files that have not been acquired in the function package based on the metadata file acquired in block 202 and the information related to the layer files that have been acquired. Then, the computing device 110 can determine the storage path of the layer files that have not been acquired based on the identifier of the layer files that have not been acquired. Finally, the computing device 110 can acquire the layer files that have not been acquired from the function package repository according to the determined storage path of the layer files that have not been acquired.
[0064] According to embodiments of the present disclosure, when the computing device 110 determines the identities of the unacquired layer files in the function package, and further determines the storage paths of the unacquired layer files, and acquires the unacquired layer files from the function package library according to the determined storage paths of the unacquired layer files, the above operations can be performed in parallel for multiple layer files, or the above operations can be performed for multiple layer files in a preset order. For example, the computing device 110 can determine whether each layer file in the function package is unacquired in a creation order of the layer files in the function package from old to new, for example, as indicated by the metadata file, and acquire a layer file from the function package library 120 when it is determined that the layer file is unacquired.
[0065] The above refers to Figures 2 to 4 The specific content of the function package loading method 200 including the function package acquisition process is described below with reference to Figure 5 The function package loading method 500 including the function package acquisition and the function package execution process is described below with reference to
[0066] Figure 5 A flowchart of another function package loading method 500 according to embodiments of the present disclosure is shown. The method 500 can also be implemented by the computing device 110 in the function package loading environment 100A or the computing device 110' in the function package loading environment 100B, or by other appropriate devices. It should be understood that the function package loading method 500 can also include additional steps not shown and / or can omit the steps shown, and the scope of embodiments of the present disclosure is not limited in this respect. The specific steps of the function package loading method 500 are also described below with the computing device 110 and the function package library 120 in the function package loading environment 100A as an example. The function package loading method 500 is an extended implementation of the function package loading method 200. Specifically, the function package loading method 500 additionally includes a process associated with the execution of the function package compared with the function package loading method 200.
[0067] At block 502, the computing device 110 acquires a metadata file in a target function package from the function package library 120, the metadata file indicating at least one layer file in the target function package. The specific content involved in block 502 is the same as that involved in block 202, which is not described here again.
[0068] At block 504, the computing device 110 acquires an unacquired layer file in the target function package from the function package library 120 based on the metadata file acquired at block 502 and information about the acquired layer files. The specific content involved in block 504 is the same as that involved in block 204, which is not described here again.
[0069] At block 506, the computing device 110 decompresses each of the at least one layer file in the target function package to obtain a file set. According to an embodiment of the present disclosure, the layer file decompressed at block 506 can be a layer file that has not been acquired in block 504, or can be a layer file that has been acquired previously and stored in the computing device 110. For example, the computing device 110 can create a temporary directory, and decompress each of the at least one layer file in the target function package into the temporary directory to obtain the file set located in the temporary directory.
[0070] According to an embodiment of the present disclosure, the computing device 110 can decompress the at least one layer file in the target function package in order from old to new according to the creation time of each of the layer files to obtain the file set. Further, according to an embodiment of the present disclosure, when the computing device 110 decompresses the at least one layer file in the target function package in order from old to new according to the creation time of each of the layer files to obtain the file set, if it is determined that there already exists a decompressed file having the same identity as the file currently decompressed in the file set, the decompressed file is replaced with the file currently decompressed, so that the correct operation of the acquired function package can be ensured.
[0071] At block 508, the computing device 110 executes the executable file in the file set obtained at block 506. According to an embodiment of the present disclosure, the obtained file set can include only one executable file. When the computing device 110 executes the executable file in the file set, the function associated with the acquired function package can be implemented.
[0072] According to some embodiments of the present disclosure, when the computing device 110 executes the executable file in the file set, at least one of the identity and the path of the executable file in the file set indicated by the metadata file in the target function package can be determined first, which can be indicated by, for example, the config.Cmd field in the metadata file. Then, the computing device 110 can execute the executable file based on the at least one of the identity and the path of the executable file determined.
[0073] According to other embodiments of the present disclosure, when the computing device 110 executes the executable file in the file set, the executable file can be determined first by the type of the file, and then the executable file is executed.
[0074] According to embodiments of the present disclosure, when the computing device 110 executes the executable files in the file set, not only the libraries, resources, configuration files, configuration parameters and the like included in the acquired function package need to be used, but also the library files in the computing device 110 for supporting the implementation of the functions associated with the function package need to be used. In contrast, the docker image is self-contained, which contains everything the application needs to run, such as an operating system. Therefore, the size of the function package according to the present disclosure is only less than one tenth of the size of the traditional docker image, or even smaller.
[0075] The above describes the specific content of the function package loading method 200 and the function package loading method 500 according to embodiments of the present disclosure, and the following will describe the function package generation method 600 which can be used to generate the function package acquired in the function package loading method 200 and the function package loading method 500. Figures 2 to 5 The above describes the specific content of the function package loading method 200 and the function package loading method 500 according to embodiments of the present disclosure, and the following will describe the function package generation method 600 which can be used to generate the function package acquired in the function package loading method 200 and the function package loading method 500. Figure 5 The above describes the specific content of the function package loading method 200 and the function package loading method 500 according to embodiments of the present disclosure, and the following will describe the function package generation method 600 which can be used to generate the function package acquired in the function package loading method 200 and the function package loading method 500.
[0076] Figure 6 A flowchart of the function package generation method 600 according to embodiments of the present disclosure is shown. The method 600 can be implemented by any entity or device having function package generation capability, and the function package generated by implementing the method 600 can be stored into the function package library 120 in the loading environment 100A or the function package library 120' in the function package loading environment 100B, for example, for the computing device 110 in the function package loading environment 100A and the computing device 110' in the function package loading environment 100B to acquire and use. The following describes the specific steps of the function package generation method 600 with the computing device as the execution subject which can be any entity or device having function package generation capability.
[0077] At block 602, the computing device generates a function package for at least partially implementing a predetermined function, the function package including a metadata file and at least one layer file, the metadata file indicating the at least one layer file, and the at least one layer file including executable files. The specific content involved in block 602 corresponds to the content described above with reference to the method 200 and the method 500, which will not be repeated here. Figure 2 and Figure 5 The specific content involved in block 602 corresponds to the content described above with reference to the method 200 and the method 500, which will not be repeated here.
[0078] According to embodiments of the present disclosure, the functional package generated in block 602 can have several features. For example, the identification of the functional package can indicate the storage path of the metadata file. As another example, the metadata file can indicate the identification and / or path of the executable file, etc. As yet another example, the identification of the at least one layer file can be associated with the storage path of the at least one layer file, and each layer file can be compressed. In addition, the various layer files in the functional package can also be ordered in chronological order of generation. It should be understood that the above description of various features of the functional package is merely exemplary and is not intended to be limiting.
[0079] The specific content of the above features corresponds to that described above with reference to the method 200 and the method 500, and will not be described again here. Figure 2 and Figure 5 The method 600 also includes a process of updating the functional package. It should be understood that the updating process of the functional package is optional for the method 600, rather than necessary. In the example of the method 200 and the method 500, the functional package is updated by adding a layer file to the functional package and updating the metadata file in the functional package to indicate the added layer file.
[0080] According to embodiments of the present disclosure, the executable file can be included in any of the at least one layer file, and specifically which layer file the executable file is included in can be determined according to business needs. According to some embodiments of the present disclosure, the executable file can be included in an earlier generated layer file in the functional package, so that the later generated layer file only includes, for example, a configuration file, so that the number of times the executable file is acquired can be reduced. According to other embodiments of the present disclosure, if a layer file shared with other functional packages is to be included in the functional package to be generated, the executable file can be included in such layer file, so that the number of times the executable file is acquired can also be reduced.
[0081] As shown in Figure 6 , the method 600 also includes a process of updating the functional package. It should be understood that the updating process of the functional package is optional for the method 600, rather than necessary. In the example of the method 200 and the method 500, the functional package is updated by adding a layer file to the functional package and updating the metadata file in the functional package to indicate the added layer file. Figure 6 According to embodiments of the present disclosure, since the metadata file in the functional package indicates the at least one layer file in the functional package, when the functional package is updated by adding a layer file, the metadata file in the functional package needs to be updated accordingly, so that the updated metadata file can further indicate the added layer file.
[0082] According to embodiments of the present disclosure, since the functional package is stored in the functional package library, the computing device can update the functional package that has been stored in the functional package library by transmitting the updated metadata file to the functional package library to replace the metadata file that has been stored in the functional package library, and transmitting the layer file to be added to the functional package library.
[0083] The above with reference to FIGS. 1 to Figure 6Related content of a function package loading environment 100A in which a function package loading method in certain embodiments of the present disclosure can be implemented, a function package loading environment 100B in which a function package loading method in certain embodiments of the present disclosure can be implemented, a function package loading method 200 according to an embodiment of the present disclosure, a function package storage format 300 according to an embodiment of the present disclosure, a metadata file code 400 according to an embodiment of the present disclosure, a function package loading method 500 according to an embodiment of the present disclosure, and a function package generation method 600 according to an embodiment of the present disclosure are described. It should be understood that the above description is to better demonstrate the content recited in the embodiments of the present disclosure, and is not to limit the protection scope of the embodiments of the present disclosure in any way.
[0084] It should be understood that the number of various elements and the size of physical quantities employed in the embodiments of the present disclosure and in the various drawings are only examples, and are not to limit the protection scope of the embodiments of the present disclosure. The above number and size can be arbitrarily set as needed, without affecting the normal implementation of the embodiments of the present disclosure.
[0085] The above has been described with reference to FIGS. 1 to Figure 6 Details of the function package loading method 200, the function package loading method 500, and the function package generation method 600 according to the embodiments of the present disclosure are described. Hereinafter, reference will be made to Figure 7 and Figure 8 Details of each module in the function package loading apparatus and the function package generation apparatus are described.
[0086] Figure 7 is a schematic block diagram of a function package loading apparatus 700 according to an embodiment of the present disclosure. As Figure 7 indicated, the function package loading apparatus 700 can include a first metadata acquisition module 710 configured to acquire a metadata file in a target function package from a function package library, the metadata file indicating at least one layer file in the target function package, and a first layer file acquisition module 720 configured to acquire an unacquired layer file in the target function package from the function package library based on the metadata file and information about acquired layer files.
[0087] In one or more embodiments, the first metadata acquisition module 710 includes a target function package determination module configured to determine a function package as a target function package to be loaded if it is determined that a function associated with the function package cannot be implemented, and a second metadata acquisition module configured to acquire a metadata file in the function package from the function package library based on identification of the target function package.
[0088] In one or more embodiments, the first metadata acquisition module 710 includes: an identification extraction module, configured to extract the identification of the target function package from the function package acquisition indication in response to receiving the function package acquisition indication; and a second metadata acquisition module, configured to obtain the metadata file of the target function package from the function package library based on the identification of the target function package.
[0089] In one or more embodiments, the second metadata acquisition module includes: a first storage path determination module, configured to determine the storage path of the metadata file based on the identification of the target function package; and a third metadata acquisition module, configured to obtain the metadata file from the function package library according to the storage path.
[0090] In one or more embodiments, the first layer file acquisition module 720 includes: an identification determination module, configured to determine the identification of the layer file that has not been acquired based on the metadata file and information related to the layer file that has been acquired; a second storage path determination module, configured to determine the storage path of the layer file that has not been acquired based on the identification of the layer file that has not been acquired; and a second layer file acquisition module, configured to acquire the layer file that has not been acquired from the function package library according to the storage path.
[0091] In one or more embodiments, each layer file in at least one layer file is compressed, and the function package loading device 700 also includes: a first layer file decompression module, configured to decompress at least one layer file to obtain a file collection; and a first executable file execution module, configured to execute the executable file in the file collection.
[0092] In one or more embodiments, at least one layer file includes multiple layer files, and the first layer file decompression module includes: a second layer file decompression module, configured to decompress the multiple layer files in sequence according to the creation time of the multiple layer files in the function package.
[0093] In one or more embodiments, the second-layer file decompression module includes: a file replacement module, which is configured to replace the decompressed file with the currently decompressed file if it is determined that a decompressed file with the same identifier as the currently decompressed file already exists in the file collection.
[0094] In one or more embodiments, the first executable file execution module includes: an executable file information determination module, configured to determine at least one of an identification and a path of an executable file in a file collection indicated by a metadata file; and a second executable file execution module, configured to execute the executable file based on at least one of the identification and the path of the executable file.
[0095] Figure 8is a schematic block diagram of a function package generation apparatus 800 according to an embodiment of the present disclosure. As shown in Figure 8 The function package generation apparatus 800 can include a function package generation module 810 configured to generate a function package for at least partially implementing a predetermined function, the function package including a metadata file and at least one layer file, the metadata file indicating the at least one layer file, and the at least one layer file including an executable file.
[0096] In one or more embodiments, the function package generation apparatus 800 further includes a function package update module configured to update the function package by: adding a layer file to the function package; and updating the metadata file to indicate the added layer file.
[0097] In one or more embodiments, the identifier of the function package indicates a storage path of the metadata file.
[0098] In one or more embodiments, the metadata file indicates at least one of an identifier and a path of the executable file.
[0099] In one or more embodiments, the identifier of the at least one layer file is associated with a storage path of the at least one layer file.
[0100] In one or more embodiments, each of the at least one layer file is compressed.
[0101] In one or more embodiments, the at least one layer file includes a plurality of layer files, and the plurality of layer files are sorted in chronological order of generation time.
[0102] With the above description with reference to FIGS. 1 to Figure 8 The technical solution according to the embodiments of the present disclosure has many advantages over the conventional solution.
[0103] For example, using the technical solution of the present disclosure, compared with the docker image technology in the conventional technology, since the function package can use the function library provided by the computing device itself, without the need to include these library files in the function package, the size of the function package can be greatly reduced, and can even reach the order of tens of MB or even lower. Therefore, compared with the docker image which has a size of several GB or even larger, using the technical solution of the present disclosure can effectively reduce the storage space of the function package in the function package library and locally on the computing device, and can effectively reduce the time and traffic cost required for the computing device to obtain the function package from the function package library.
[0104] Further, using the technical solution of the present disclosure, the loading and execution of the function package can be implemented as a common process on the computing device, and thus not only can root permission be acquired, but also the computing device of various types or with various environments can be adapted. For example, no matter whether the computing device is in the form of a physical machine or a virtual machine, the function package can be normally loaded and executed without depending on the hardware environment of the computing device, and thus the business requirement of shared intelligence can be better met.
[0105] Further, using the technical solution of the present disclosure, the function package can be implemented as a plurality of layer files which are relatively independent from each other. Thus, if two function packages both need to use one or more same files, the one or more same files can be used to construct a layer file, and thus the two function packages can share the layer file. In this case, when the aforementioned two function packages are needed to be acquired, the computing device only needs to acquire the layer file from the function package warehouse once, and thus the storage space and acquisition cost of the function package can be further reduced.
[0106] Further, using the technical solution of the present disclosure, the function package library can be implemented as a common file storage server or memory, and thus the construction cost of the function package library is low, and thus the deployment step of the function package library can be simplified and the operation and maintenance cost of the function package library can be reduced.
[0107] Thus, using the technical solution of the present disclosure, the user experience of the user of the computing platform can be effectively improved.
[0108] Figure 9 FIG. 1 illustrates a schematic block diagram of an example device 900 which can be used to implement the embodiments of the present disclosure. According to the embodiments of the present disclosure, the computing device 110 shown in FIG. 1, Figure 2 the computing device 110' shown in FIG. 2, Figure 7 the function package loading apparatus 700 shown in FIG. 3, and Figure 8 the function package generating apparatus 800 shown in FIG. 4 can be implemented as the example device 900. As shown in the figure, the device 900 includes a central processing unit (CPU) 901 which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 902 or loaded from a storage unit 908 to a random access memory (RAM) 903. In the RAM 903, various programs and data required for the operation of the device 900 can also be stored. The CPU 901, the ROM 902 and the RAM 903 are connected to each other through a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.
[0109] A number of the components in device 900 are connected to the I / O interface 905, including an input unit 906, such as a keyboard, mouse, etc.; an output unit 907, such as various types of displays, speakers, etc.; a storage unit 908, such as a disk, a CD, etc.; and a communication unit 909, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 909 allows device 900 to exchange information / data with other devices over a computer network, such as the Internet, and / or various telecommunication networks.
[0110] The various processes and processes described above, such as method 200, method 500, and method 600, can be performed by processing unit 901. For example, in some embodiments, method 200, method 500, and method 600 can be implemented as a computer software program tangibly embodied in a machine readable medium, such as storage unit 908. In some embodiments, some or all of the computer program can be loaded and / or installed on device 900 via ROM 902 and / or communication unit 909. When the computer program is loaded onto RAM 903 and executed by CPU 901, one or more acts of method 200, method 500, and method 600 described above can be performed.
[0111] Embodiments of the present disclosure can relate to methods, devices, systems, and / or computer program products. Computer program products can include computer readable storage media having computer readable program instructions embodied therewith, the computer readable program instructions being used to perform various aspects of embodiments of the present disclosure.
[0112] The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples of the computer readable storage medium as a non-exhaustive list include 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), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanism that stores instructions in a form of a propagated signal, such as a carrier wave or other transport medium, and any suitable combination of the foregoing. The computer readable storage medium is not, however, a transitory signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electric wireline carrier wave through a wire or cable, or an optical carrier wave through a fiber optic cable or other transport mechanism.
[0113] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.
[0114] Computer readable program instructions for carrying out operations of embodiments of the disclosure can be assembly-level instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object-oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computing device, partly on the user's computing device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, for example, through the Internet using an Internet Service Provider. In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of embodiments of the present disclosure.
[0115] Aspects of the embodiments of the present disclosure are described herein with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the present disclosure. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer readable program instructions.
[0116] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can be a computer- readable storage medium having no data storage cycles that change state. The instructions can be executed by one or more processors of a computer, to cause a series of operational elements or steps to be performed on the computer to produce a computer implemented process. Such instructions can also be stored and / or executed by other computer-readable media. Computer-readable media storing the computer readable instructions can include computer-readable storage media facilitating transfer of the computer readable instructions to the computer or other programmable data processing apparatus.
[0117] A computer program product can include a computer readable storage medium (media) having instructions stored thereon / in which can be executed by a processing unit of a computer, processor of a computer, or processor of another programmable data processing apparatus to implement the functions / acts specified in the flowchart and / or block diagram block or blocks. Alternatively, the computer program product can include a computer readable storage medium (media) having instructions stored thereon / in which can be executed by a processing unit of a computer, processor of a computer, or processor of another programmable data processing apparatus to cause a series of operational elements or steps to be performed on the computer, other programmable apparatus or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0118] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational elements or steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus implement the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0119] Embodiments of the present disclosure have been described above, and the description is intended to be illustrative of the embodiments and not exhaustive, and is not limited to the embodiments disclosed. Numerous modifications and adaptations will be apparent to those skilled in the art without departing from the scope and spirit of the described embodiments. The selection of the terms to be used in the description is intended to best express the principles of the embodiments, practical application, or technical improvement over the technology in the market, or to enable other ordinary skilled persons in the art to understand the embodiments disclosed herein.
Claims
1. A method for loading a function package, comprising: Acquire a metadata file in a target function package from a function package library, where the metadata file indicates at least one layer file in the target function package; Based on the metadata file and information related to the acquired layer files, acquiring the layer files that have not been acquired in the target function package from the function package library; Each layer file in the at least one layer file is compressed, and the method further comprises: decompressing the at least one layer file to obtain a file set; Executing the executable file in the file collection; The at least one layer file includes a plurality of layer files, and decompressing the at least one layer file includes: decompressing the plurality of layer files in sequence according to the creation time of the plurality of layer files in the function package; Decompressing the multiple layer files in sequence includes: If it is determined that a decompressed file having the same identifier as the currently decompressed file already exists in the file set, the currently decompressed file is used to replace the decompressed file.
2. The method according to claim 1, wherein obtaining the metadata file comprises: If it is determined that the function associated with a function package cannot be implemented, determining the function package as a target function package to be loaded; as well as Based on the identifier of the target function package, a metadata file in the target function package is obtained from the function package library.
3. The method according to claim 1, wherein obtaining the metadata file comprises: In response to receiving a function package acquisition instruction, extracting an identifier of the target function package from the function package acquisition instruction; as well as Based on the identifier of the target function package, the metadata file of the target function package is acquired from the function package library.
4. The method according to claim 2 or 3, wherein obtaining the metadata file based on the identifier of the target function package comprises: Determining a storage path of the metadata file based on the identifier of the target function package; as well as The metadata file is obtained from the function package library according to the storage path.
5. The method according to claim 1, wherein obtaining the layer file that has not been obtained comprises: determining, based on the metadata file and information related to the acquired layer file, an identifier of the layer file that has not been acquired; Determining a storage path of the unobtained layer file based on the identifier of the unobtained layer file; as well as Acquire the layer file that has not been acquired from the function package library according to the storage path.
6. The method of claim 1 , wherein executing the executable file comprises: determining at least one of an identifier and a path of the executable file in the file collection indicated by the metadata file; as well as The executable file is executed based on the at least one of the identifier of the executable file and the path.
7. A method for generating a function package, comprising: generating a function package loaded by the loading method according to any one of claims 1 to 6; A function package for at least partially realizing a predetermined function is generated, the function package including a metadata file and at least one layer file, the metadata file indicating the at least one layer file, the at least one layer file including an executable file.
8. The method according to claim 7, further comprising: Update the feature pack by: Adding layer files to the function package; as well as The metadata file is updated to indicate the added layer file.
9. The method according to claim 7, wherein the identifier of the function package indicates a storage path of the metadata file.
10. The method of claim 7, wherein the metadata file indicates at least one of an identification and a path of the executable file.
11. The method according to claim 7, wherein the identifier of the at least one layer file is associated with a storage path of the at least one layer file.
12. The method of claim 7, wherein each of the at least one layer file is compressed. 13 . The method according to claim 7 , wherein the at least one layer file comprises a plurality of layer files, and the plurality of layer files are sorted in order of generation time.
14. A function package loading device, comprising: A first metadata acquisition module is configured to acquire a metadata file in a target function package from a function package library, wherein the metadata file indicates at least one layer file in the target function package; A first layer file acquisition module is configured to acquire, from the function package library, layer files that have not been acquired in the target function package based on the metadata file and information related to the acquired layer files; Each layer file in the at least one layer file is compressed, and the apparatus further comprises: A first layer file decompression module is configured to decompress the at least one layer file to obtain a file set; a first executable file execution module, configured to execute the executable file in the file set; The at least one layer file includes a plurality of layer files, and the first layer file decompression module includes: A second layer file decompression module is configured to decompress the multiple layer files in sequence according to the creation time of the multiple layer files in the function package; The second-layer file decompression module includes: The file replacement module is configured to replace the decompressed file with the currently decompressed file if it is determined that a decompressed file with the same identifier as the currently decompressed file already exists in the file collection.
15. The apparatus according to claim 14, wherein the first metadata acquisition module comprises: a target function package determining module, configured to determine a function package as a target function package to be loaded if it is determined that a function associated with the function package cannot be implemented; as well as The second metadata acquisition module is configured to acquire the metadata file in the function package from the function package library based on the identifier of the target function package.
16. The apparatus according to claim 14, wherein the first metadata acquisition module comprises: an identification extraction module, configured to extract the identification of the target function package from the function package acquisition instruction in response to receiving the function package acquisition instruction; as well as The second metadata acquisition module is configured to acquire the metadata file of the target function package from the function package library based on the identifier of the target function package.
17. The apparatus according to claim 15 or 16, wherein the second metadata acquisition module comprises: a first storage path determining module, configured to determine a storage path of the metadata file based on the identifier of the target function package; as well as The third metadata acquisition module is configured to acquire the metadata file from the function package library according to the storage path.
18. The apparatus according to claim 14, wherein the first layer file acquisition module comprises: an identification determination module configured to determine an identification of the layer file that has not been obtained based on the metadata file and information related to the obtained layer file; a second storage path determining module configured to determine a storage path of the layer file that has not been acquired based on an identifier of the layer file that has not been acquired; as well as The second layer file acquisition module is configured to acquire the layer file that has not been acquired from the function package library according to the storage path.
19. The apparatus according to claim 14, wherein the first executable file execution module comprises: an executable file information determination module, configured to determine at least one of an identifier and a path of the executable file in the file set indicated by the metadata file; as well as The second executable file execution module is configured to execute the executable file based on the at least one of the identifier and the path of the executable file.
20. A function package generating device, generating a function package to be loaded using the loading method according to any one of claims 1 to 6, comprising: The function package generation module is configured to generate a function package for at least partially realizing a predetermined function, wherein the function package includes a metadata file and at least one layer file, wherein the metadata file indicates the at least one layer file, and the at least one layer file includes an executable file.
21. The apparatus according to claim 20, further comprising: The function package update module is configured to update the function package by: Adding layer files to the function package; as well as The metadata file is updated to indicate the added layer file.
22. The apparatus according to claim 20, wherein the identifier of the function package indicates a storage path of the metadata file.
23. The apparatus of claim 20, wherein the metadata file indicates at least one of an identification and a path of the executable file.
24. The apparatus according to claim 20, wherein the identifier of the at least one layer file is associated with a storage path of the at least one layer file.
25. The device of claim 20, wherein each layer file of the at least one layer file is compressed. 26 . The apparatus according to claim 20 , wherein the at least one layer file comprises a plurality of layer files, and the plurality of layer files are sorted in a generation time sequence.
27. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1 to 6 or the method of any one of claims 7 to 13.
28. A computer-readable storage medium having one or more computer instructions stored thereon, wherein the one or more computer instructions are executed by a processor to implement the method of any one of claims 1-6 or any one of claims 7-13.
29. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program performs the method according to any one of claims 1 to 6 or the method according to any one of claims 7 to 13.
Citation Information
Patent Citations
Mirror image warehouse, and compression method and device thereof
CN114003333A