Embedded service combination compilation method, engine, device and storage medium
The embedded service combination information of the embedded service is compiled into an embedded service combination file in a unified format through the embedded service combination engine, which solves the problem of lack of unified standards in the existing technology, realizes efficient embedded service combination, and improves execution efficiency and convenience.
Patent Information
- Application Number
- CN202111168970.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-09
- Publication Date
- 2025-04-11
- Estimated Expiration
- 2041-10-09
AI Technical Summary
The prior art lacks a unified standard for describing embedded service combination methods, resulting in low convenience, poor applicability of embedded service combinations, and difficult deployment of embedded devices with resource-constrained resources, and low execution efficiency of service combinations.
An embedded service combination compilation method is provided. It receives service combination information of multiple different forms of embedded services through the embedded service combination engine, converts it into a unified format, and generates an embedded service combination file, including a description file, an execution device configuration file and a bytecode binary executable file, and deploys it to the embedded service combination execution device.
It realizes the unified standard for embedded service combination, improves the convenience and applicability of embedded service combination, optimizes the bytecode binary executable file, and improves the execution efficiency of embedded service combination services.
Smart Images

Figure CN113900658B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of service computing technology, and in particular to an embedded service combination compilation method, engine, device and storage medium. Background Art
[0002] Generally, an independent program deployed on a single device that can respond to user requests is called a service. If the device is an embedded device, the service is an embedded service because the embedded device has the characteristic of limited resources.
[0003] Embedded service composition refers to redirecting the output of some embedded services to the input of other embedded services, thereby combining multiple embedded services into a new embedded service, thereby realizing the collaborative work of embedded devices, realizing the functional expansion of services, and improving reusability and reducing development costs. As embedded service composition has high application value, embedded service composition can realize the collaborative work of embedded devices, overcome the problem of limited resources of a single embedded device, and give full play to the potential of embedded devices. Therefore, many embedded systems currently aggregate a considerable number of embedded services and set up embedded composite services according to demand to meet actual needs.
[0004] However, due to the lack of a unified standard for describing embedded service composition, it cannot adapt to different embedded systems, so embedded service composition is inconvenient and has poor applicability. Existing technologies are too large and bloated for resource-constrained embedded devices, making them difficult to deploy and having low efficiency in service composition execution.
[0005] It should be noted that this section is intended to provide a background or context to the embodiments of the present disclosure as recited in the claims. No admission is made that the description herein is prior art by virtue of its inclusion in this section. Summary of the invention
[0006] The embodiments of the present invention provide an embedded service composition compilation method, engine, device and storage medium to solve the problems in the prior art that the embedded service composition is inconvenient and has poor applicability due to the lack of a unified standard for describing the embedded service composition method, and the prior art is too large and bloated for resource-constrained embedded devices to be difficult to deploy and the service composition execution efficiency is low.
[0007] In a first aspect, an embodiment of the present invention provides an embedded service combination compilation method, comprising:
[0008] The embedded service composition engine receives service composition information of various embedded services and converts it into a unified format;
[0009] The embedded service composition engine compiles the service composition information to generate an embedded service composition file; the embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file and an embedded service composition bytecode binary executable file;
[0010] The embedded service composition engine deploys the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of each embedded service.
[0011] As a preferred embodiment of the first aspect of the present invention, the embedded service composition engine receives service composition information of multiple different forms of embedded services, including:
[0012] The embedded service composition engine receives service composition information of multiple different forms of embedded services through a graphical interface or a command line interface;
[0013] The embedded service composition engine converts the service composition information into a unified format, wherein the service composition information in the unified format includes a service composition relationship diagram, a service composition resource information structure, and a service composition description information structure.
[0014] As a preferred embodiment of the first aspect of the present invention, the embedded service composition engine compiles the service composition information to generate an embedded service composition file, including:
[0015] The embedded service composition engine formats the service composition description information structure into a character string of an S expression and outputs it to a file to generate the embedded service composition description file;
[0016] The embedded service composition engine converts the service composition resource information structure into a character string and outputs it to a file, thereby generating the embedded service composition execution device configuration file;
[0017] The embedded service composition engine processes the service composition relationship graph using a topological sorting algorithm to generate an embedded service composition bytecode indicating how to execute the embedded composition service; and outputs the embedded service composition bytecode to a file in a binary format to generate a binary executable file of the embedded service composition bytecode;
[0018] The embedded service composition engine packages the embedded service composition description file, the embedded service composition execution device configuration file and the embedded service composition bytecode binary executable file to generate the embedded service composition file.
[0019] As a preferred embodiment of the first aspect of the present invention, the embedded service composition engine deploys the embedded service composition file to an embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of each embedded service, including:
[0020] The embedded service composition engine enables the embedded service composition execution device to load and parse the embedded service composition description file to register the embedded composition service;
[0021] The embedded service composition engine enables the embedded service composition execution device to load the embedded service composition execution device configuration file to perform resource configuration of the embedded service composition execution device;
[0022] The embedded service composition engine enables the embedded service composition execution device to load and execute the embedded service composition bytecode binary executable file, and forms the embedded composition service by calling each of the embedded services to forward data, so as to realize the combination of the embedded services.
[0023] As a preferred embodiment of the first aspect of the present invention, the suffix of the embedded service combination file is .esvcf, and its file header includes a four-byte magic number indicating the file type, a four-byte integer recording the offset of the embedded service combination description file and the four-byte integer recording the size of the part, a four-byte integer recording the offset of the embedded service combination execution device configuration file and the four-byte integer recording the size of the part, and a four-byte integer recording the offset of the embedded service combination bytecode binary executable file and the four-byte integer recording the size of the part.
[0024] In a second aspect, an embodiment of the present invention provides an embedded service composition engine, including:
[0025] A receiving unit, used for receiving service combination information of various embedded services and converting it into a unified format;
[0026] A compiling unit, used for compiling the service composition information to generate an embedded service composition file; the embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file and an embedded service composition bytecode binary executable file;
[0027] The deployment unit is used to deploy the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of each embedded service.
[0028] As a preferred embodiment of the second aspect of the present invention, the receiving unit is specifically configured to:
[0029] Receive service composition information of various embedded services through a graphical interface or a command line interface;
[0030] The service combination information is converted into a unified format, wherein the service combination information in a unified format includes a service combination relationship diagram, a service combination resource information structure, and a service combination description information structure.
[0031] As a preferred embodiment of the second aspect of the present invention, the compilation unit is specifically used for:
[0032] Formatting the service composition description information structure into a character string of an S expression and outputting it to a file to generate the embedded service composition description file;
[0033] Convert the service composition resource information structure into a character string and output it to a file to generate the embedded service composition execution device configuration file;
[0034] Processing the service composition relationship graph using a topological sorting algorithm to generate an embedded service composition bytecode indicating how to execute the embedded composition service; and outputting the embedded service composition bytecode to a file in a binary format to generate a binary executable file of the embedded service composition bytecode;
[0035] The embedded service composition description file, the embedded service composition execution device configuration file and the embedded service composition bytecode binary executable file are packaged to generate the embedded service composition file.
[0036] In a third aspect, an embodiment of the present invention provides an embedded service composition execution device, comprising a processor and a memory, wherein the memory stores execution instructions, and the processor reads the execution instructions in the memory to execute the steps in the embedded service composition compilation method as described in any one of the first aspect and its preferred method.
[0037] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the steps in the embedded service combination compilation method as described in any one of the first aspect and its preferred embodiments.
[0038] The embedded service composition compilation method, engine, device and storage medium provided in the embodiments of the present invention compile the service composition information of the embedded service into an embedded service composition file through the embedded service composition engine, and provide a unified standard for describing the embedded service composition method, so that the embedded service composition execution device can adapt to different embedded platforms. The fully optimized bytecode binary executable file can effectively improve the execution efficiency of the embedded composition service, facilitate the recording and storage of the combination information of the embedded service, and improve the convenience of the embedded service combination. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0040] Figure 1 A flowchart of an implementation method of an embedded service combination compilation method provided by an embodiment of the present invention;
[0041] Figure 2 A schematic diagram of the structure of an embedded service composition engine provided by an embodiment of the present invention;
[0042] Figure 3 A schematic diagram of the structure of an embedded service combination execution device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0044] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.
[0045] Figure 1A flow chart of an embedded service combination compilation method provided by an embodiment of the present invention is exemplarily shown. The method can provide a unified standard for describing the embedded service combination method, so that the embedded service combination execution device can adapt to different embedded platforms. The fully optimized bytecode binary executable file can effectively improve the execution efficiency of the embedded combination service, facilitate the recording and storage of the combination information of the embedded service, and improve the convenience of the embedded service combination.
[0046] Reference Figure 1 As shown, the method mainly includes the following steps:
[0047] Step 101: The embedded service composition engine receives service composition information of multiple different forms of embedded services and converts it into a unified format;
[0048] Step 102: The embedded service composition engine compiles the service composition information to generate an embedded service composition file; the embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file, and an embedded service composition bytecode binary executable file;
[0049] Step 103: The embedded service composition engine deploys the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of various embedded services.
[0050] In step 101, after deploying independent services that can respond to user requests on a single embedded device, the various embedded services are usually combined, so that the coordinated work of the various embedded devices can be achieved through the embedded service combination, and the potential of the embedded devices can be fully utilized.
[0051] Before performing service combination, developers need to input service combination information of various embedded services in different forms into the embedded service combination engine, that is, pre-set the specific service combination method. The service combination information includes the input and output data forwarding relationship of the embedded services to be combined, the service description information such as the name and address of the service combination, and the resource configuration information of the embedded service combination execution device, which is the execution carrier of the service combination. After the information is given by the developer, it will be compiled by the embedded service combination engine into an embedded service combination file that can be parsed and loaded by the embedded service combination execution device to realize the combination of various embedded services.
[0052] Since the embedded service composition engine is responsible for compiling the service composition information preset by the developer into an embedded service composition file for loading and execution by the embedded service composition execution device, the receiving unit of the embedded service composition engine needs to provide different forms of user interfaces for inputting the service composition information.
[0053] Furthermore, the receiving unit of the embedded service composition engine includes two parts: a graphical interface and a command line interface. The graphical interface provides a panel, and the embedded services to be combined are waiting to be dragged and dropped into the service composition panel in the form of controls for connection. After the connection is completed, a series of dialog boxes pop up to guide the developer to set the parameters of the service composition, including service description information, address, port and resource configuration information. After the settings are completed, the embedded service composition engine will compile the service composition information into a unified format for processing by other units. The command line interface is mainly used to read the service composition information stored in the form of S expression text. After a simple lexical and grammatical analysis, a unified format can be generated and handed over to other units for processing.
[0054] In an optional embodiment provided in the present application, step 101 may be specifically implemented according to the following steps:
[0055] Step 1011: The embedded service composition engine receives service composition information of multiple different forms of embedded services through a graphical interface or a command line interface.
[0056] In this step, the embedded service composition engine receives the service composition information input by the developer in two ways, namely, input through a graphical interface or a command line interface. The service composition information specifically includes service composition description information, service composition resource information and forwarding relationship.
[0057] Specifically, the embedded service composition engine provides a graphical interface for inputting service composition information. Developers can drag the components in the sidebar that represent the embedded services to be composed into the service composition panel. The component uses port controls to visualize the input and output of the service. When the mouse is placed on the output port and dragged, a connection line can be drawn until it touches the output port of another service, thus forming a connection line, which represents the forwarding relationship between the input and output.
[0058] After all input and output forwarding relationships are determined, the developer clicks the "Finish Connection" button to pop up the combined service information setting dialog box, where the developer fills in the name, address and other descriptive information of the combined service, as well as resource configuration information such as the number of registers and memory usage, and then clicks the "Setting Completed" button to complete the input of the service combination information.
[0059] The embedded service composition engine also provides a command line interface for inputting service composition information. Specifically, developers can use S expressions to write the forwarding relationship between the input and output of the embedded service to be composed. The format is as follows:
[0060] (((service x output a)(service y input b))…)
[0061] The service composition description information can also be written in S-expression. The basic format is as follows:
[0062] (Combined service name, combined service function description, IP address, port number...)
[0063] Service composition resource information can also be written using S expressions. The basic format is as follows:
[0064] ((resource configuration parameter configuration value)...)
[0065] These S expressions can be stored in a text file by entering the following in the command line:
[0066] Embedded service composition engine forwarding relationship file name service composition description information file name service composition resource information file name…
[0067] You can start the embedded service composition engine through the command line interface and complete the input of service composition information.
[0068] Step 1012: The embedded service composition engine converts the service composition information into a unified format. The service composition information in the unified format includes a service composition relationship diagram, a service composition resource information structure, and a service composition description information structure.
[0069] In this step, the embedded service composition engine converts the input service composition information into a unified format for generating an embedded service composition file.
[0070] The service composition information converted into a unified format includes three parts: a service composition relationship graph, a service composition resource information structure, and a service composition description information structure. The service composition relationship graph represents the forwarding relationship between the input and output of the embedded service, where the input and output of the embedded service are nodes and the connection relationship is an edge. The service composition resource information structure contains the resource information that needs to be configured to execute the final embedded composite service, such as the number of registers, memory usage, etc. The service composition description information structure represents the information required to describe the final embedded composite service, including the port number of the final embedded composite service represented by an integer, the composite service name represented by a string, etc.
[0071] This unified format is common to both interfaces.
[0072] In step 102, after the input service composition information is converted into a unified format, the embedded service composition engine will use the generated unified format for compilation to generate an embedded service composition file. The embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file, and an embedded service composition bytecode binary executable file. Among them, the embedded service composition description file is used to describe the definition of the final embedded composite service, including the name, address and other service description information of the embedded composite service; the embedded service composition execution device configuration file specifies the number of registers, memory occupancy and other device resource configuration information of the engine; the embedded service composition bytecode binary executable file contains the service composition bytecode, which is loaded and executed by the embedded service composition execution device, thereby completing the input and output forwarding, data segmentation and aggregation and other operations of the combined embedded service, and realizing service composition.
[0073] Preferably, the suffix of the embedded service combination file is .esvcf, and its file header includes a four-byte magic number indicating the file type, a four-byte integer recording the offset of the embedded service combination description file and the four-byte integer recording the size of the part, a four-byte integer recording the offset of the embedded service combination execution device configuration file and the four-byte integer recording the size of the part, and a four-byte integer recording the offset of the embedded service combination bytecode binary executable file and the four-byte integer recording the size of the part.
[0074] The embedded service composition file is stored in binary form and can be loaded by the embedded service composition execution device to complete the registration of the final embedded composition service, the resource configuration of the embedded service composition execution device and the deployment of the embedded service composition to realize the composition service.
[0075] Furthermore, the function of other units of the embedded service composition engine is to compile the service composition information in a unified format into an embedded service composition file, including the generation of an embedded service composition description file, the generation of an embedded service composition execution device configuration file, and the generation of an embedded service composition bytecode binary executable file.
[0076] Among them, the generation of the embedded service composition bytecode binary executable file is the focus. The generation process includes register allocation, data forwarding instruction generation, etc., and finally generates a set of binary bytecodes. By executing the bytecodes, the embedded service composition execution device can implement the set composition service. Other units of the embedded service composition engine will also optimize the generated embedded service composition bytecode binary executable file, such as eliminating unnecessary register allocation, to improve execution efficiency.
[0077] In an optional embodiment provided in the present application, step 102 may be specifically implemented according to the following steps:
[0078] Step 1021: The embedded service composition engine formats the service composition description information structure into a character string of an S expression and outputs it to a file, thereby generating an embedded service composition description file.
[0079] In this step, the generation of the embedded service composition description file is essentially to format the service composition description information structure that records the composition service information into a string of S expressions, which mainly declares the name, address, listening port, input, output and other service description information of the service composition.
[0080] The generated embedded service composition description file has the following format:
[0081] (Combined service name Combined service function description IP address Port number
[0082] (Data type of input one Data type of input two...)
[0083] (Data type of output one Data type of output two...)
[0084] Additional information...)
[0085] This string can be output to a file, that is, an embedded service combination description file is generated.
[0086] The embedded service composition execution device can obtain the composition service information by parsing the embedded service composition description file, and thus can register with the service management center.
[0087] The embedded service composition description file can also exist as a separate text file with the suffix .esvcds, which can be loaded and parsed independently.
[0088] Step 1022: The embedded service composition engine converts the service composition resource information structure into a character string and outputs it to a file, thereby generating an embedded service composition execution device configuration file.
[0089] In this step, the generation of the embedded service composition execution device configuration file is essentially to convert the service composition resource information structure that records the service composition resource information into a string. The resources related to the service composition include the number of registers in the embedded service composition execution device, the number of virtual ports and the memory resources that may be occupied, the execution time limit of the composite service, the waiting time limit for receiving data, etc.
[0090] The embedded service combination execution device configuration file is constructed in the form of "variable name = value".
[0091] Here is an example:
[0092] memory=100MB
[0093] register=100
[0094] virtual_port=5
[0095] wait_time=1000ms
[0096] …
[0097] After reading the file, the embedded service combination execution device will configure and constrain itself: if it detects that the memory usage exceeds the set upper limit, it will try to start garbage collection on its own; when making a service call, if the waiting time for the return message exceeds the set waiting time limit, the call will be deemed to have failed, etc., thereby fully utilizing the configured resources.
[0098] The embedded service composition execution device configuration file can also exist as a separate text file with the suffix .esvcrc, which can be loaded and parsed independently.
[0099] Step 1023: The embedded service composition engine processes the service composition relationship graph using a topological sorting algorithm to generate an embedded service composition bytecode that indicates how to execute the embedded composition service; and outputs the embedded service composition bytecode to a file in binary format to generate an embedded service composition bytecode binary executable file.
[0100] In this step, the embedded service composition engine uses a topological sorting algorithm to process the service composition relationship graph, determine the calling order of each embedded service, the forwarding order of input and output, the aggregation and separation of data, etc., and finally generate a service composition execution call sequence represented by the embedded service composition bytecode.
[0101] To generate an embedded service composition bytecode binary executable file, the first step is to obtain the address, port number, and number of inputs and outputs of each embedded service in the service composition relationship graph. The address and port number of the embedded service are used to generate the svc instruction, and the number of inputs and outputs is used to generate the grp instruction to declare the service input and output register group. Each embedded service also corresponds to a service call data register and a service return data register, both of which are declared by the reg instruction. The embedded service composition engine will associate the service call data register, service return data register, service input and output register group, and service to subsequently generate the service call instruction. After these tasks are completed, the static part of the embedded service composition bytecode binary executable file has been generated. The embedded service composition engine will automatically insert two nop instructions to separate the static and dynamic parts of the embedded service composition bytecode binary executable file.
[0102] The second step is to perform topological sorting based on the service composition relationship graph to generate the dynamic part of the embedded service composition bytecode binary executable file. After topological sorting, the process of forwarding the output to the input is compiled into a mov instruction from the output register to the input register. The specific format is as follows:
[0103] mov output register input register
[0104] The call of embedded service includes three processes: first, aggregate the inputs of embedded service into service call data, second, send the service call data to the embedded service and wait for the return data, and finally, split the return data and put it into the corresponding embedded service output register group. Therefore, an embedded service call will be compiled into a string of instructions in the format of:
[0105] join service input register group service call data register
[0106] call service register service call data register service return data register
[0107] spl service return data register service output register group
[0108] In addition, regarding the processing of the input and output of the composite service itself, this part of the instructions is automatically generated by the embedded service composition engine. In the service composition relationship graph, all input nodes with an in-degree of 0 are considered to be the input of the composite service itself, and all output nodes with an out-degree of 0 are considered to be the output of the composite service itself. Since the input and output of the composite service itself are relatively special, the call data register of the composite service is numbered 0, the return data register is numbered 1, the composite service input register group is numbered 0, and the output register group is numbered 1. Since the embedded service composition execution device will automatically put the received service call data into register No. 0, the embedded service composition engine will insert the spl 0 0 instruction to split the received call data, and a set of mov instructions to move the data in register group No. 0 to the register corresponding to the input node with an in-degree of 0. The format of this part of the instructions is fixed and is placed before the binary bytecode generated by the topological sort. In contrast, after the binary bytecode generated by topological sorting, the embedded service composition engine will generate a series of mov instructions to move the data in the register corresponding to the output node with an out-degree of 0 to register group 1, and then insert a join 1 1 instruction to generate the composite service return data and put it into register 1. Finally, the data in register 1 will be returned to the caller by the embedded service composition execution device as the return data of the composite service.
[0109] After the embedded service composition engine generates the embedded service composition bytecode, the bytecode is output to a file in a binary format, thereby generating an embedded service composition bytecode binary executable file.
[0110] The embedded service assembly bytecode binary executable file consists of the following basic format:
[0111] Operation Operand 1 Operand 2…
[0112] Except for the service declaration instruction, all instructions are 4 bytes in size and have a fixed length. The service declaration instruction svc is 8 bytes or 20 bytes long, depending on whether the service address is IPv4 or IPv6. In short, the embedded service combination bytecode is parsed in 4-byte units to ensure the simplicity of the parsing method, reduce the consumption of computing resources, and adapt to the reality of limited resources in embedded devices.
[0113] The embedded service composition bytecode binary executable file operation codes are shown in Table 1.
[0114] Table 1
[0115]
[0116]
[0117] As shown in Table 1, embedded service combination opcodes can be divided into three types: static opcodes, dynamic opcodes, and special opcodes. The static opcodes include reg, grp, and svc, which are used to declare register information, register group information, and service information; the dynamic opcodes include mov, spl, join, and call, which are mainly used to implement data processing and service call processes to complete service combination; the special opcodes include nop, which is mainly used for special purposes such as separators.
[0118] The embedded service assembly bytecode binary executable file can also exist as a text file alone, with the suffix .esvcbin, which can be loaded and parsed independently.
[0119] Step 1024: The embedded service composition engine packages the embedded service composition description file, the embedded service composition execution device configuration file, and the embedded service composition bytecode binary executable file to generate an embedded service composition file.
[0120] In this step, the embedded service composition file is essentially a package of the embedded service composition description file, the embedded service composition execution device configuration file and the embedded service composition bytecode binary executable file.
[0121] To generate an embedded service assembly file, you need to know the file sizes of the three files, calculate their offsets, and then output them as binary files in a fixed format.
[0122] In step 103, the embedded service composition execution device loads the embedded service composition file. There are two main loading methods: the first is to start it through a command line on the physical device on which the embedded service composition execution device relies; the second method is that the embedded service composition execution device itself provides a service that can obtain the transmitted embedded service composition file through the network, thereby realizing remote deployment of the service.
[0123] There are also two ways to load and execute files: the first is that the embedded service combination execution device loads the packaged embedded service combination file, and then parses the three files of different formats contained in the embedded service combination file respectively; the second is to directly load the three files of different formats respectively.
[0124] In an optional embodiment provided in the present application, step 103 may be specifically implemented according to the following steps:
[0125] Step 1031: The embedded service composition engine enables the embedded service composition execution device to load and parse the embedded service composition description file to register the embedded service composition.
[0126] In this step, the key for the embedded service composition execution device to load and parse the embedded service composition description file lies in the parsing of the S expression.
[0127] Specifically, the parsing process of S-expression uses brackets and spaces as delimiters to parse the separated tokens separately. Brackets correspond to structures, and the tokens separated by spaces in brackets correspond to the fields of the structure. The nesting of brackets represents the nesting of structures. By parsing S-expression, the structure describing the embedded service composition can be obtained. This structure can be used to register the final embedded composite service.
[0128] Step 1032: The embedded service composition engine enables the embedded service composition execution device to load the embedded service composition execution device configuration file to perform resource configuration of the embedded service composition execution device.
[0129] In this step, the embedded service composition execution device loads and configures the embedded service composition execution device configuration file by parsing line by line, each line represents a setting, with an equal sign as a separator, the left side of the equal sign represents the parameter to be set, and the right side of the equal sign represents the value to be set. The embedded service composition execution device configures itself according to these parameters and values.
[0130] Once the embedded service composition execution device is used to implement a composite service, the configuration of the embedded service composition execution device only needs to be performed once before the composite service stops working, but it must be before the embedded service composition bytecode binary executable file is loaded and executed in a loop.
[0131] Step 1033: The embedded service composition engine enables the embedded service composition execution device to load and execute the embedded service composition bytecode binary executable file, and forwards data by calling each embedded service to form an embedded composition service to realize the combination of embedded services.
[0132] In this step, the process of loading the embedded service combination bytecode binary executable file is to read the entire file into the memory as a bytecode array and point a bytecode pointer to the starting address of the array.
[0133] After the embedded service composition bytecode is loaded, the processor of the embedded service composition execution device executes the static part of the bytecode program to obtain register information, register group information and service information. The static part of the program is only executed once, and then the bytecode pointer points to the first instruction of the dynamic part of the program. The embedded service composition execution device records this position and repeatedly executes the dynamic part to respond to the service request for the composition service.
[0134] Among them, the register group of the embedded service combination execution device corresponds to a group of consecutively numbered registers. The number of the starting register and the number of registers contained in the register group are used as register group information, which are indexed by the pointer pointing to the register group information, and the subscript of the pointer array corresponds to the register group number; similarly, the service information is indexed by the pointer pointing to the service information, and the subscript of the pointer array corresponds to the service number; the mov instruction assigns a value to the pointer; spl and join rely on specific built-in functions for pointer operations; the virtual port of the embedded service combination execution device can be implemented by a process, thread or coroutine, and is presented as an independent entity that can communicate. The call instruction obtains service call data and service information through a pointer, communicates with the help of a virtual port, builds a service request, and parses the return message obtained from the virtual port, and puts the pointer to the return data into the return data register.
[0135] During the execution of instructions, dynamic memory allocation is involved, such as generating call information and receiving return information. Garbage collection records the pointer obtained after each dynamic memory allocation. After the network request ends, or the service is idle, or the occupied memory reaches the set memory limit, the free memory is released based on the reference count.
[0136] After the above processes are executed, the combination of embedded services is realized.
[0137] The embedded service combination compilation method provided by the embodiment of the present invention can be applied in multiple specific scenarios. The specific implementation process of the technical solution will be further described below in combination with specific application scenarios.
[0138] The application scenario is the collaborative control scenario of drone clusters.
[0139] When cooperatively controlling a drone cluster, first deploy an independent program that can respond to user requests, i.e., a service, on each drone. Since the computing device on a drone is usually an embedded device with limited resources, this service is an embedded service that encapsulates and abstracts the capabilities of the drone system. By sending service requests to the embedded service on the drone, commands such as "up", "down", "left", and "right" are used to control the flight direction of the drone, and distance parameters such as "20" and "30" are attached to control the flight distance of the drone, convenient and unified interoperability between drones is achieved.
[0140] Individual drones in a drone swarm often have limited capabilities and need to rely on the capabilities of other drones or work together to complete the assigned tasks. The collaborative control process of this drone swarm can be completed through service combination. For example, a drone is responsible for searching a certain area. Since the area is large, the search radius of the perception device of a single drone is limited, so it needs to call the regional search service provided by other drones to make up for its own shortcomings. At this time, the regional search service of a single drone itself and the regional search services of several other drones constitute a combined service.
[0141] In the past, the above process required operators to arrange the service call order of each drone according to the combination plan, and then manually request each drone in the cluster in turn. In the case of large-scale service combinations, complex combination relationships, and fast-changing combination requirements, this process is not easy to complete and needs to be automated.
[0142] After adopting the embedded service combination compilation method provided by the embodiment of the present invention, the service combination information of the UAV formation control solution is input into the embedded service combination engine, and then the embedded service combination engine compiles the service combination information to generate an embedded service combination file in a unified format. Finally, the generated embedded service combination file is loaded and deployed on the embedded service combination execution device, thereby realizing the combination of embedded services.
[0143] The embedded service combination execution device can be deployed on any drone in the drone cluster. Then, as the executor of the combination service and the commander of the drone cluster, the drone will automatically request the embedded services on each drone in the formation according to the commands parsed from the bytecode to complete the collaborative tasks of the drone cluster.
[0144] Since the most difficult process of obtaining the execution order of each service from the service composition relationship is completed by the embedded service composition engine, the execution process of the composite service is completed by the embedded service composition execution device, which meets the automation requirements of embedded service composition and helps the application of service composition technology in large-scale and complex scenarios. In addition, the embedded service composition execution device itself can realize hot updates of composite services through the network, meeting the adaptation to dynamic requirements.
[0145] It should be noted that, for the sake of simplicity, the embodiments of the above method are described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the present invention.
[0146] To sum up, the embedded service composition compilation method provided in the embodiment of the present invention compiles the service composition information of the embedded service into an embedded service composition file through the embedded service composition engine, and provides a unified standard for describing the embedded service composition method, so that the embedded service composition execution device can adapt to different embedded platforms. The fully optimized bytecode binary executable file can effectively improve the execution efficiency of the embedded composition service, facilitate the recording and storage of the combination information of the embedded service, and improve the convenience of the embedded service combination.
[0147] Based on the same inventive concept, Figure 2 An embedded service composition engine provided by an embodiment of the present invention is exemplarily shown. Since the principle of solving technical problems by the engine is similar to that of an embedded service composition compilation method, the specific implementation of the engine can refer to the specific implementation of the method, and the repeated parts will not be repeated.
[0148] Reference Figure 2 As shown, the engine mainly includes the following units:
[0149] The receiving unit 201 is used to receive service combination information of multiple different forms of embedded services and convert them into a unified format;
[0150] The compiling unit 202 is used to compile the service composition information to generate an embedded service composition file; the embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file and an embedded service composition bytecode binary executable file;
[0151] The deployment unit 203 is used to deploy the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of various embedded services.
[0152] It should be noted here that the above-mentioned receiving unit 201, compiling unit 202 and deployment unit 203 correspond to steps 101 to 103 in the above-mentioned method embodiment, and the three units and the corresponding steps implement the same instances and application scenarios, but are not limited to the contents disclosed in the above-mentioned method embodiment.
[0153] Preferably, the receiving unit 201 is specifically used for:
[0154] Receive service composition information of various embedded services through a graphical interface or a command line interface;
[0155] The service composition information is converted into a unified format, wherein the service composition information in the unified format includes a service composition relationship diagram, a service composition resource information structure, and a service composition description information structure.
[0156] Preferably, the compiling unit 202 is specifically used for:
[0157] Format the service composition description information structure into a string of S expressions and output it to a file to generate an embedded service composition description file;
[0158] Convert the service composition resource information structure into a string and output it to a file to generate an embedded service composition execution device configuration file;
[0159] A topological sorting algorithm is used to process the service composition relationship graph to generate an embedded service composition bytecode indicating how to execute the embedded composition service; and the embedded service composition bytecode is output to a file in a binary format to generate an embedded service composition bytecode binary executable file;
[0160] The embedded service composition description file, the embedded service composition execution device configuration file and the embedded service composition bytecode binary executable file are packaged to generate an embedded service composition file.
[0161] Preferably, the deployment unit 203 is specifically used for:
[0162] Enable the embedded service composition execution device to load and parse the embedded service composition description file to register the embedded composition service;
[0163] Enable the embedded service composition execution device to load the embedded service composition execution device configuration file to perform resource configuration of the embedded service composition execution device;
[0164] The embedded service combination execution device is made to load and execute the embedded service combination bytecode binary executable file, and the embedded service combination is formed by calling each embedded service to forward data, so as to realize the combination of embedded services.
[0165] Preferably, the suffix of the embedded service combination file is .esvcf, and its file header includes a four-byte magic number indicating the file type, a four-byte integer recording the offset of the embedded service combination description file and the four-byte integer recording the size of the part, a four-byte integer recording the offset of the embedded service combination execution device configuration file and the four-byte integer recording the size of the part, and a four-byte integer recording the offset of the embedded service combination bytecode binary executable file and the four-byte integer recording the size of the part.
[0166] It should be noted that the embedded service composition engine provided in the embodiment of the present invention and the embedded service composition compilation method described in the aforementioned embodiment belong to the same technical concept, and its specific implementation process can refer to the description of the method steps in the aforementioned embodiment, which will not be repeated here.
[0167] It should be understood that the units included in the above embedded service composition engine are only logical divisions based on the functions implemented by the engine. In actual applications, the above units can be superimposed or split. In addition, the functions implemented by the embedded service composition engine provided in this embodiment correspond one-to-one to the embedded service composition compilation method provided in the above embodiment. The more detailed processing flow implemented by the engine has been described in detail in the above method embodiment and will not be described in detail here.
[0168] To sum up, the embedded service composition engine provided by the embodiment of the present invention provides a unified standard for describing the embedded service composition method by compiling the service composition information of the embedded service into an embedded service composition file, so that the embedded service composition execution device can adapt to different embedded platforms. The fully optimized bytecode binary executable file can effectively improve the execution efficiency of the embedded composition service, facilitate the recording and storage of the combination information of the embedded service, and improve the convenience of the embedded service composition.
[0169] Based on the same inventive concept, Figure 3 An embedded service composition execution device provided by an embodiment of the present invention is exemplarily shown. Since the principle of solving the technical problem of the device is similar to that of an embedded service composition compilation method, the specific implementation of the device can refer to the specific implementation of the method, and the repeated parts will not be repeated.
[0170] Reference Figure 3As shown, an embodiment of the present invention provides an embedded service composition execution device, which mainly includes a processor 301 and a memory 302, wherein the memory 302 stores execution instructions. The processor 301 reads the execution instructions in the memory 302 to execute the steps described in any embodiment of the above-mentioned embedded service composition compilation method. Alternatively, the processor 301 reads the execution instructions in the memory 302 to implement the functions of each unit in any embodiment of the above-mentioned embedded service composition engine.
[0171] Figure 3 A schematic diagram of a structure of an embedded service combination execution device provided by an embodiment of the present invention, such as Figure 3 As shown, the device includes a processor 301 , a memory 302 and a transceiver 303 ; wherein the processor 301 , the memory 302 and the transceiver 303 communicate with each other via a bus 304 .
[0172] The bus 304 mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one arrow line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0173] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0174] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0175] To sum up, the embedded service composition execution device provided in the embodiment of the present invention compiles the service composition information of the embedded service into an embedded service composition file through the embedded service composition engine, and provides a unified standard for describing the embedded service composition method, so that the embedded service composition execution device can adapt to different embedded platforms. The fully optimized bytecode binary executable file can effectively improve the execution efficiency of the embedded composition service, facilitate the recording and storage of the combination information of the embedded service, and improve the convenience of the embedded service combination.
[0176] The embodiment of the present invention further provides a computer-readable storage medium, comprising computer-executable instructions, which are used to execute the steps described in the above embedded service composition compilation method embodiment. Alternatively, the computer-executable instructions are used to execute the functions of each unit in the above embedded service composition engine embodiment.
[0177] The computer storage medium of the embodiment of the present invention may adopt any combination of one or more computer-readable media. The computer-readable medium may be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable CD-ROM, an optical storage device, a magnetic storage device, or any suitable combination thereof. The computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, device or device.
[0178] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to: electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0179] The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, radio frequency (RF), etc., or any suitable combination of the above.
[0180] In addition, the computer program code for performing the operation of the present invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages, such as Java, Smalltalk, C++, and also conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as an independent software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (e.g., using an Internet service provider to connect through the Internet).
[0181] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0182] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for compiling an embedded service combination, characterized in that: include: The embedded service composition engine receives service composition information of various embedded services and converts it into a unified format; The embedded service composition engine compiles the service composition information to generate an embedded service composition file; The embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file and an embedded service composition bytecode binary executable file; the suffix of the embedded service composition file is .esvcf, and its file header includes a four-byte magic number indicating the file type, a four-byte integer recording the offset of the embedded service composition description file and the four-byte integer recording the size of the part, a four-byte integer recording the offset of the embedded service composition execution device configuration file and the four-byte integer recording the size of the part, and a four-byte integer recording the offset of the embedded service composition bytecode binary executable file and the four-byte integer recording the size of the part; The embedded service composition engine deploys the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of each embedded service.
2. The method according to claim 1, characterized in that The embedded service composition engine receives service composition information of embedded services in various forms, including: The embedded service composition engine receives service composition information of multiple different forms of embedded services through a graphical interface or a command line interface; The embedded service composition engine converts the service composition information into a unified format, wherein the service composition information in the unified format includes a service composition relationship diagram, a service composition resource information structure, and a service composition description information structure.
3. The method according to claim 2, characterized in that The embedded service composition engine compiles the service composition information to generate an embedded service composition file, including: The embedded service composition engine formats the service composition description information structure into a character string of an S expression and outputs it to a file to generate the embedded service composition description file; The embedded service composition engine converts the service composition resource information structure into a character string and outputs it to a file, thereby generating the embedded service composition execution device configuration file; The embedded service composition engine processes the service composition relationship graph using a topological sorting algorithm to generate an embedded service composition bytecode indicating how to execute the embedded composition service; and outputs the embedded service composition bytecode to a file in a binary format to generate a binary executable file of the embedded service composition bytecode; The embedded service composition engine packages the embedded service composition description file, the embedded service composition execution device configuration file and the embedded service composition bytecode binary executable file to generate the embedded service composition file.
4. The method according to claim 1, characterized in that The embedded service composition engine deploys the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of each of the embedded services, including: The embedded service composition engine enables the embedded service composition execution device to load and parse the embedded service composition description file to register the embedded composition service; The embedded service composition engine enables the embedded service composition execution device to load the embedded service composition execution device configuration file to perform resource configuration of the embedded service composition execution device; The embedded service composition engine enables the embedded service composition execution device to load and execute the embedded service composition bytecode binary executable file, and forms the embedded composition service by calling each of the embedded services to forward data, so as to realize the combination of the embedded services.
5. An embedded service composition engine, characterized in that: include: A receiving unit, used for receiving service combination information of various embedded services and converting it into a unified format; A compiling unit, used for compiling the service composition information to generate an embedded service composition file; the embedded service composition file includes an embedded service composition description file, an embedded service composition execution device configuration file and an embedded service composition bytecode binary executable file; the suffix of the embedded service composition file is .esvcf, and its file header includes a four-byte magic number indicating the file type, a four-byte integer recording the offset of the embedded service composition description file and the four-byte integer recording the size of the part, a four-byte integer recording the offset of the embedded service composition execution device configuration file and the four-byte integer recording the size of the part, and a four-byte integer recording the offset of the embedded service composition bytecode binary executable file and the four-byte integer recording the size of the part; The deployment unit is used to deploy the embedded service composition file to the embedded service composition execution device, so that the embedded service composition execution device loads and executes the embedded service composition file to form an embedded composition service to realize the combination of each embedded service.
6. The engine according to claim 5, characterized in that The receiving unit is specifically used for: Receive service composition information of various embedded services through a graphical interface or a command line interface; The service combination information is converted into a unified format, wherein the service combination information in a unified format includes a service combination relationship diagram, a service combination resource information structure, and a service combination description information structure.
7. The engine according to claim 6, characterized in that The compilation unit is specifically used for: Formatting the service composition description information structure into a character string of an S expression and outputting it to a file to generate the embedded service composition description file; Convert the service composition resource information structure into a character string and output it to a file to generate the embedded service composition execution device configuration file; Processing the service composition relationship graph using a topological sorting algorithm to generate an embedded service composition bytecode indicating how to execute the embedded composition service; and outputting the embedded service composition bytecode to a file in a binary format to generate a binary executable file of the embedded service composition bytecode; The embedded service composition description file, the embedded service composition execution device configuration file and the embedded service composition bytecode binary executable file are packaged to generate the embedded service composition file.
8. An embedded service combination execution device, characterized in that: The method comprises a processor and a memory, wherein the memory stores execution instructions, and the processor reads the execution instructions in the memory to execute the steps in the embedded service combination compilation method according to any one of claims 1 to 4.
9. A computer-readable storage medium, characterized in that: The storage medium stores computer-executable instructions, and the computer-executable instructions are used to execute the steps in the embedded service composition compiling method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Rule configuration and release method, system and equipment and storage medium
CN107632842A