Cloud function-based request processing method and apparatus, and computer readable medium
By introducing multiple action functions into cloud functions and utilizing the cloud controller to route requests, the problems of a large number and non-standardization of cloud functions are solved, achieving standardized and efficient unified processing of cloud functions, reducing call latency and improving maintainability.
Patent Information
- Application Number
- CN202010751036.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-07-30
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2040-12-12
AI Technical Summary
In the existing cloud function architecture, the number of cloud functions is large and not standardized, resulting in resource waste and increased call latency, as well as difficulties in development and maintenance, and an inability to achieve unified processing of similar requests.
The writing of cloud functions is standardized by using multiple action functions. The cloud controller routes requests to the target action function based on the action parameters, handles similar requests uniformly, and limits the number of action functions to avoid verbose code.
It achieves standardization and a unified style for cloud functions, reduces resource waste, lowers call latency, and improves maintainability and request processing efficiency.
Smart Images

Figure CN111970338B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of computer and communication technology, and more specifically, to a request processing method, apparatus, and computer-readable medium based on cloud functions. Background Technology
[0002] Currently, there is a serverless cloud architecture in the field of cloud computing technology. This architecture enables users to call functions in the cloud, namely cloud functions. Cloud functions are code that runs in the cloud (i.e., cloud servers). They do not require server management. They are written in developer tools, uploaded and deployed to the cloud, and then run on the cloud server.
[0003] Traditionally, a user's request corresponds to a cloud function. However, this request processing method has many drawbacks. Summary of the Invention
[0004] The embodiments of this application provide a request processing method, apparatus and computer-readable medium based on cloud functions, which can at least to some extent make the writing of cloud functions more standardized and normalized, thereby making them more maintainable and reducing the granularity of cloud functions.
[0005] Other features and advantages of this application will become apparent from the following detailed description, or may be learned in part from practice of this application.
[0006] According to one aspect of the embodiments of this application, a request processing method based on cloud functions is provided, wherein the cloud function includes multiple action functions, each of which is used to process different action parameters. The method includes: receiving a request message sent by a calling end through calling a specified cloud function, the request message including action parameters; determining a target action function from the multiple action functions included in the specified cloud function according to the action parameters included in the request message; routing the request message to the target action function and receiving a processing result returned by the target action function in response to the request message; and sending the processing result to the specified cloud function so that the specified cloud function forwards the processing result to the calling end.
[0007] According to one aspect of the embodiments of this application, a request processing method based on cloud functions is provided, wherein the cloud functions include multiple action functions, each of which is used to process different action parameters. The method includes: receiving a call from a calling end and sending a request message from the calling end to a cloud controller, the request message being used to enable the cloud controller to determine a target action function based on the action parameters contained in the request message, the target action function being used to process the request message; receiving a processing result returned by the target action function sent by the cloud controller and sending the processing result to the calling end.
[0008] According to one aspect of the embodiments of this application, a request processing apparatus based on cloud functions is provided, wherein the cloud functions include multiple action functions, each of which is used to process different action parameters. The apparatus includes: a first receiving unit configured to receive a request message sent by a calling end by calling a specified cloud function, the request message including action parameters; a determining unit configured to determine a target action function from the multiple action functions included in the specified cloud function based on the action parameters included in the request message; a routing unit configured to route the request message to the target action function and receive a processing result returned by the target action function in response to the request message; and a first sending unit configured to send the processing result to the specified cloud function, so that the specified cloud function forwards the processing result to the calling end.
[0009] In some embodiments of this application, based on the foregoing scheme, the determining unit is further configured to: obtain an action function matching the action function identifier from a plurality of action functions contained in the specified cloud function according to the action function identifier contained in the action parameters; if the obtained action function is a function that the calling end can call, then the obtained action function is used as the target action function.
[0010] In some embodiments of this application, based on the foregoing scheme, the determining unit is further configured to: detect the identification information of the acquired action function; determine the calling permission of the action function according to whether the identification information contains a specified character, wherein the calling permission is used to indicate the calling end type that can call the action function.
[0011] In some embodiments of this application, based on the foregoing scheme, the determining unit is further configured to: if the obtained action function is a function that the calling end cannot call, then return an uncallable message to the calling end through the specified cloud function.
[0012] In some embodiments of this application, based on the foregoing scheme, the number of multiple action functions included in the specified cloud function does not exceed a preset threshold.
[0013] According to one aspect of the embodiments of this application, a request processing apparatus based on cloud functions is provided, wherein the cloud functions include multiple action functions, each of which is used to process different action parameters. The apparatus includes: a second receiving unit configured to receive a call from a calling end and send a request message from the calling end to a cloud controller, the request message being used to enable the cloud controller to determine a target action function based on the action parameters contained in the request message, the target action function being used to process the request message; and a second sending unit configured to receive a processing result returned by the target action function sent by the cloud controller and send the processing result to the calling end.
[0014] In some embodiments of this application, based on the foregoing scheme, the second receiving unit is further configured to receive the call from the calling end and send the request message containing the return parameter format from the calling end to the cloud controller; the second sending unit is further configured to receive the processing result returned by the target action function according to the return parameter format sent by the cloud controller.
[0015] According to one aspect of the embodiments of this application, a computer-readable medium is provided having a computer program stored thereon, which, when executed by a processor, implements the cloud function-based request processing method as described in the above embodiments.
[0016] In some embodiments of this application, after receiving a request message sent by the calling client through a specified cloud function, a target action function is determined from multiple action functions contained in the specified cloud function based on the action parameters included in the request message. The request message is then routed to the target action function. The processing result returned by the target action function in response to the request message is received and sent back to the specified cloud function, so that the specified cloud function forwards the processing result to the calling client. Since the cloud function in this application contains multiple action functions, each handling different action parameters, the writing style of the cloud function can be standardized through action functions. This avoids the problem of inconsistent internal writing styles within the cloud function, making the style of the cloud function more unified and maintainable. Furthermore, using multiple action functions to respond to different requests and routing similar requests to a single cloud function avoids the problem of excessively fine-grained cloud function calls leading to significant latency.
[0017] It should be understood that the above general description and the following detailed description are exemplary and explanatory only, and do not limit this application. Attached Figure Description
[0018] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort. In the drawings:
[0019] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown;
[0020] Figure 2 A flowchart of a cloud function-based request processing method according to an embodiment of this application is shown;
[0021] Figure 3 A flowchart of a cloud function-based request processing method according to an embodiment of this application is shown;
[0022] Figure 4 A flowchart of a cloud function-based request processing method according to an embodiment of this application is shown;
[0023] Figure 5 A flowchart of a cloud function-based request processing method according to an embodiment of this application is shown;
[0024] Figure 6 A flowchart of a cloud function-based request processing method according to an embodiment of this application is shown;
[0025] Figures 7A-7D A logic diagram of a cloud function-based request processing method according to an embodiment of this application is shown;
[0026] Figure 8 A block diagram of a cloud function-based request processing apparatus according to an embodiment of this application is shown;
[0027] Figure 9 A block diagram of a cloud function-based request processing apparatus according to an embodiment of this application is shown;
[0028] Figure 10 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown. Detailed Implementation
[0029] Exemplary embodiments will now be described more fully with reference to the accompanying drawings. However, these exemplary embodiments can be implemented in many forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided to make this application more comprehensive and complete, and to fully convey the concept of the exemplary embodiments to those skilled in the art.
[0030] Furthermore, the described features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. Numerous specific details are provided in the following description to give a thorough understanding of embodiments of this application. However, those skilled in the art will recognize that the technical solutions of this application can be practiced without one or more of the specific details, or other methods, components, apparatuses, steps, etc., can be employed. In other instances, well-known methods, apparatuses, implementations, or operations are not shown or described in detail to avoid obscuring various aspects of this application.
[0031] It should be noted that the terminology used in the specification, claims, and accompanying drawings of this application is for describing embodiments only and is not intended to limit the scope of this application. It should be understood that the terms "comprising," "including," "having," etc., as used herein, specify the presence of the stated features, integrals, steps, operations, elements, components, and / or groups thereof, but do not preclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof.
[0032] It will be further understood that although the terms “first,” “second,” “third,” etc., may be used herein to describe various elements, these elements should not be limited by these terms. These terms are used only to distinguish one element from another. For example, a first element may be referred to as a second element without departing from the scope of the invention. Similarly, a second element may be referred to as a first element. As used herein, the term “and / or” includes any and all combinations of one or more of the associated listed items.
[0033] The block diagrams shown in the accompanying drawings are merely functional entities and do not necessarily correspond to physically independent entities. That is, these functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are merely illustrative and do not necessarily include all content and operations / steps, nor do they necessarily have to be performed in the described order. For example, some operations / steps can be broken down, while others can be combined or partially combined; therefore, the actual execution order may change depending on the specific circumstances.
[0035] It should be understood that in this application, "at least one" means one or more, and "more" means two or more.
[0036] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.
[0037] Cloud technology is a collective term for network technologies, information technologies, integration technologies, management platform technologies, and application technologies based on cloud computing business models. It can form resource pools, providing flexible and convenient on-demand access. Cloud computing technology will become a crucial support. Backend services of technical network systems require substantial computing and storage resources, such as video websites, image websites, and many portal websites. With the rapid development and application of the internet industry, every item may have its own identification mark in the future, requiring transmission to backend systems for logical processing. Data at different levels will be processed separately, and various industry data will all require robust system support, which can only be achieved through cloud computing.
[0038] Cloud computing is a computing model that distributes computing tasks across a resource pool consisting of a large number of computers, enabling various application systems to access computing power, storage space, and information services as needed. The network providing these resources is called the "cloud." From the user's perspective, resources in the "cloud" appear infinitely scalable, readily available, on-demand, and expandable, with payment based on usage.
[0039] As a provider of fundamental cloud computing capabilities, a cloud resource pool (referred to as a cloud platform, generally called an IaaS (Infrastructure as a Service) platform) is established. Various types of virtual resources are deployed in the resource pool for external customers to choose from. The cloud resource pool mainly includes: computing devices (virtualized machines containing operating systems), storage devices, and network devices.
[0040] Based on logical function, a PaaS (Platform as a Service) layer can be deployed on top of the IaaS (Infrastructure as a Service) layer, and a SaaS (Software as a Service) layer can be deployed on top of the PaaS layer. Alternatively, SaaS can be deployed directly on top of IaaS. PaaS is a platform for running software, such as databases and web containers. SaaS refers to various types of business software, such as web portals and bulk SMS senders. Generally speaking, SaaS and PaaS are upper layers compared to IaaS.
[0041] Cloud functions are code that runs in the cloud (i.e., on cloud servers). They require no server management, are written in developer tools, uploaded, and deployed to the cloud to run on the cloud server. Physically, a cloud function can consist of multiple files and consumes a certain amount of computing resources such as CPU and memory. Each cloud function is completely independent and can be deployed in different regions. Cloud functions can be called from client-side applications, and they can also call each other.
[0042] Action function: The code branch that implements different requests in the cloud function. A request will eventually be scheduled to an action function.
[0043] Action parameter: An action parameter must be passed when calling each cloud function. The action parameter determines which code branch the request will be scheduled to.
[0044] Cloud Controller: Shared code across all cloud functions. The cloud controller routes requests to the corresponding action functions based on action parameters.
[0045] Currently, the primary method for request processing based on cloud functions is one cloud function per request. However, this approach leads to a massive number of cloud functions, resulting in the recycling of many infrequently used cloud function resources, increasing the likelihood of cold starts, and increasing latency for live services. Furthermore, the lack of standardized coding practices among developers makes function code maintenance extremely difficult. The coarse-grained nature of cloud functions is uncontrollable, and without unified processing of underlying logic, such as unified request count collection, it's impossible to route a type of request to a single cloud function for processing. Moreover, some cloud functions only allow scheduling between cloud functions and not access from the client side; the one-to-one-request approach exposes cloud functions that shouldn't be exposed to the client side.
[0046] To address this issue, this application provides a request processing method based on cloud functions. First, a request message sent by a calling client through a specified cloud function is received. This request message contains action parameters. Then, based on the action parameters in the request message, a target action function is determined from multiple action functions included in the specified cloud function. Next, the request message is routed to the target action function, and the processing result returned by the target action function in response to the request message is received. Finally, the processing result is sent back to the specified cloud function, enabling the specified cloud function to forward the processing result to the calling client. This cloud function-based request processing method, proposed in this application, standardizes the writing of cloud functions through action function standardization, avoiding the problem of inconsistent internal cloud function writing. This makes the style of cloud functions more unified and maintainable. Furthermore, by using multiple action functions to respond to different requests and routing similar requests to a single cloud function for processing, it avoids the problem of excessively fine-grained cloud function calls leading to significant latency.
[0047] Figure 1 A schematic diagram of an exemplary system architecture to which the technical solutions of the embodiments of this application can be applied is shown.
[0048] like Figure 1 As shown, the system architecture 100 may include a caller 101, a cloud function 102, an action function 103, and a cloud controller 104.
[0049] The calling end 101 can be any electronic device with a display screen, including but not limited to desktop computers, laptops, smartphones, tablets, and cameras. Multiple application (APP) clients can be installed on the electronic device, and users can initiate requests through different clients to obtain the corresponding request data.
[0050] Cloud function 102 is code that runs in the cloud (i.e., on a cloud server). Calling client 101 can send a call request for cloud function 102 to the cloud via the network according to a standardized protocol, thereby calling and executing the code of cloud function 102. The network is a medium used to provide a communication link between calling client 101 and the cloud, and can include various connection types, such as wired communication links, wireless communication links, or fiber optic cables, etc.
[0051] The cloud function 102 may contain multiple action functions 103, which are used to process different request messages from the caller 101. The cloud controller 104 is used to route the different request messages from the caller 101 to different action functions 103.
[0052] It should be understood that Figure 1 The number of call terminals 101, cloud functions 102, action functions 103, and cloud controllers 104 shown in the diagram is merely illustrative. Depending on implementation needs, there can be any number of call terminals 101, cloud functions 102, action functions 103, and cloud controllers 104.
[0053] In one embodiment of this application, after receiving a request message containing action parameters sent by the calling terminal 101 to the cloud function 102, the cloud controller 104 can determine the target action function from the multiple action functions 103 contained in the cloud function 102 according to the action parameters contained in the request message. Then, the request message is routed to the target action function, and the processing result returned by the target action function in response to the request message is received. Finally, the cloud controller 104 can send the processing result to the cloud function 102 so that the cloud function 102 forwards the processing result to the calling terminal 101.
[0054] In one embodiment of this application, the cloud controller 104 can obtain an action function 103 matching the action function identifier from a plurality of action functions 103 included in the cloud function 102, based on the action function identifier contained in the action parameters. Schematic, the action function identifier includes the action function name. Of course, in other embodiments, the action function identifier may also include the action function name and an additional marker. The additional marker is an auxiliary marker added to the action function. It is understood that the additional marker may include at least one of an action function identity marker and an action function location marker. The action function identity marker is used to highlight the identity of the action function. The action function location marker indicates the location where the action function was created.
[0055] In one embodiment of this application, if the action function 103 obtained by the cloud controller 104 that matches the action function identifier is a function that the calling terminal 101 can call, then the cloud controller 104 can use the obtained action function 103 that matches the action function identifier as the target action function.
[0056] The implementation details of the technical solutions in the embodiments of this application are described in detail below:
[0057] Figure 2 A flowchart illustrating a cloud function-based request processing method according to an embodiment of this application is shown. This cloud function-based request processing method can be executed by a cloud controller, which may be... Figure 1 The cloud controller 104 shown is illustrated. In this embodiment, the cloud function includes multiple action functions, each used to process different action parameters, as shown in the reference. Figure 2 As shown, the request processing methods based on cloud functions include:
[0058] Step S210: Receive a request message sent by the calling end through calling a specified cloud function, wherein the request message contains action parameters;
[0059] Step S220: Determine the target action function from the multiple action functions contained in the specified cloud function based on the action parameters contained in the request message;
[0060] Step S230: Route the request message to the target action function and receive the processing result returned by the target action function for the request message;
[0061] Step S240: Send the processing result to the designated cloud function so that the designated cloud function forwards the processing result to the calling end.
[0062] These steps are described in detail below.
[0063] In step S210, a request message sent by the calling end through calling a specified cloud function is received, and the request message contains action parameters.
[0064] In this embodiment, the cloud controller can receive request messages via wired or wireless connection. Request messages are used to request a specified cloud function to provide a corresponding response. For example, during registration, a request message is used to request a specified cloud function to return the registration result; when querying user information, a request message is used to request a specified cloud function to return the user information.
[0065] The request message contains action parameters, which are parameters that the caller must upload when calling the specified cloud function. These parameters enable the cloud controller to determine the action function to process the request message from among the multiple action functions contained in the specified cloud function.
[0066] It should also be noted that the calling end is the side that calls the cloud function. In some embodiments, the calling end can be a terminal, which can be various electronic devices, including but not limited to desktop computers, laptops, smartphones, tablets, and cameras. The terminal can have multiple application (APP) clients installed, and users can trigger calls to the cloud function through different clients. In other embodiments, since cloud functions can also call each other, the calling end can also include the cloud function.
[0067] In step S220, the target action function is determined from the multiple action functions contained in the specified cloud function based on the action parameters contained in the request message.
[0068] Traditional cloud function-based request processing typically involves one cloud function per request, with the cloud function responding to the request. Unlike traditional methods, in this embodiment, a specified cloud function can contain multiple action functions. The cloud controller can determine the target action function from among the multiple action functions contained in the specified cloud function and process the request message from the calling end through the target action function.
[0069] In one embodiment, the target action function can be determined based on the action parameters contained in the request message by defining the action parameters by the name of the action function. For example, the action parameter is: {act: action function name}. After obtaining the action parameters, the target action function with the same name as the action function in the action parameters can be determined from the multiple action functions contained in the specified cloud function based on the action function name in the action parameters.
[0070] In step S230, the request message is routed to the target action function, and the processing result returned by the target action function in response to the request message is received.
[0071] After determining the target action function, the cloud controller can directly distribute the request message to the target action function so that the target action function can respond to the received request message and then return the processing result to the cloud controller.
[0072] In step S240, after receiving the processing result, the cloud controller can send the processing result to the specified cloud function so that the specified cloud function forwards the processing result to the calling end.
[0073] Based on the technical solutions of the above embodiments, by including multiple action functions in the cloud function and standardizing the writing style of the cloud function through action functions, the problem of non-standard writing style within the cloud function is avoided, making the style of the cloud function more unified and more maintainable. At the same time, by using multiple action functions to respond to different requests and routing similar requests to a cloud function for processing, compared with the traditional method of one request corresponding to one cloud function, the technical solution of this application embodiment avoids the problem of large cloud function call delays caused by excessively fine-grained cloud functions.
[0074] In one embodiment of this application, determining the target action function based on the action parameters contained in the request message can be done by determining it based on the action function identifier contained in the action parameters. In this embodiment, for example... Figure 3 As shown, step S220 can specifically include steps S2201-S2202, which are described in detail below:
[0075] Step S2201: Based on the action function identifier contained in the action parameters, obtain the action function that matches the action function identifier from the multiple action functions contained in the specified cloud function.
[0076] Specifically, the action parameters include an action function identifier. After receiving a request message containing action parameters, the cloud controller can further select the action function that matches the action function identifier from among the multiple action functions contained in the specified cloud function, based on the action function identifier contained in the action parameters.
[0077] In some embodiments, the action function identifier includes the action function name. In other embodiments, the action function identifier may also include the action function name and additional tags. Additional tags are supplementary tags added to the action function. It is understood that additional tags may include at least one of an action function identity tag and an action function location tag. The action function identity tag is used to highlight the identity of the action function. The action function location tag indicates the location where the action function was created.
[0078] Step S2202: If the obtained action function is a function that the calling end can call, then the obtained action function is used as the target action function.
[0079] In this embodiment, the obtained action function can only be used as the target action function if it can be invoked by the calling end, so as to process the request message of the calling end using the target action function.
[0080] Conversely, if the obtained action function is not a function that the caller can call, it means that the obtained action function is not the target action function and cannot be used to process the caller's request message. In one embodiment, when the obtained action function is not a function that the caller can call, an uncallable message can be returned to the caller. In this embodiment, the method further includes:
[0081] If the obtained action function is a function that the calling end cannot call, then an uncallable message is returned to the calling end through the specified cloud function.
[0082] Through the above technical solution, after the cloud controller obtains the action function based on the action parameters, it further determines whether the obtained action function can be called. Only if it can be called by the caller will the obtained action function be used as the target action function to process the caller's request message. The advantage of this is that it ensures the code security of the action function, prevents action functions that should not be exposed to the caller from being exposed, and enhances the privacy of the action function.
[0083] In one embodiment of this application, the calling permission of an action function can be determined based on the identifier information of the action function. In this embodiment, for example... Figure 4 As shown, the method further includes steps S410-S420, which are described in detail below:
[0084] Step S410: Detect the identification information of the obtained action function.
[0085] To determine whether an action function can be invoked by the caller, the cloud controller can detect the identification information of the action function. The identification information can be any identifier character that has an identifying function, such as underscores, tildes, asterisks, etc.
[0086] Step S420: Determine the calling permission of the action function based on whether the identification information contains a specified character. The calling permission is used to indicate the calling terminal type that can call the action function.
[0087] After the identification information is detected, the calling permission of the action function can be determined based on whether the identification information contains a specified character. The calling permission is used to indicate the calling end type that can call the action function. The calling end type can include, but is not limited to, terminals, cloud functions, etc.
[0088] Specifically, determining the calling permission of an action function based on whether the identification information contains a specified character can be as follows: if the identification information contains the specified character, the calling client type is determined to be a terminal; otherwise, if the identification information does not contain the specified character, the calling client type is determined to be a cloud function. Alternatively, it can also be that if the identification information contains the specified character, the calling client type is determined to be a cloud function; otherwise, if the identification information does not contain the specified character, the calling client type is determined to be a terminal.
[0089] To ensure the normal operation of cloud functions, based on any embodiment, the number of multiple action functions included in a specified cloud function shall not exceed a preset threshold.
[0090] Understandably, if a specified cloud function contains too many action functions, it will inevitably lead to verbose cloud function code, increased execution difficulty, and a higher risk of failure. Therefore, it is possible to set the number of multiple action functions contained in a specified cloud function to not exceed a preset threshold. The preset threshold can be set according to the actual situation, such as the development difficulty of the cloud function and the request load.
[0091] In this embodiment, if the number of multiple action functions contained in the specified cloud function exceeds a preset threshold, the cloud controller can directly return an error message to the caller after receiving the request message sent by the caller through calling the specified cloud function.
[0092] Figure 5 A flowchart illustrating a cloud function-based request processing method according to an embodiment of this application is shown. This cloud function-based request processing method can be executed by a cloud function in the cloud. The cloud function can be... Figure 1 The cloud function 102 is shown in the image. (Refer to...) Figure 5 As shown, the request processing methods based on cloud functions include:
[0093] Step S510: Receive the call from the calling end and send the request message from the calling end to the cloud controller. The request message is used to enable the cloud controller to determine the target action function based on the action parameters contained in the request message. The target action function is used to process the request message.
[0094] Step S520: Receive the processing result returned by the target action function sent by the cloud controller, and send the processing result to the calling end.
[0095] These steps are described in detail below.
[0096] In step S510, the call from the calling end is received, and the request message from the calling end is sent to the cloud controller. The request message is used to enable the cloud controller to determine the target action function based on the action parameters contained in the request message. The target action function is used to process the request message.
[0097] In this embodiment, after receiving the call from the client via the network, the cloud function can send the client's request message to the cloud controller. The cloud controller then determines the target action function from among multiple action functions contained in the cloud function based on the action parameters included in the request message. The target action function can then be used to process the client's request message.
[0098] In step S520, the processing result returned by the target action function sent by the cloud controller is received, and the processing result is sent to the calling terminal.
[0099] After the target action function processes the request message, it can return the processing result to the cloud controller. After receiving the processing result, the cloud controller forwards the processing result to the cloud function. Finally, the cloud function sends the processing result to the calling end.
[0100] In one embodiment of this application, in order for the target action function to return a processing result according to the agreed format, the calling end can include a return parameter format in the sent request message. This return parameter format is used to instruct the target action function to return a processing result according to the return parameter format. In this embodiment, for example... Figure 6 As shown, this can specifically include steps S610-S620, which are described in detail below:
[0101] Step S610: Receive the call from the calling end and send the request message containing the return parameter format from the calling end to the cloud controller.
[0102] It is worth noting that in this embodiment, the cloud function receives a request message from the calling end via the network, which includes a return parameter format. The return parameter format is used to define the data format of the processing result returned by the target action function. For example, the data format returned by the target action function can be JSON (JavaScript Object Notation). JSON has a concise and clear hierarchical structure, is easy for humans to read and write, and is also easy for machines to parse and generate, which can effectively improve network transmission efficiency.
[0103] Step S620: Receive the processing result returned by the target action function sent by the cloud controller according to the return parameter format.
[0104] After the cloud function sends a request message containing the return parameter format to the cloud controller through step S610, the cloud controller forwards the request message to the target action function. After processing the request message, the target action function returns the processing result to the cloud controller according to the return parameter format, so that the cloud function can receive the processing result returned by the target action function according to the return parameter format sent by the cloud controller.
[0105] Figures 7A-7D A logic diagram of a cloud function-based request processing method according to an embodiment of this application is shown.
[0106] like Figure 7A As shown, in one embodiment of this application, for a specified cloud function, the cloud controller can determine whether the number of multiple action functions contained in the specified cloud function exceeds a preset threshold. If not, the cloud controller can obtain an action function from the multiple action functions contained in the specified cloud function according to the action parameters contained in the request message. If the obtained action function is a function that the caller can call, the obtained action function is used as the target action function. If the obtained action function is a function that the caller cannot call, an uncallable message is returned to the caller. Specifically, the following steps are included:
[0107] Step S11: Determine whether the number of multiple action functions contained in the specified cloud function exceeds a preset threshold. If not, proceed to step S12; otherwise, return an error message to the caller.
[0108] Step S12: Obtain the action function from the multiple action functions contained in the specified cloud function.
[0109] like Figure 7B As shown, in one embodiment of this application, the cloud controller obtains an action function from multiple action functions contained in a specified cloud function based on the action parameters contained in the request message. If the obtained action function is a function that the caller cannot call, an uncallable message is returned to the caller. If the obtained action function is a function that the caller can call, the cloud controller can further determine whether the number of multiple action functions contained in the specified cloud function exceeds a preset threshold. If not, the obtained action function is used as the target action function. Specifically, this includes the following steps:
[0110] Step S21: Determine whether the number of multiple action functions contained in the specified cloud function exceeds a preset threshold. If not, proceed to step S22; otherwise, return an error message to the caller.
[0111] Step S22: Use the obtained action function as the target action function.
[0112] like Figure 7CAs shown in one embodiment of this application, for an action function obtained by the cloud controller from multiple action functions contained in a specified cloud function, if the obtained action function contains a specified character, it can be determined that the obtained action function is a function that the calling end can call, i.e., the target action function. The specific steps include:
[0113] Step S31: Determine if the obtained action function contains the specified character. If so, proceed to step S32; otherwise, return an uncallable message to the calling end.
[0114] Step S32: Use the obtained action function as the target action function.
[0115] like Figure 7D As shown in one embodiment of this application, for an action function obtained by the cloud controller from multiple action functions contained in a specified cloud function, if the obtained action function does not contain the specified character, it can be determined that the obtained action function is a function that the calling end can call, i.e., the target action function. Specifically, the following steps are included:
[0116] Step S41: Determine if the obtained action function contains the specified character. If not, proceed to step S42; otherwise, return an uncallable message to the calling end.
[0117] Step S42: Use the obtained action function as the target action function.
[0118] The following describes an apparatus embodiment of this application, which can be used to execute the image processing method described above in this application. For details not disclosed in the apparatus embodiments of this application, please refer to the embodiments of the image processing method described above in this application.
[0119] Figure 8 A block diagram of a cloud function-based request processing apparatus according to an embodiment of this application is shown, with reference to... Figure 8 As shown, a cloud function-based request processing apparatus 800 according to an embodiment of this application includes: a first receiving unit 802, a determining unit 804, a routing unit 806, and a first sending unit 808.
[0120] The system includes a first receiving unit 802 configured to receive a request message sent by a calling client through a call to a specified cloud function, the request message containing action parameters; a determining unit 804 configured to determine a target action function from multiple action functions included in the specified cloud function based on the action parameters contained in the request message; a routing unit 806 configured to route the request message to the target action function and receive the processing result returned by the target action function in response to the request message; and a first sending unit 808 configured to send the processing result to the specified cloud function so that the specified cloud function forwards the processing result to the calling client.
[0121] In some embodiments of this application, the determining unit 804 is further configured to: detect the identification information of the acquired action function; determine the calling permission of the action function based on whether the identification information contains a specified character, wherein the calling permission is used to indicate the calling end type that can call the action function.
[0122] In some embodiments of this application, the determining unit 804 is further configured to: if the obtained action function is a function that the calling end cannot call, then return an uncallable message to the calling end through the specified cloud function.
[0123] In some embodiments of this application, the number of multiple action functions included in the specified cloud function does not exceed a preset threshold.
[0124] Figure 9 A block diagram of a cloud function-based request processing apparatus according to an embodiment of this application is shown.
[0125] See Figure 9 As shown, a cloud function-based request processing apparatus 900 according to an embodiment of this application includes: a second receiving unit 902 and a second sending unit 904.
[0126] The second receiving unit 902 is configured to receive a call from the calling end and send the request message from the calling end to the cloud controller. The request message is used to enable the cloud controller to determine a target action function based on the action parameters contained in the request message. The target action function is used to process the request message. The second sending unit 904 is configured to receive the processing result returned by the target action function sent by the cloud controller and send the processing result to the calling end.
[0127] In some embodiments of this application, the second receiving unit 902 is further configured to receive the call from the calling end and send the request message containing the return parameter format from the calling end to the cloud controller; the second sending unit 904 is further configured to receive the processing result returned by the target action function according to the return parameter format sent by the cloud controller.
[0128] Figure 10 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the present application is shown.
[0129] It should be noted that, Figure 10 The computer system 1000 of the electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0130] like Figure 10 As shown, the computer system 1000 includes a Central Processing Unit (CPU) 1001, which can perform various appropriate actions and processes based on programs stored in Read-Only Memory (ROM) 1002 or programs loaded from storage portion 1008 into Random Access Memory (RAM) 1003, such as performing the methods described in the above embodiments. Various programs and data required for system operation are also stored in RAM 1003. The CPU 1001, ROM 1002, and RAM 1003 are interconnected via bus 1004. An Input / Output (I / O) interface 1005 is also connected to bus 1004.
[0131] The following components are connected to I / O interface 1005: an input section 1006 including a keyboard, mouse, etc.; an output section 1007 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to I / O interface 1005 as needed. Removable media 1011, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., are installed on drive 1010 as needed so that computer programs read from them can be installed into storage section 1008 as needed.
[0132] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via communication section 1009, and / or installed from removable medium 1011. When the computer program is executed by central processing unit (CPU) 1001, it performs various functions defined in the system of this application.
[0133] It should be noted that the computer-readable medium shown in the embodiments of this application can be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this application, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this application, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. The transmitted data signal can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. The computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.
[0134] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. Each block in a flowchart or block diagram may represent a module, segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in a block diagram or flowchart, and combinations of blocks in a block diagram or flowchart, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0135] The units described in the embodiments of this application can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.
[0136] In another aspect, this application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiments; or it may exist independently and not assembled into the electronic device. The computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods described in the above embodiments.
[0137] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to the embodiments of this application, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0138] Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein can be implemented by software or by combining software with necessary hardware. Therefore, the technical solutions according to the embodiments of this application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (such as a CD-ROM, USB flash drive, external hard drive, etc.) or on a network, including several instructions to cause a computing device (such as a personal computer, server, touch terminal, or network device, etc.) to execute the method according to the embodiments of this application.
[0139] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the embodiments disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein.
[0140] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A request processing method based on cloud functions, characterized in that, The cloud function contains multiple action functions, which are used to handle different logical requests of the same type of business. The method includes: Receive a request message sent by the calling client through calling a specified cloud function, wherein the request message contains action parameters; Based on the action function identifier contained in the action parameters, obtain the action function that matches the action function identifier from the multiple action functions contained in the specified cloud function; If the obtained action function is a function that the calling end can call, then the obtained action function will be used as the target action function; The request message is routed to the target action function, and the processing result returned by the target action function in response to the request message is received. The processing result is sent to the designated cloud function so that the designated cloud function forwards the processing result to the calling end.
2. The method according to claim 1, characterized in that, The method further includes: The identification information of the obtained action functions is detected; The calling permission of the action function is determined based on whether the identification information contains a specified character. The calling permission is used to indicate the calling end type that can call the action function.
3. The method according to claim 1, characterized in that, The method further includes: If the obtained action function is a function that the calling end cannot call, then an uncallable message is returned to the calling end through the specified cloud function.
4. The method according to any one of claims 1 to 3, characterized in that, The number of action functions included in the specified cloud function does not exceed a preset threshold.
5. A request processing method based on cloud functions, characterized in that, The cloud function contains multiple action functions, which are used to handle different logical requests of the same type of business. The method includes: The system receives a call from the client and sends the request message from the client to the cloud controller. The request message enables the cloud controller to obtain an action function that matches the action function identifier from a plurality of action functions contained in the cloud function, based on the action function identifier contained in the action parameters in the request message. If the obtained action function is a function that the client can call, the obtained action function is used as the target action function, and the target action function is used to process the request message. The system receives the processing result returned by the target action function sent by the cloud controller and sends the processing result to the calling end.
6. The method according to claim 5, characterized in that, The step of receiving the call from the calling client and sending the request message from the calling client to the cloud controller includes: Receive the call from the calling client and send the request message containing the return parameter format from the calling client to the cloud controller; The processing result returned by the target action function sent by the cloud controller includes: The processing result returned by the target action function sent by the cloud controller according to the specified return parameter format is received.
7. A request processing device based on cloud functions, characterized in that, The cloud function contains multiple action functions, which are used to handle different logical requests of the same type of business. The device includes: The first receiving unit is configured to receive a request message sent by the calling end through calling a specified cloud function, wherein the request message contains action parameters; The determining unit is configured to, based on the action function identifier contained in the action parameters, obtain an action function that matches the action function identifier from a plurality of action functions contained in the specified cloud function; if the obtained action function is a function that the calling end can call, then the obtained action function is taken as the target action function; The routing unit is configured to route the request message to the target action function and receive the processing result returned by the target action function for the request message; The first sending unit is configured to send the processing result to the designated cloud function, so that the designated cloud function forwards the processing result to the calling end.
8. A request processing device based on cloud functions, characterized in that, The cloud function contains multiple action functions, which are used to handle different logical requests of the same type of business. The device includes: The second receiving unit is configured to receive a call from the calling end and send the request message from the calling end to the cloud controller. The request message is used to enable the cloud controller to obtain an action function that matches the action function identifier from a plurality of action functions contained in the cloud function according to the action function identifier contained in the action parameters in the request message. If the obtained action function is a function that the calling end can call, the obtained action function is used as the target action function, and the target action function is used to process the request message. The second sending unit is configured to receive the processing result returned by the target action function sent by the cloud controller, and send the processing result to the calling end.
9. A computer-readable medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the cloud function-based request processing method as described in any one of claims 1 to 4, or implements the cloud function-based request processing method as described in any one of claims 5 to 6.
10. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the cloud function-based request processing method as described in any one of claims 1 to 4, or the cloud function-based request processing method as described in any one of claims 5 to 6.
Citation Information
Patent Citations
Function-as-a-service (FAAS) platform in blockchain networks
CN110622192A
Unstructured data operating method and system based on block chain
CN111460436A