Service stub compression processing method and apparatus, storage medium, and electronic device

By establishing a tree structure model and pruning service stubs, the problems of low quality and high cost of service stub maintenance are solved, and the simplification, compression and quality improvement of service stubs are achieved.

CN117520602BActive Publication Date: 2026-11-24INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311474928.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-07
Publication Date
2026-11-24
Estimated Expiration
2043-11-07

AI Technical Summary

Technical Problem

The lack of mature service stub compression methods in existing technologies leads to low service stub maintenance quality and high costs.

Method used

By establishing a tree structure model and performing pruning, the service stubs are compressed. This includes obtaining the metadata definition and instances of the service stubs, constructing the tree structure, pruning to remove unimportant metadata, and forming compressed service stubs.

Benefits of technology

This improved the quality of service stub maintenance and reduced maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117520602B_ABST
    Figure CN117520602B_ABST
Patent Text Reader

Abstract

This application discloses a service stub compression processing method, apparatus, storage medium, and electronic device. Relating to the fintech field or other related fields, the method includes: obtaining N service stubs, wherein each of the N service stubs includes M metadata definitions and corresponding metadata instances for each of the M metadata definitions; the M metadata definitions include an interface name and M-1 metadata instances excluding the interface name; where M and N are integers greater than or equal to 2; establishing a tree structure model based on the N service stubs; and pruning the tree structure model to obtain the compressed service stubs. This application solves the problem of low service stub maintenance quality and high cost caused by the lack of mature service stub compression methods in related technologies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of financial technology or other related fields, and more specifically, to a service stub compression processing method, apparatus, storage medium, and electronic device. Background Technology

[0002] A service stub is a placeholder used to simulate service behavior. When a service request needs to connect to another service, if that service is not yet developed or is inaccessible, a service stub can be used to substitute for the service for testing during development and testing. Service stubs can return predefined results to simulate the response of an actual service. Service stubs can also record interaction information between service requests and responses for analysis during testing and troubleshooting.

[0003] Service stubs consist of multiple sets of metadata. Due to the complexity and large size of the metadata in service stubs, and the lack of mature service stub compression methods, service stubs are difficult to manage and utilize, resulting in low quality and high cost in maintaining service stubs.

[0004] There is currently no effective solution to the problem of low service stub maintenance quality and high cost caused by the lack of mature service stub compression methods in related technologies. Summary of the Invention

[0005] The main objective of this application is to provide a service stub compression processing method, apparatus, storage medium, and electronic device to solve the problem of low service stub maintenance quality and high cost caused by the lack of mature service stub compression methods in related technologies.

[0006] To achieve the above objectives, according to one aspect of this application, a service stub compression processing method is provided. The method includes: obtaining N service stubs, wherein each of the N service stubs includes M metadata definitions and metadata instances corresponding to the M metadata definitions, wherein the M metadata definitions include an interface name and M-1 metadata instances excluding the interface name, wherein M and N are integers greater than or equal to 2; establishing a tree structure model based on the N service stubs; and pruning the tree structure model to obtain compressed service stubs.

[0007] Optionally, obtain L service stubs, where L is an integer greater than or equal to N; based on the interface name instances corresponding to the L service stubs respectively, determine the N service stubs from the L service stubs.

[0008] Optionally, service stubs with the same interface name instance among the L service stubs are determined as the N service stubs.

[0009] Optionally, if the interface name instances of the N service stubs are the same, the interface name is used as the root node, and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs are used as leaf nodes to establish the tree structure model including M layers of nodes, wherein the M layers of nodes correspond one-to-one with the M metadata definitions.

[0010] Optionally, the tree structure model is established using the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes, in the following manner: The M metadata definitions are sorted to obtain a sorting result, wherein the interface name is located in the first position of the sorting result; based on the sorting result, the corresponding layer nodes of the M metadata definitions are sequentially taken as the current layer nodes, and the following operations are performed until the current layer node is the corresponding layer node of the last metadata definition in the sorting result: The next layer node of the current layer node is determined, and the first metadata definition corresponding to the next layer node is determined; The N first metadata instances corresponding to the first metadata definition are determined from the metadata instances corresponding to the M metadata of the N service stubs; The N first metadata instances are used as leaf nodes of each node in the current layer node to construct the tree structure model.

[0011] Optionally, the weight values ​​corresponding to the sub-paths included in the tree structure model are determined, wherein the sub-path is the connection path between any two nodes in two adjacent layers of the tree structure model; the N values ​​from the root node to each leaf node included in the last layer of the tree structure model are determined. M-1 The main path; based on the weight values ​​corresponding to the sub-paths included in the tree structure model, determine the N. M-1 The comprehensive weight values ​​corresponding to each main path; based on the N M-1 The tree structure model is pruned based on the comprehensive weight values ​​corresponding to each main path to obtain the pruning result; the compressed service stub is obtained based on the metadata definition and corresponding metadata instance included in the pruning result.

[0012] Optionally, the N M-1 Among the main paths, the main path with the largest comprehensive weight value is determined as the target path; the other paths in the tree structure model other than the target path are pruned to obtain the pruning result.

[0013] To achieve the above objectives, according to another aspect of this application, a service stub compression processing apparatus is provided. The apparatus includes: acquiring N service stubs, wherein each of the N service stubs includes M metadata definitions and metadata instances corresponding to the M metadata definitions, wherein the M metadata definitions include an interface name and M-1 metadata instances excluding the interface name, wherein M and N are integers greater than or equal to 2; establishing a tree structure model based on the N service stubs; and pruning the tree structure model to obtain compressed service stubs.

[0014] To achieve the above objectives, according to another aspect of this application, a non-volatile storage medium is also provided, the non-volatile storage medium storing a plurality of instructions adapted for loading by a processor and executing any one of the service stub compression processing methods described above.

[0015] To achieve the above objectives, according to another aspect of this application, an electronic device is also provided, including one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement any of the service stub compression processing methods described above.

[0016] This application employs the following steps: obtaining N service stubs, wherein each of the N service stubs includes M metadata definitions and corresponding metadata instances, where each of the M metadata definitions includes an interface name and M-1 metadata instances excluding the interface name, and where M and N are integers greater than or equal to 2; establishing a tree structure model based on the N service stubs; pruning the tree structure model to obtain compressed service stubs, thus achieving the goal of simplifying and compressing service stubs by establishing a tree structure model based on N service stubs; and solving the problem of low service stub maintenance quality and high cost caused by the lack of mature service stub compression methods in related technologies. This ultimately improves the quality of service stub maintenance and reduces its maintenance cost. Attached Figure Description

[0017] The accompanying drawings, which form part of this application, are used to provide a further understanding of this application. The illustrative embodiments and descriptions of this application are used to explain this application and do not constitute an undue limitation of this application. In the drawings:

[0018] Figure 1 This is a flowchart of a service stub compression processing method according to an embodiment of this application;

[0019] Figure 2This is a schematic diagram of an optional tree structure model for service stub compression according to an embodiment of this application;

[0020] Figure 3 This is a schematic diagram of a service stub compression processing apparatus according to an embodiment of this application;

[0021] Figure 4 This is a schematic diagram of an electronic device provided according to an embodiment of this application. Detailed Implementation

[0022] It should be noted that, unless otherwise specified, the embodiments and features described in this application can be combined with each other. This application will now be described in detail with reference to the accompanying drawings and embodiments.

[0023] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0024] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this application described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] It should be noted that all information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for display, data used for analysis, etc.) involved in this application are information and data authorized by the user or fully authorized by all parties. For example, if there is an interface between this system and the relevant user or organization, before obtaining the relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain the relevant information after receiving the consent information from the aforementioned user or organization.

[0026] The following describes this application in conjunction with the preferred implementation steps. Figure 1 This is a flowchart of a service stub compression processing method provided according to an embodiment of this application, such as... Figure 1As shown, the method includes the following steps:

[0027] Step S101: Obtain N service stubs, wherein each of the N service stubs includes M metadata definitions and M metadata instances corresponding to each of the M metadata definitions. The M metadata definitions include the interface name and M-1 metadata instances other than the interface name, where M and N are integers greater than or equal to 2.

[0028] Optionally, N service stubs are obtained, where each service stub includes a metadata definition and a metadata instance. The metadata definition refers to the data describing the metadata, and the metadata instance is the value of the metadata definition. For example, service stub 1 includes the interface name, method name, and input parameter type as metadata definitions, while servicename, method1, and String are the metadata instances corresponding to the interface name, method name, and input parameter type, respectively.

[0029] Service stub 1: {

[0030] "Interface Name": servicename

[0031] "Method signature list":[{

[0032] "Method Name": method1,

[0033] "Input parameter type": ["String"],

[0034] Return value type: ["String"]

[0035] },

[0036] Modified timestamp: 1643535353 ]

[0038] }

[0039] In one optional embodiment, obtaining N service stubs includes: obtaining L service stubs, where L is an integer greater than or equal to N; and determining N service stubs from the L service stubs based on the interface name instances corresponding to the L service stubs respectively.

[0040] Optionally, based on the interface name instance, N service stubs are determined from the L service stubs, where the interface name instance in the service stub refers to the name of the service interface defined by the service provider. The purpose of the interface name instance is to uniquely identify the service interface so that the corresponding service can be located and invoked based on the interface name instance.

[0041] In one optional embodiment, based on the interface name instances corresponding to the L service stubs respectively, N service stubs are determined from the L service stubs, including: determining the service stubs with the same interface name instance among the L service stubs as N service stubs.

[0042] Optionally, the interface name instances in N service stubs are all identical, and different service stubs with the same interface name instance may have different metadata definitions. When compressing service stubs, multiple service stubs need to be merged to reduce data transmission volume and improve performance. If the interface name instances of multiple service stubs are different, it means they provide different services and cannot be merged. Therefore, multiple service stubs can only be compressed if the interface name instances are identical. This allows merging request and response data for the same interface name instance, reducing data transmission volume and improving network transmission efficiency. For example, service stub 1 and service stub 2 have the same interface name instance `servicename`, but their internal metadata definitions and metadata instance fields are not completely consistent; compression can then be performed.

[0043] Service stub 2: {

[0044] "Interface Name": servicename

[0045] "Method signature list":[{

[0046] "Method Name": method2,

[0047] "Input parameter type": ["Integer"],

[0048] "Return type": ["String"],

[0049] "Deployment Park": "Park 1"

[0050] Version number: 1.0

[0051] },]

[0052] }

[0053] Step S102: Establish a tree structure model based on N service stubs.

[0054] Optionally, based on N service stubs, the metadata instances included in the N service stubs are abstracted into a tree structure for modeling. A tree structure model is a special type of tree structure model; it is an acyclic, directed, and connected graph structure. In a tree structure model, each node has only one parent node but can have multiple child nodes. All nodes are connected by edges, and the path from the root node to any node is unique. Abstracting the model into a tree structure provides an intuitive, flexible, and efficient data structure.

[0055] In one optional embodiment, a tree structure model is established based on N service stubs, including: when the interface name instances of the N service stubs are the same, the interface name is used as the root node, and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs are used as leaf nodes, to establish a tree structure model with M layers of nodes, wherein the M layers of nodes correspond one-to-one with the M metadata definitions.

[0056] Optionally, when the interface name instances of N service stubs are the same, a tree structure model with M layers of nodes is established, with the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes. For example, when the interface name instances of service stub 1 and service stub 2 are both servicename, the root node is: interface name, and the leaf nodes are: metadata instances 0 and 1.0 corresponding to the version number, method instances method1 and method2 corresponding to the method name, metadata instances 1643535353 and 0 corresponding to the modification timestamp, metadata instances String and Integer corresponding to the input parameter type, metadata instances String and String corresponding to the return value type, and metadata instances 0 and 1 corresponding to the deployment zone, respectively, resulting in a tree structure model with 7 layers of nodes.

[0057] In one optional embodiment, a tree structure model with M layers of nodes is established, using the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes. This includes: using the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes, the tree structure model is established as follows: The M metadata definitions are sorted to obtain a sorting result, where the interface name is in the first position of the sorting result; based on the sorting result, the corresponding layer nodes of the M metadata definitions are sequentially taken as the current layer nodes, and the following operations are performed until the current layer node is the corresponding layer node of the last metadata definition in the sorting result: determining the next layer node of the current layer node, and the first metadata definition corresponding to the next layer node; determining the N first metadata instances corresponding to the first metadata definition among the metadata instances corresponding to the M metadata of the N service stubs; and using the N first metadata instances as leaf nodes of each node in the current layer node to construct the tree structure model.

[0058] Optionally, using the interface name as the root node and the metadata instances other than the interface name among the N service stubs as leaf nodes, a tree structure model is established as follows: The M metadata definitions are sorted to obtain a sorting result, where the interface name is located in the first position of the sorting result; based on the sorting result, the corresponding layer nodes of the M metadata definitions are sequentially taken as the current layer node; after the current layer node is determined, the next layer node of the current layer node and the first metadata definition corresponding to the next layer node are determined; N first metadata instances corresponding to the first metadata definition are determined; the N first metadata instances are taken as leaf nodes of each node in the current layer node, until the current layer node is the corresponding layer node of the last metadata definition in the sorting result.

[0059] Optionally, for example, service stub 1 and service stub 2 are compressed. First, the seven metadata definitions included in the two service stubs are sorted to obtain: interface name, version number, method name, modification timestamp, input parameter type, return value type, and deployment zone. The interface name is used as the root node for the first-level node. The second-level node is determined by the version number, and the metadata instances 0 and 1.0 corresponding to the version number are used as the leaf nodes of the second level. Next, the third-level node is determined by the method name. Each leaf node in the second level is connected to the two metadata instances method1 and method2 corresponding to the method name. Therefore, the leaf nodes of the third level are method1, method2, method1, method2, until the current level node is the corresponding level node of the deployment zone. Figure 2This is a schematic diagram of a tree structure model for service stub compression provided in the embodiments of this application. The tree structure model established using service stub 1 and service stub 2 is as follows: Figure 2 As shown.

[0060] Step S103: Prune the tree structure model to obtain the compressed service stub.

[0061] Optionally, pruning the tree structure model can remove some unimportant metadata definitions and corresponding metadata instances, making the service stubs more concise, reducing the management and storage costs of service stubs, and improving the governance quality of service stubs.

[0062] In one optional embodiment, pruning the tree structure model to obtain compressed service stubs includes: determining the weight values ​​corresponding to the sub-paths included in the tree structure model, wherein a sub-path is a connection path between any two nodes in two adjacent layers of the tree structure model; and determining the N values ​​from the root node to each leaf node included in the last layer of the tree structure model. M-1 One main path; based on the weight values ​​corresponding to the sub-paths included in the tree structure model, determine N. M-1 The comprehensive weight values ​​corresponding to each main path; based on N M-1 The tree structure model is pruned based on the comprehensive weight values ​​corresponding to each main path to obtain the pruning result; the compressed service stub is obtained based on the metadata definition and corresponding metadata instance included in the pruning result.

[0063] Optionally, determine the weight values ​​corresponding to the sub-paths included in the tree structure model, and sequentially traverse the N values ​​from the root node to each leaf node included in the last level of the tree structure model. M-1 One main path, determine N M-1 The main paths are assigned comprehensive weight values. Based on these comprehensive weight values, the tree structure model is pruned to obtain the pruning results. Based on the metadata definitions and corresponding metadata instances included in the pruning results, compressed service stubs are obtained. For example, in the tree structure model established using service stub 1 and service stub 2, the weight value of the sub-path from the modification timestamp layer node to the input parameter type layer node is determined to be equal to the modification timestamp, the weight value of the sub-path from the version number layer node to the method name layer node is equal to the version number rounded to two decimal places, and the weight of the remaining sub-paths is 1. This process is repeated sequentially from the root node to the deployment zone. 6 For each main path, sum the weights of the sub-paths within that main path, or perform a weighted summation, to obtain 2. 6The comprehensive weight values ​​corresponding to each main path are determined. Based on the comprehensive weight values, the tree structure model is pruned to obtain the pruning results. Based on the metadata definitions and corresponding metadata instances included in the pruning results, the compressed service stub 3 is obtained.

[0064] Service stub 3: {

[0065] "Interface Name": servicename

[0066] "Method signature list":[{

[0067] "Method Name": method1,

[0068] "Input parameter type": ["String"],

[0069] Return value type: ["String"]

[0070] },

[0071] Modified timestamp: 1643535353

[0072] Version number: 1.0 ]

[0074] }

[0075] In one alternative embodiment, based on N M-1 The comprehensive weight values ​​corresponding to each main path are used to prune the tree structure model, resulting in the pruning results, including: N... M-1 Among the main paths, the main path with the largest comprehensive weight value is determined as the target path; other paths in the tree structure model other than the target path are pruned to obtain the pruning results.

[0076] Optionally, N M-1 In a tree structure model with service stub 1 and service stub 2, the main path with the highest overall weight value is determined as the target path. Other paths are pruned to obtain the pruning result. For example, the main path with the highest overall weight value in the tree structure model is determined as: interface name, 1.0, method1, 1643535353, String, String, 0. Other paths are pruned to obtain the pruning result. By retaining the path with the highest overall weight value and pruning the other paths with lower weight values, unnecessary metadata instances and definitions in the service stubs can be removed, reducing the size of the service stubs. This reduces the space requirements and storage costs of the service stubs, thereby improving the governance quality and reducing governance costs.

[0077] Through steps S101 to S104, a tree structure model can be established based on N service stubs. Pruning the tree structure model achieves the goal of simplifying and compressing the service stubs, solving the problem of low service stub maintenance quality and high cost caused by the lack of mature service stub compression methods in related technologies. This ultimately improves the quality of service stub maintenance and reduces its cost.

[0078] Based on the above embodiments and optional embodiments, this application proposes an optional implementation method, which includes:

[0079] Step S1: Obtain L service stubs, where L is an integer greater than or equal to N.

[0080] Step S2: Determine N service stubs from the L service stubs that have the same interface name instance. Each of the N service stubs includes M metadata definitions and M metadata instances corresponding to each metadata definition. The M metadata definitions include the interface name and M-1 metadata instances other than the interface name. M and N are integers greater than or equal to 2.

[0081] Step S3: When the interface name instances of the N service stubs are the same, the interface name is used as the root node, and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs are used as leaf nodes. A tree structure model with M layers of nodes is established as follows:

[0082] Step S31: Sort the M metadata definitions to obtain a sorting result, where the interface name is located in the first position of the sorting result.

[0083] Step S32: Based on the sorting result, sequentially select the corresponding layer nodes of the M metadata definitions as the current layer nodes.

[0084] Step S33: Determine the next layer node of the current layer node and define the first metadata corresponding to the next layer node.

[0085] Step S34: Determine the N first metadata instances that correspond to the first metadata definition from among the metadata instances corresponding to the M metadata instances corresponding to the N service stubs.

[0086] Step S35: Use N first metadata instances as leaf nodes of each node in the current layer to construct a tree structure model.

[0087] Step S36: Determine whether the current layer node is the corresponding layer node of the last metadata definition in the sorting result. If the current layer node is the corresponding layer node of the last metadata definition in the sorting result, execute step S4; otherwise, execute step S32.

[0088] Step S4: Determine the weight values ​​corresponding to the sub-paths included in the tree structure model, where a sub-path is the connection path between any two nodes in two adjacent layers of the tree structure model.

[0089] Step S5: Determine the N values ​​from the root node to each leaf node in the last level of the tree structure model. M -1 The main path.

[0090] Step S6: Based on the weight values ​​corresponding to the sub-paths included in the tree structure model, determine N. M-1 The comprehensive weight values ​​corresponding to each main path.

[0091] Step S7, N M-1 Among the main paths, the main path with the highest overall weight value is determined as the target path.

[0092] Step S8: Prune the paths in the tree structure model other than the target path to obtain the pruning results.

[0093] Step S9: Based on the metadata definitions included in the pruning results and the corresponding metadata instances, obtain the compressed service stub.

[0094] Step S10: Use the compressed service stub for secondary processing to complete governance results such as method name overloading and interface using custom types.

[0095] The embodiments of this application can achieve at least the following technical effects: extracting metadata included in complex service stubs, reducing the size of service stubs, improving the quality of service stub governance, and reducing the cost of service stub governance.

[0096] It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.

[0097] This application also provides a service stub compression processing apparatus. It should be noted that the service stub compression processing apparatus of this application can be used to execute the service stub compression processing method provided in this application. The service stub compression processing apparatus provided in this application will be described below.

[0098] Figure 3 This is a schematic diagram of a service stub compression processing apparatus according to an embodiment of this application. Figure 3 As shown, the device includes: a first acquisition module 301, a first establishment module 302, and a first pruning module 303, wherein,

[0099] The first acquisition module 301 is used to acquire N service stubs, wherein each of the N service stubs includes M metadata definitions and M metadata instances corresponding to each of the M metadata definitions. The M metadata definitions include an interface name and M-1 metadata instances other than the interface name. M and N are integers greater than or equal to 2.

[0100] The first establishment module 302 is connected to the first acquisition module 301 and is used to establish a tree structure model based on N service stubs;

[0101] The first pruning module 303, connected to the first creation module 302, is used to prune the tree structure model to obtain compressed service stubs.

[0102] In this application, a first acquisition module 301 is set up to acquire N service stubs, wherein each of the N service stubs includes M metadata definitions and corresponding metadata instances. The M metadata definitions include an interface name and M-1 metadata instances excluding the interface name, where M and N are integers greater than or equal to 2. A first building module 302 is used to build a tree structure model based on the N service stubs. A first pruning module 303 is used to prune the tree structure model to obtain compressed service stubs. This achieves the goal of building a tree structure model based on N service stubs and simplifying and compressing the service stubs through pruning the tree structure model, solving the problem of low service stub maintenance quality and high cost caused by the lack of mature service stub compression methods in related technologies. This ultimately improves the service stub maintenance quality and reduces the service stub maintenance cost.

[0103] In an optional embodiment, the first acquisition module includes: a first acquisition submodule, configured to acquire L service stubs, where L is an integer greater than or equal to N; and a first determination submodule, configured to determine N service stubs from the L service stubs based on the interface name instances corresponding to the L service stubs respectively.

[0104] In an optional embodiment, the first determining submodule includes: a second determining submodule, used to determine N service stubs among L service stubs that have the same interface name instance.

[0105] In an optional embodiment, the first establishment module includes: a second establishment submodule, used to establish a tree structure model with M layers of nodes, where the interface name instances of the N service stubs are the same, with the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes. The M layers of nodes correspond one-to-one with the M metadata definitions.

[0106] In an optional embodiment, the second establishment submodule includes: a first sorting submodule, used to sort the M metadata definitions to obtain a sorting result, wherein the interface name is located in the first position of the sorting result; a third establishment submodule, used to, based on the sorting result, sequentially take the corresponding layer nodes of the M metadata definitions as the current layer node and perform the following operations until the current layer node is the corresponding layer node of the last metadata definition in the sorting result; a third determination submodule, used to determine the next layer node of the current layer node and the first metadata definition corresponding to the next layer node; a fourth determination submodule, used to determine the N first metadata instances corresponding to the first metadata definition among the metadata instances corresponding to the M metadata of the N service stubs respectively; and a fourth establishment submodule, used to construct a tree structure model with the N first metadata instances as the leaf nodes of each node in the current layer node.

[0107] In an optional embodiment, the first pruning module includes: a fifth determining submodule, configured to determine the weight values ​​corresponding to the sub-paths included in the tree structure model, wherein the sub-path is a connection path between any two nodes in two adjacent layers of the tree structure model; and a sixth determining submodule, configured to determine the N values ​​from the root node to each leaf node included in the last layer of the tree structure model. M-1 The main path; the seventh determining submodule, used to determine N based on the weight values ​​corresponding to the subpaths included in the tree structure model. M-1 The comprehensive weight values ​​corresponding to each main path; the first pruning submodule, used for N M-1 The comprehensive weight values ​​corresponding to each main path are used to prune the tree structure model to obtain the pruning result; the eighth determination submodule is used to obtain the compressed service stub based on the metadata definition and corresponding metadata instance included in the pruning result.

[0108] In an optional embodiment, the first pruning submodule described above includes: a ninth determining submodule, used to determine N M-1 Among the main paths, the main path with the largest comprehensive weight value is determined as the target path; the second pruning submodule is used to prune other paths in the tree structure model except for the target path to obtain the pruning result.

[0109] It should be noted that the above modules can be implemented by software or hardware. For example, for the latter, it can be implemented in the following ways: the above modules can be located in the same processor; or the above modules can be located in different processors in any combination.

[0110] It should be noted that the first acquisition module 301, the first establishment module 302, and the first pruning module 303 mentioned above correspond to steps S101 to S103 in the embodiments. The instances and application scenarios implemented by the above modules and their corresponding steps are the same, but they are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of the device, can run on a computer terminal.

[0111] It should be noted that the optional or preferred implementation methods of this embodiment can be found in the relevant descriptions in the embodiments, and will not be repeated here.

[0112] The aforementioned service stub compression processing device includes a processor and a memory. The aforementioned units are all stored in the memory as program units, and the processor executes the aforementioned program units stored in the memory to realize the corresponding functions.

[0113] The processor contains a kernel, which retrieves the corresponding program unit from memory. One or more kernels can be configured, and the service stub compression process can be performed by adjusting kernel parameters.

[0114] The memory may include non-permanent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.

[0115] This application provides a non-volatile storage medium storing a program that, when executed by a processor, implements the above-described service stub compression processing method.

[0116] This application provides a processor for running a program, wherein the program executes the service stub compression processing method during runtime.

[0117] like Figure 4 As shown in the illustration, this application provides an electronic device 10, which includes a processor, a memory, and a program stored in the memory and executable on the processor. When the processor executes the program, it performs the following steps: obtaining N service stubs, wherein each of the N service stubs includes M metadata definitions and corresponding metadata instances, the M metadata definitions including an interface name and M-1 metadata instances excluding the interface name, where M and N are integers greater than or equal to 2; establishing a tree structure model based on the N service stubs; and pruning the tree structure model to obtain compressed service stubs. The device in this document can be a server, PC, PAD, mobile phone, etc.

[0118] This application also provides a computer program product, which, when executed on a data processing device, is suitable for executing an initialization program with the following method steps: obtaining N service stubs, wherein each of the N service stubs includes M metadata definitions and metadata instances corresponding to the M metadata, the M metadata definitions including an interface name and M-1 metadata instances excluding the interface name, wherein M and N are integers greater than or equal to 2; establishing a tree structure model based on the N service stubs; and pruning the tree structure model to obtain compressed service stubs.

[0119] Optionally, the above-mentioned computer program product is also suitable for executing a program that initializes with the following method steps: obtaining L service stubs, where L is an integer greater than or equal to N; and determining N service stubs from the L service stubs based on the interface name instances corresponding to the L service stubs respectively.

[0120] Optionally, the above-mentioned computer program product is also suitable for executing a program that initializes with the following method steps: determining N service stubs among L service stubs that have the same interface name instance.

[0121] Optionally, the above-mentioned computer program product is also suitable for executing an initialization program with the following method steps: when the interface name instances of N service stubs are the same, a tree structure model including M layers of nodes is established with the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes, wherein the M layers of nodes correspond one-to-one with the M metadata definitions.

[0122] Optionally, the aforementioned computer program product is also suitable for executing an initialization program with the following method steps: using the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes, a tree structure model is established in the following manner: sorting the M metadata definitions to obtain a sorting result, wherein the interface name is located in the first position in the sorting result; based on the sorting result, sequentially taking the corresponding layer nodes of the M metadata definitions as the current layer nodes, and performing the following operations until the current layer node is the corresponding layer node of the last metadata definition in the sorting result: determining the next layer node of the current layer node, and the first metadata definition corresponding to the next layer node; determining the N first metadata instances corresponding to the first metadata definition among the metadata instances corresponding to the M metadata of the N service stubs; using the N first metadata instances as leaf nodes of each node in the current layer node, and constructing a tree structure model.

[0123] Optionally, the aforementioned computer program product is also suitable for executing an initialization program with the following method steps: determining the weight values ​​corresponding to the sub-paths included in the tree structure model, wherein a sub-path is a connection path between any two nodes in two adjacent layers of the tree structure model; determining the N values ​​from the root node to each leaf node included in the last layer of the tree structure model. M-1 One main path; based on the weight values ​​corresponding to the sub-paths included in the tree structure model, determine N. M-1 The comprehensive weight values ​​corresponding to each main path; based on N M-1 The tree structure model is pruned based on the comprehensive weight values ​​corresponding to each main path to obtain the pruning result; the compressed service stub is obtained based on the metadata definition and corresponding metadata instance included in the pruning result.

[0124] Optionally, the above-mentioned computer program product is also suitable for executing a program that initializes N using the following method steps: M-1 Among the main paths, the main path with the largest comprehensive weight value is determined as the target path; other paths in the tree structure model other than the target path are pruned to obtain the pruning results.

[0125] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0126] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. 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 program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0127] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0128] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0129] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.

[0130] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.

[0131] Computer-readable media includes both permanent and non-permanent, removable and non-removable media that can store information using any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media does not include transient computer-readable media, such as modulated data signals and carrier waves.

[0132] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0133] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0134] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.

Claims

1. A method for compressing service stubs, characterized in that, include: Obtain N service stubs, wherein each of the N service stubs includes M metadata definitions and metadata instances corresponding to the M metadata. Each of the M metadata definitions includes an interface name and M-1 metadata instances other than the interface name, where M and N are integers greater than or equal to 2. Based on the N service stubs, a tree structure model is established, including: when the interface name instances of the N service stubs are the same, the interface name is used as the root node, and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs are used as leaf nodes, to establish the tree structure model including M layers of nodes, wherein the M layers of nodes correspond one-to-one with the M metadata definitions. Pruning the tree structure model to obtain compressed service stubs includes: determining the weight values ​​corresponding to the sub-paths included in the tree structure model, wherein the sub-path is the connection path between any two nodes in two adjacent layers of the tree structure model; and determining the N values ​​from the root node to each leaf node included in the last layer of the tree structure model. M-1 The main path; based on the weight values ​​corresponding to the sub-paths included in the tree structure model, determine the N. M-1 The comprehensive weight values ​​corresponding to each main path; based on the N M-1 The tree structure model is pruned based on the comprehensive weight values ​​corresponding to each main path to obtain the pruning result; the compressed service stub is obtained based on the metadata definition and corresponding metadata instance included in the pruning result.

2. The method according to claim 1, characterized in that, The acquisition of N service stubs includes: Retrieve L service stubs, where L is an integer greater than or equal to N; Based on the interface name instances corresponding to the L service stubs, the N service stubs are determined from the L service stubs.

3. The method according to claim 2, characterized in that, The step of determining the N service stubs from the L service stubs based on the interface name instances corresponding to the L service stubs includes: Among the L service stubs, the service stubs with the same interface name instance are determined as the N service stubs.

4. The method according to claim 1, characterized in that, The tree structure model, with the interface name as the root node and the M-1 metadata instances corresponding to the N service stubs as leaf nodes, is established, comprising M layers of nodes, including: The tree structure model is established with the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes, in the following manner: The M metadata definitions are sorted to obtain a sorting result, wherein the interface name is located in the first position of the sorting result; Based on the sorting result, the corresponding layer nodes of the M metadata definitions are sequentially taken as the current layer nodes, and the following operations are performed until the current layer node is the corresponding layer node of the last metadata definition in the sorting result: Determine the next layer node of the current layer node, and define the first metadata corresponding to the next layer node; Determine the N first metadata instances that correspond to the first metadata definition from among the M metadata instances corresponding to the N service stubs; The tree structure model is constructed by using the N first metadata instances as leaf nodes of each node in the current layer.

5. The method according to claim 1, characterized in that, The basis of N M-1 The tree structure model is pruned based on the comprehensive weight values ​​corresponding to each main path, resulting in the following pruning results: The N M-1 Among the main paths, the main path with the highest comprehensive weight value is determined as the target path; The other paths in the tree structure model, excluding the target path, are pruned to obtain the pruning result.

6. An offline task scheduling device, characterized in that, include: The first acquisition module is used to acquire N service stubs, wherein the N service stubs each include M metadata definitions and metadata instances corresponding to the M metadata. The M metadata definitions include interface names and M-1 metadata instances other than the interface names, wherein M and N are integers greater than or equal to 2. The first establishment module is used to establish a tree structure model based on the N service stubs, including: when the interface name instances of the N service stubs are the same, taking the interface name as the root node and the metadata instances corresponding to the M-1 metadata definitions of the N service stubs as leaf nodes, to establish the tree structure model including M layers of nodes, wherein the M layers of nodes correspond one-to-one with the M metadata definitions. The first pruning module is used to prune the tree structure model to obtain compressed service stubs, including: determining the weight values ​​corresponding to the sub-paths included in the tree structure model, wherein the sub-path is the connection path between any two nodes in two adjacent layers of the tree structure model; and determining the N values ​​from the root node to each leaf node included in the last layer of the tree structure model. M-1 The main path; based on the weight values ​​corresponding to the sub-paths included in the tree structure model, determine the N. M-1 The comprehensive weight values ​​corresponding to each main path; based on the N M-1 The tree structure model is pruned based on the comprehensive weight values ​​corresponding to each main path to obtain the pruning result; the compressed service stub is obtained based on the metadata definition and corresponding metadata instance included in the pruning result.

7. A non-volatile storage medium, characterized in that, The non-volatile storage medium stores multiple instructions, which are adapted to be loaded by a processor and executed by the service stub compression processing method according to any one of claims 1 to 5.

8. An electronic device, characterized in that, It includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors cause the one or more processors to implement the service stub compression processing method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Model pruning method and device, equipment, storage medium and program product

    CN116523025A

  • Tree pruning of icon trees via subtree selection using tree functionals

    US20070168856A1