Compiling method and device, electronic equipment, storage medium and program product
By introducing message cache and subscription units into the cloud server, the asynchronous message loss caused by compilation task allocation on the cloud platform is solved, and the security and reliability of the compilation process are improved, ensuring that the terminal can obtain all compilation feedback information in a timely manner.
Patent Information
- Application Number
- CN202410030960.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-01-05
- Publication Date
- 2025-07-08
AI Technical Summary
On the cloud platform, when users deploy applications through online IDEs, the compilation tasks may be randomly assigned to multiple cloud computing units, resulting in the loss of asynchronous messages and affecting the security and reliability of the compilation process.
By introducing a message cache unit and a message subscription unit in the cloud server, asynchronous compilation feedback messages generated by different editing cloud computing units are passed, ensuring that the terminal can obtain all compilation feedback messages, including cached through the message cache unit and obtaining messages in sequence, and receiving compilation feedback messages in real time through the message subscription unit.
It effectively avoids the loss of asynchronous messages, improves the security and reliability of the compilation process, ensures that the terminal can obtain all compilation feedback information in a timely manner, and supports efficient deployment of target applications on the cloud platform.
Smart Images

Figure CN120276736A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technologies, and particularly to a compilation method, apparatus, electronic device, storage medium, and program product. Background Art
[0002] In recent years, with the development of computer technologies, cloud technology has become an important infrastructure, and it has become increasingly common to provide software operation services (SaaS) through a cloud platform. SaaS enables users to access and use various application programs deployed on the cloud platform through the Internet without installing and managing the application programs locally.
[0003] In the prior art, to facilitate the deployment and development of application programs on the cloud platform, the functions of an online IDE (Integrated Development Environment) are often used to deploy the application programs onto the cloud platform to provide an isolated development environment for users. In addition, virtual desktop technology is also used to provide the functions of the online IDE so that users can access the development environment through the cloud platform client running on any device via the Internet.
[0004] However, a cloud server is a cluster of multiple cloud computing units. When a user uses the functions of the online IDE through the cloud platform client, the compilation tasks sent from the cloud platform client to the cloud server may be randomly assigned to one or more cloud computing units, and the cloud platform client can only connect to one cloud computing unit, resulting in only being able to obtain the messages generated by the currently accessed cloud computing unit and not being able to obtain the asynchronous messages generated by other cloud computing units, leading to message loss. Summary of the Invention
[0005] Embodiments of this application provide a compilation method, apparatus, electronic device, storage medium, and program product, which can avoid the loss of asynchronous messages and improve the security and reliability of the compilation process.
[0006] An embodiment of the present application provides a compilation method, which is applied to a cloud server. The cloud server includes a message unit and multiple cloud computing units. The method includes: obtaining a compilation task of a target application sent by a terminal, and generating a compilation feedback message according to the compilation result of the compilation task by a compilation cloud computing unit, where the compilation cloud computing unit is any one of the cloud computing units; sending the compilation feedback message to the message unit, where the message unit includes at least one of a message cache unit and a message subscription unit; obtaining a query request sent by the terminal, and determining a query cloud computing unit associated with the terminal through the query request, where the query cloud computing unit is any one of the cloud computing units; if the query request is used to call the message query interface corresponding to the message cache unit, calling the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit; if the query request is used to subscribe to the message subscription unit, subscribing to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; sending the obtained compilation feedback message to the terminal, so that the terminal processes the compilation task according to the compilation feedback message, and deploys the target application on the cloud server according to the compilation task.
[0007] An embodiment of the present application further provides a compilation device, which is applied to a cloud server. The cloud server includes a message unit and multiple cloud computing units. The device includes: an obtaining module, configured to obtain a compilation task of a target application sent by a terminal, and generate a compilation feedback message according to the compilation result of the compilation task by a compilation cloud computing unit, where the compilation cloud computing unit is any one of the cloud computing units; a sending module, configured to send the compilation feedback message to the message unit, where the message unit includes at least one of a message cache unit and a message subscription unit; the obtaining module is further configured to obtain a query request sent by the terminal, and determine a query cloud computing unit associated with the terminal through the query request, where the query cloud computing unit is any one of the cloud computing units; a query module, configured to, if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit; the query module is further configured to, if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; the sending module is further configured to send the obtained compilation feedback message to the terminal, so that the terminal processes the compilation task according to the compilation feedback message, and deploys the target application on the cloud server according to the compilation task.
[0008] In some embodiments, the compilation task includes the compilation task of the blockchain contract. Generating a compilation feedback message according to the compilation result of the compilation task by the compilation cloud computing unit includes: generating a compilation command of the blockchain contract by the compilation cloud computing unit, and invoking a compiler corresponding to the compilation command; executing the compilation command by the compiler to obtain the compilation result; generating the compilation feedback message corresponding to the compilation result.
[0009] In some embodiments, the query request is used to invoke the message query interface corresponding to the message cache unit, and the query request carries a first request identifier. The obtaining module is specifically configured to: obtain the query request sent by the terminal, and invoke the query service interface through the query request; verify the first request identifier carried by the query request through the query service interface; when the verification of the first request identifier passes, determine the query cloud computing unit associated with the terminal.
[0010] In some embodiments, the query request is used to subscribe to the message subscription unit, the query request includes a long connection request, and the long connection request carries a second request identifier. The obtaining module is specifically configured to: obtain the long connection request sent by the terminal; verify the second request identifier carried by the long connection request; when the verification of the second request identifier passes, establish a long connection between the terminal and the query cloud computing unit through the long connection request.
[0011] In some embodiments, the compilation feedback message carries a task identifier corresponding to the compilation task. The message cache unit includes a cache queue, and the compilation device further includes a storage module. The storage module is configured to: obtain a storage list corresponding to the cache queue according to the task identifier; insert the compilation feedback message at the end of the storage list, so as to obtain the compilation feedback message stored in the message cache unit from the head of the storage list.
[0012] In some embodiments, the sending module is specifically configured to: send the real-time compilation feedback message to the terminal, so that the terminal processes the compilation task according to the real-time compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0013] In some embodiments, the query request carries a historical query message identifier. The query module is specifically configured to: if the query request is used to invoke the message query interface corresponding to the message cache unit, invoke the message query interface through the query cloud computing unit; screen the real-time compilation feedback message from the obtained compilation feedback messages according to the historical query message identifier through the message query interface;
[0014] In some embodiments, the query request is generated according to a query period, and the compilation device further includes a deletion module, which is configured to: when the query request is not received within a preset number of query periods, delete the compilation feedback message stored in the message cache unit.
[0015] In some embodiments, the query request carries a second request identifier, and the query module is specifically configured to: based on the second request identifier, subscribe to the message subscription unit corresponding to the terminal through the query cloud computing unit; receive, through the query cloud computing unit, the compilation feedback message pushed by the message subscription unit corresponding to the terminal.
[0016] In some embodiments, the compilation device further includes an unsubscribe module, which is configured to: according to the disconnection request sent by the terminal, disconnect the long connection between the terminal and the query cloud computing unit; unsubscribe from the message subscription unit corresponding to the terminal subscribed by the query cloud computing unit.
[0017] The embodiment of the present application further provides an electronic device, including a processor and a memory, where the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in any one of the compilation methods provided by the embodiment of the present application.
[0018] The embodiment of the present application further provides a computer-readable storage medium, where the computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in any one of the compilation methods provided by the embodiment of the present application.
[0019] The embodiment of the present application further provides a computer program product, including a computer program or instructions, and when the computer program or instructions are executed by a processor, the steps in any one of the compilation methods provided by the embodiment of the present application are implemented.
[0020] Embodiments of the present application can obtain a compilation task of a target application sent by a terminal, generate a compilation feedback message according to the compilation result of the compilation task by a cloud computing unit for compilation, where the cloud computing unit for compilation is any one of the cloud computing units; send the compilation feedback message to the message unit, where the message unit includes at least one of a message cache unit and a message subscription unit; obtain a query request sent by the terminal, and determine a cloud computing unit for querying associated with the terminal through the query request, where the cloud computing unit for querying is any one of the cloud computing units; if the query request is used to call a message query interface corresponding to the message cache unit, call the message query interface through the cloud computing unit for querying to obtain the compilation feedback message stored in the message cache unit; if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the cloud computing unit for querying to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; send the obtained compilation feedback message to the terminal so that the terminal processes the compilation task according to the compilation feedback message, and deploys the target application on the cloud server according to the compilation task.
[0021] In the present application, asynchronous compilation feedback messages generated by different cloud computing units for compilation are transmitted to the terminal through the message cache unit and the message subscription unit, avoiding the loss of asynchronous messages and improving the security and reliability of the compilation process. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the following drawings are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0023] Figure 1a is a schematic diagram of the scenario of the compilation method provided by the embodiments of the present application;
[0024] Figure 1b is a schematic flowchart of the compilation method provided by the embodiments of the present application;
[0025] Figure 1c is a schematic diagram of the storage list provided by the embodiments of the present application;
[0026] Figure 1d is a schematic diagram of the subscription channel provided by the embodiments of the present application;
[0027] Figure 1e is a schematic flowchart of the process of publishing a message on the subscription channel provided by the embodiments of the present application;
[0028] Figure 1f It is a schematic flowchart of a query compilation feedback message provided by an embodiment of the present application;
[0029] Figure 1g It is a schematic flowchart of a query compilation feedback message provided by an embodiment of the present application;
[0030] Figure 1h It is a schematic flowchart of an unsubscribe subscription channel provided by an embodiment of the present application;
[0031] Figure 1i It is another schematic flowchart of an unsubscribe subscription channel provided by an embodiment of the present application;
[0032] Figure 2a It is a schematic flowchart of a compilation method provided by another embodiment of the present application;
[0033] Figure 2b It is another schematic flowchart of a compilation method provided by another embodiment of the present application;
[0034] Figure 3a It is a schematic flowchart of a compilation method provided by still another embodiment of the present application;
[0035] Figure 3b It is another schematic flowchart of a compilation method provided by still another embodiment of the present application;
[0036] Figure 4 It is a schematic structural diagram of a compilation device provided by an embodiment of the present application;
[0037] Figure 5 It is a schematic structural diagram of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0038] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative efforts shall fall within the protection scope of the present application.
[0039] An embodiment of the present application provides a compilation method, device, electronic device, storage medium, and program product.
[0040] Among them, the compilation device can be specifically integrated in an electronic device, which can be a device such as a terminal, a server, etc. Among them, the terminal includes but is not limited to mobile phones, computers, intelligent voice interaction devices, smart home appliances, vehicle-mounted terminals, aircraft, etc. Embodiments of the present invention can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, intelligent transportation, assisted driving, etc.; the server can be a single server or a server cluster composed of multiple servers.
[0041] In some embodiments, the compilation device can also be integrated in multiple electronic devices. For example, the compilation device can be integrated in multiple servers, and the compilation method of the present application is implemented by multiple servers.
[0042] In some embodiments, the server can also be implemented in the form of a terminal.
[0043] For example, referring to Figure 1a , the compilation method can be implemented by a cloud server, which includes a message unit and multiple cloud computing units. The cloud server can obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the compilation cloud computing unit. The compilation cloud computing unit is any cloud computing unit; send the compilation feedback message to the message unit, and the message unit includes at least one of a message cache unit and a message subscription unit; obtain the query request sent by the terminal, and determine the query cloud computing unit associated with the terminal through the query request. The query cloud computing unit is any cloud computing unit; if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit; if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; send the obtained compilation feedback message to the terminal so that the terminal processes the compilation task according to the compilation feedback message to deploy the target application on the cloud server according to the compilation task.
[0044] In the embodiments of the present application, the term "module" or "unit" refers to a computer program with a predetermined function or a part of a computer program, which works together with other related parts to achieve a predetermined goal, and can be fully or partially implemented by using software, hardware (such as a processing circuit or a memory), or a combination thereof. Similarly, one processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of the overall module or unit that includes the function of the module or unit.
[0045] It is understandable that in the specific embodiments of the present application, data related to users such as query requests, long connection requests, first request identifiers, second request identifiers, terminal identifiers, user identifiers, compilation tasks, and compilation feedback messages are involved. When the embodiments of the present application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with relevant laws, regulations, and standards of relevant countries and regions.
[0046] The following will be described in detail respectively. It should be noted that the order of the following embodiments does not limit the preferred order of the embodiments.
[0047] In this embodiment, a compilation method is provided, which is applied to a cloud server. The cloud server includes a message unit and multiple cloud computing units, such as Figure 1b As shown, the specific process of this compilation method can be as follows:
[0048] 110. Obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the cloud computing unit for compilation. The cloud computing unit for compilation is any cloud computing unit.
[0049] Among them, the cloud computing unit refers to the computing resource unit in the cloud server. In the embodiments of the present application, a compiler can be deployed in the cloud computing unit, and this compiler can be used to compile the compilation task of the target application. In the computing environment of the cloud server, the computing resources are divided into several independent units, and each unit has a certain computing power and resource quota, which can be used to run application programs, host services, or execute computing tasks, etc. For example, the cloud computing unit can include virtual machines or containers, etc.
[0050] Among them, the cloud computing unit for compilation is a randomly allocated cloud computing unit in the cloud server. Since each cloud computing unit in the cloud server can process tasks, when a task needs to be executed on the cloud server, usually according to a certain load balancing strategy, one or more cloud computing units are randomly selected to process the task, so as to avoid the performance degradation caused by too high load of a certain cloud computing unit, and at the same time, the reliability and fault tolerance of the system can be improved.
[0051] Among them, the message unit refers to the execution unit in the cloud server for transmitting the messages generated by the cloud computing units. The message unit can transmit the messages generated by the cloud computing units in various ways. For example, in the embodiments of the present application, the message unit can transmit the messages generated by the cloud computing units through message caching or message subscription, so that the terminal can obtain the messages by querying the message cache or subscribing to the messages.
[0052] Among them, the target application refers to the application to be deployed on the cloud server. In different scenarios, the target application may vary according to specific requirements and application scenarios. For example, the target application can be a social application, a video application, an e-commerce application, an educational application, and so on. The compilation task refers to the process of converting the source code file of the application into an executable file or a library file.
[0053] Among them, the compilation result refers to the result of whether the cloud computing unit successfully or unsuccessfully compiles the compilation task.
[0054] Among them, the compilation feedback message refers to the information that feedbacks the success or failure of compilation. For example, the compilation feedback message can be a boolean value or a status code used to feedback whether the compilation is successful. When the compilation result is successful, the compilation feedback message is true, and when the compilation result is a failure, the compilation feedback message is false. In addition to including the information that feedbacks the success or failure of compilation, the compilation feedback message can also include other information related to the success or failure of compilation output by the compiler. For example, when the compilation is successful, the compiler will output an executable file, a library file, or an intermediate file, etc., and will also output some warning messages, optimization suggestions, etc., which are the log outputs when generating the compilation files. When the compilation fails, the compiler will output an error message, which can be the log output indicating the existing problems and error reasons when generating the compilation files.
[0055] The embodiments of the present application can be applied to the software operation service scenario based on the cloud platform. In this scenario, the cloud platform is deployed on the cloud service. The cloud platform can be used for the software operation service of the target application. The terminal can be installed with the client of the cloud platform. The user can log in to the cloud platform through this client and develop the target application in the environment deployed on the cloud server, such as online editing or debugging the application program of the target application. Specifically, the user can log in to the cloud platform through the client running on the terminal and send the edited compilation task to the cloud platform (i.e., the cloud server). After receiving the compilation task, the cloud platform randomly distributes it to a cloud computing unit for compilation processing. After the cloud computing unit successfully or unsuccessfully compiles, it can send the corresponding compilation feedback message to the message unit. It should be noted that the process of obtaining the compilation task of the target application sent from the terminal can be implemented through a short connection or a long connection method, and the embodiments of the present application do not make any restrictions.
[0056] In some embodiments, since the cloud computing unit takes a certain amount of time to process the compilation task and will not immediately generate a compilation feedback message, if the terminal remains connected to the cloud service, it will occupy the computing resources and storage resources of the server, causing the server to be overloaded or the performance to decline. Therefore, after sending the edited compilation task to the cloud platform, the connection between the browser running on the terminal and the cloud platform can be disconnected based on reasons such as the user's logout operation, the touch operation on the offline button, or the automatic disconnection of the server / terminal.
[0057] In some embodiments, the cloud computing unit includes a set of containers, which includes one or more containers. These containers share storage, network, and declarations on how to run these containers, so that the content in the cloud computing unit is always colocated and scheduled together, and runs in a shared context. Containers are lightweight, fast to start and stop, can dynamically adjust the number of containers in a short time, have elastic deployment and scaling capabilities, and can allocate resources according to load requirements. At the same time, containers provide a standardized operating environment, enabling applications to migrate seamlessly across different cloud platforms or hosts. Therefore, building a cloud computing unit with one or more containers can endow the cloud computing unit with features such as seamless migration, automatic scaling, automatic disaster recovery, and one-click rollback, facilitating the deployment of target applications on cloud servers.
[0058] In some embodiments, the target application may be a blockchain network, and the compilation task includes the compilation task of blockchain contracts. Thus, the blockchain contracts are compiled online through a cloud server to provide blockchain operation services based on the cloud platform. Specifically, according to the compilation result of the compilation task by the compilation cloud computing unit, a compilation feedback message is generated, including:
[0059] Generate a compilation command for the blockchain contract by the compilation cloud computing unit, and call the compiler corresponding to the compilation command;
[0060] Execute the compilation command through the compiler to obtain the compilation result;
[0061] Generate a compilation feedback message corresponding to the compilation result.
[0062] Among them, the compiler refers to a tool for compiling blockchain contracts. The compilation command refers to a command for compiling blockchain contracts. For example, the compilation command may include the compiler name, the source code file to be compiled, compilation configuration options and parameters, the output file path and name, etc. Different blockchain contracts may use different compilers and compilation commands, and the embodiments of the present application do not limit this.
[0063] For example, when the compilation cloud computing unit receives a compilation task of a blockchain contract, it can generate a compilation command and call the compiler to be used in the cloud computing unit. The compiler can be deployed in one or more containers of the cloud computing unit. The compiler executes the compilation task in the container according to the compilation command. After successful compilation or compilation failure, the compilation cloud computing unit can send the corresponding compilation feedback message to the message unit.
[0064] Blockchain is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithms. Blockchain, in essence, is a decentralized database, a series of data blocks associated using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. A blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.
[0065] The blockchain underlying platform can include processing modules such as user management, basic services, smart contracts, and operation detection. Among them, the user management module is responsible for the identity information management of all blockchain participants, including maintaining the generation of public and private keys (account management), key management, and the maintenance of the correspondence between the real identity of the user and the blockchain address (permission management). And under authorization, it supervises and audits the transaction situations of certain real identities, providing the rule configuration for risk control (risk control audit); the basic service module is deployed on all blockchain node devices, used to verify the validity of business requests, and after reaching a consensus on valid requests, record them on the storage. For a new business request, the basic service first performs interface adaptation parsing and authentication processing (interface adaptation), then encrypts the business information through the consensus algorithm (consensus management), and after encryption, transmits it intact and consistently to the shared ledger (network communication), and records and stores it; the smart contract module is responsible for the registration and issuance of contracts, as well as contract triggering and contract execution. Developers can define contract logic through a certain programming language, publish it to the blockchain (contract registration), trigger the execution according to the logic of the contract terms by calling keys or other events, complete the contract logic, and at the same time provide functions for contract upgrade and cancellation; the operation detection module is mainly responsible for the deployment, configuration modification, contract setting, cloud adaptation during the product release process, and the visual output of the real-time state during product operation, such as: alarm, detecting network conditions, detecting the health status of node devices, etc.
[0066] The platform product service layer provides the basic capabilities and implementation frameworks of typical applications. Developers can build on these basic capabilities and overlay the characteristics of the business to complete the blockchain implementation of the business logic. The application service layer provides application services based on the blockchain solution for business participants to use.
[0067] 120. Send the compilation feedback message to the message unit, where the message unit includes at least one of the message cache unit and the message subscription unit.
[0068] Among them, the message cache unit refers to an execution unit for caching messages generated by the cloud computing unit. The message cache unit can cache the messages generated by the cloud computing unit, and when other components or systems, such as the client installed on the terminal, need to access these messages, they can directly obtain them from the cache, thereby significantly improving the response speed and performance of the cloud platform.
[0069] Among them, the message subscription unit refers to an execution unit for subscribing to messages generated by the cloud computing unit. The message subscription unit can store the messages generated by the cloud computing unit in a channel, enabling other components or systems, such as the client installed on the terminal, to receive these messages in a subscribed manner, so as to receive the messages generated by the cloud computing unit in real time and improve the real-time performance of message transmission on the cloud platform.
[0070] In the embodiment of the present application, the message cache unit and the message subscription unit can be implemented by a cloud database deployed by the cloud service.
[0071] In some embodiments, the message cache unit can store the messages generated by the cloud computing unit through a cache queue. In this way, the latest message can be inserted according to the insertion order of the cache queue, so as to obtain the messages from the queue in sequence. Specifically, the compilation feedback message carries a task identifier corresponding to the compilation task. The message cache unit includes a cache queue. After sending the compilation feedback message to the message unit, it further includes:
[0072] According to the task identifier, obtain the storage list corresponding to the cache queue;
[0073] According to the insertion order of the storage list, insert the compilation feedback message into the storage list, so as to obtain the compilation feedback message stored in the message cache unit from the storage list according to the insertion order.
[0074] Among them, the cache queue can be implemented by a chained list (i.e., the storage list). The compilation feedback message is used as a list element and is inserted into the storage list from the head or tail of the storage list.
[0075] Among them, the task identifier refers to an identifier used to identify the compilation task. The identifier can identify the task or the identity of the task initiator. For example, the task identifier can include, but is not limited to, the terminal that initiates the task, such as the terminal mac address (terminal identifier), the ID of the user who logs in to the cloud platform client running on the terminal (i.e., the user identifier), or other identifiers that can be used to identify the query request.
[0076] For example, after the compilation feedback message is generated by the compilation cloud computing unit, the latest compilation feedback message can be sent to the message cache unit, and the compilation feedback message can be inserted at the head or tail of the storage list according to the insertion order of the storage list corresponding to the task identifier. When obtaining the compilation feedback message stored in the message cache unit, one or more previously inserted compilation feedback messages can be sequentially retrieved from the head or tail of the storage list according to the insertion order of the storage list.
[0077] In some embodiments, the task identifier includes the user identifier corresponding to the terminal, and the name of the storage list includes the user identifier, that is, the message cache unit includes the storage list corresponding to each user identifier. For example, each storage list has a Key, and the Key represents the name of the storage list. The Key can be defined as the message prefix (such as idelog)_user ID (such as: 1001). Thus, when the message cache unit receives the compilation feedback message sent by the compilation cloud computing unit, the storage list corresponding to the user identifier can be obtained according to the user identifier carried in the compilation feedback message, and the compilation feedback message can be inserted into the storage list.
[0078] In some embodiments, the message cache unit can store the messages generated by the cloud computing unit through a cache queue. In this way, the latest message can be inserted at the tail according to the insertion order of the cache queue, so that the messages can be sequentially retrieved from the head of the queue. Specifically, inserting the compilation feedback message into the storage list according to the insertion order of the storage list, so as to obtain the compilation feedback message from the storage list according to the insertion order, includes:
[0079] Insert the compilation feedback message at the tail of the storage list, so as to obtain the compilation feedback message stored in the message cache unit from the head of the storage list.
[0080] Among them, the cache queue can be implemented by a chained list (i.e., the storage list), and the compilation feedback message is used as a list element and inserted into the storage list from the head or tail of the storage list.
[0081] For example, as Figure 1c shown, the storage list can store messages 1 to 5. After the cloud computing unit generates the compilation feedback message, the latest compilation feedback message "SIX" (message 6) can be sent to the message cache unit to cache the compilation feedback message "SIX" in the storage list. Specifically, the RPUSH command can be used to insert the element compilation feedback message "SIX" from the right side (i.e., the tail) of the list. When obtaining the compilation feedback message stored in the message cache unit, the LPOP command (list pop command) can be used to sequentially retrieve the previously inserted element compilation feedback message "ONE" (message 1) and other messages from the left side (i.e., the head) of the list.
[0082] In some embodiments, the storage list can be stored in the message cache unit in the form of key-value pairs, where the name of the storage list is the key and the storage list is the value. In this way, the storage list corresponding to the cache queue can be quickly obtained according to the key of the storage list.
[0083] In some embodiments, in order to prevent the storage list from expanding infinitely, the maximum length of the storage list can be preset. When inserting a compilation feedback message into the storage list, if the length of the storage list is greater than the maximum length, a compilation feedback message already stored in the storage list is popped (i.e., deleted) from the opposite direction of the insertion. For example, the length of the storage list can be set to 2000. When inserting a compilation feedback message at the end of the storage list and the length of the storage list becomes 2001, the first compilation feedback message at the head of the storage list can be popped according to the LPOP command, so as to prevent the storage list from expanding infinitely, causing the message cache unit to occupy too much memory and resulting in performance degradation.
[0084] In some embodiments, the message subscription unit can store and transmit the messages generated by the cloud computing unit through subscription, so as to store all the messages related to the terminal in the corresponding channel of the terminal, enabling the terminal to obtain all the messages related to it from this channel and avoiding omissions. Specifically, the compilation feedback message carries the task identifier corresponding to the compilation task. Sending the compilation feedback message to the message unit includes:
[0085] Obtaining the message subscription unit corresponding to the terminal according to the task identifier;
[0086] Sending the compilation feedback message to the message subscription unit corresponding to the terminal.
[0087] For example, when a user logs in to the cloud server for the first time through the cloud platform client running on the terminal, the cloud server will establish a subscription channel (i.e., the message subscription unit) corresponding to this user in the message subscription unit. In this way, when there are multiple users on the cloud server, multiple subscription channels will be established, and one subscription channel corresponds to one user. The messages generated by each cloud computing unit on the cloud server when processing tasks will be sent to the subscription channel of the user corresponding to this task. That is, all the messages related to user A are received by the subscription channel of user A. If there is no subscriber for this subscription channel (i.e., the cloud computing unit subscribing to this subscription channel), the messages received by this subscription channel will be discarded. If there is a subscriber for this subscription channel, the message will be published (sent) to this subscriber, and then forwarded by this subscriber to the terminal.
[0088] In some embodiments, the task identifier includes the user identifier corresponding to the terminal, and the name of the subscribed channel includes the user identifier, that is, the message subscription unit includes the subscribed channels corresponding to each user identifier. For example, each subscribed channel has a Key, and the Key represents the name of the subscribed channel, and the Key can be defined as the message prefix (such as idelog)_user ID (such as: 1001). In this way, when the message subscription unit receives the compilation feedback message sent by the compilation cloud computing unit, it can obtain the subscribed channel corresponding to the user identifier according to the user identifier carried in the compilation feedback message, and send the compilation feedback message to the subscribed channel.
[0089] In some embodiments, a subscribed channel can have multiple subscribers (i.e., cloud computing units that subscribe to the subscribed channel). For example, as Figure 1d shown in the subscribed channel, the subscribed channel 1 can be subscribed to by the cloud platform client 1 (subscriber 1) running on the terminal 1, the cloud platform client 2 (subscriber 2) running on the terminal 2, and the cloud platform client 3 (subscriber 3) running on the terminal 3. As Figure 1e shown in the process of the subscribed channel publishing messages, the messages generated by each cloud computing unit in the cloud server processing the compilation task will be sent to the subscribed channel of the user corresponding to the task, such as the subscribed channel 1. After the compilation cloud computing unit sends the generated compilation feedback message to the subscribed channel 1 through the PUBLISH command (publish command), the subscribed channel 1 will send the received compilation feedback message to the cloud computing units 1 to 3 that subscribe to it, that is, subscribers 1 to 3. Among them, the subscription command is Subscribe, and the parameter of the subscription command is the channel, such as: Subscribe channel1, and the publish command is Publish, and the parameters of the publish command are the channel and the message, such as Publish channel1messageA.
[0090] 130. Obtain the query request sent by the terminal, and determine the query cloud computing unit associated with the terminal through the query request. The query cloud computing unit is any cloud computing unit.
[0091] Among them, the query request refers to a request for obtaining the compilation feedback message. For example, the query request can be generated by the login operation of the cloud platform client running on the terminal, or can be generated by the query operation executed on the terminal, such as the touch operation on the edit result query button, etc., or the terminal can generate a query request according to the query period. Among them, the query cloud computing unit is a cloud computing unit randomly allocated by the cloud server.
[0092] For example, when a user clicks the edit result query button of the cloud platform client running on the terminal, the terminal generates a query request and sends the query request to the cloud server. The cloud server randomly assigns a cloud computing unit to establish a connection (i.e., association) with the terminal according to the query request to process the query request.
[0093] In some implementations, when obtaining the compiled feedback message stored in the message cache unit, the terminal is connected to the query cloud computing unit through a short connection. Figure 1f As shown, after the terminal generates a query request, the query service interface can be called based on the query request (i.e., a short connection between the terminal and the query cloud computing unit is established), so that the cloud server receives the query request sent by the terminal and forwards the query request to the query cloud computing unit such as cloud computing unit 1 (i.e., the query cloud computing unit associated with the terminal is determined through the query request). A short connection means that only one connection is established between the terminal and the server, and the connection is closed after one data transmission is completed, so as to avoid long-term idle connections occupying system resources through short connections. Among them, the query service interface is a service interface provided by the cloud service, which is used to receive query requests and perform data queries.
[0094] In some implementations, before calling the message query interface, the first request identifier may be verified for the received query request to ensure the consistency and accuracy of the request and improve the security and reliability of the compilation process. Specifically, the query request is used to call the message query interface corresponding to the message cache unit, the query request carries the first request identifier, obtains the query request sent by the terminal, and determines the query cloud computing unit associated with the terminal through the query request, including:
[0095] Obtain the query request sent by the terminal, and call the query service interface through the query request;
[0096] Verify the first request identifier carried in the query request through the query service interface;
[0097] When the first request identifier is verified, a query cloud computing unit associated with the terminal is determined.
[0098] The first request identifier refers to an identifier used to identify the query request, which can identify the request or the identity of the requester. For example, the first request identifier can include but is not limited to the terminal that initiates the request, such as the terminal mac address (i.e., the terminal identifier), the ID of the user who logs in to the cloud platform client running the terminal (i.e., the user identifier), or other identifiers that can be used to identify the query request.
[0099] For example, the cloud server may call the query service interface based on the received query request. When the query request calls the query service interface, the query service interface may verify the user identifier carried in the query request. If the verification passes, the query request is forwarded to the query cloud computing unit (i.e., the query cloud computing unit associated with the terminal).
[0100] In some implementations, when obtaining the compiled feedback message stored in the message subscription unit, the terminal is connected to the query cloud computing unit through a long connection. Specifically, Figure 1g As shown, when the terminal generates a query request (such as a long connection request), the query request can be sent to the cloud server. The cloud server receives the query request and randomly forwards it to a cloud computing unit such as cloud computing unit 1 (i.e., the query cloud computing unit associated with the terminal determined by the query request) to establish a long connection between the terminal and the cloud computing unit (query cloud computing unit). A long connection means that the connection between the client and the server is maintained after a connection is established once, and the same connection can be reused between multiple requests and responses. In this way, the long connection makes it unnecessary to frequently establish and close the connection between the terminal and the server, which can reduce network load and delay.
[0101] In some implementations, the terminal can receive asynchronous messages generated by different cloud computing units through subscription and long connection to avoid message loss. Specifically, the query request is used to subscribe to the message subscription unit, the query request includes a long connection request, the long connection request carries a second request identifier, obtains the query request sent by the terminal, and determines the query cloud computing unit associated with the terminal through the query request, including:
[0102] Get the long connection request sent by the terminal;
[0103] Check the second request identifier carried in the long connection request;
[0104] When the second request identifier is verified, a long connection is established between the terminal and the query cloud computing unit through a long connection request.
[0105] Among them, a long connection request refers to a request for requesting to establish a long connection between a terminal and a cloud computing unit for querying, and the long connection request may be different in different application scenarios. The second request identifier refers to an identifier used to identify a long connection request, which can identify the request or the identity of the requester. For example, the second request identifier may include but is not limited to the terminal that initiates the request, such as the terminal mac address (i.e., the terminal identifier), the ID of the user who logs in to the cloud platform client running on the terminal (i.e., the user identifier), or other identifiers that can be used to identify a long connection request.
[0106] For example, the query request can be a websocket connection request (i.e., a long connection request). After receiving the websocket connection request, the cloud server will forward it to any cloud computing unit, such as cloud computing unit 1 (i.e., determining the cloud computing unit for query associated with the terminal through the query request). After receiving the websocket connection request, cloud computing unit 1 verifies the user identification carried in the request. If the verification passes, it establishes a websocket connection (i.e., a long connection) with the terminal and saves the websocket connection locally so that the same connection can be reused between multiple requests and responses.
[0107] 140. If the query request is used to call the message query interface corresponding to the message cache unit, the cloud computing unit for query calls the message query interface to obtain the compilation feedback message stored in the message cache unit.
[0108] Among them, the message query interface refers to the interface used to send a query request to the message cache unit. This message query interface enables the message cache unit to receive the query request and perform data query.
[0109] For example, Figure 1f As shown in the process of querying the compilation feedback message, the message cache unit can receive and cache the compilation feedback messages generated by multiple cloud computing units, such as message A and message B. After the cloud computing unit for query (cloud computing unit 1) receives the query request, it can call the message query interface corresponding to the message cache unit through this cloud computing unit for query, so that the message cache unit receives the query request and performs data query on the cached data, and returns the queried compilation feedback messages, such as message A and message B, as the response of the message query interface to the cloud computing unit for query. The cloud computing unit for query returns the received compilation feedback message as the response of the query service interface to the terminal. In this way, the call interface only establishes a connection once between the terminal and the server, and closes the connection after completing one data transmission to avoid occupying system resources by long-term idle connections.
[0110] It can be understood that since the cloud computing unit takes a certain amount of time to process the compilation task and will not immediately generate a compilation feedback message, if the terminal maintains a long connection with the cloud service, it will occupy the computing resources and storage resources of the server, causing the server to be overloaded or the performance to decline. Without using the long connection method and adopting the method of disconnecting from the cloud service and reconnecting, due to the random allocation mechanism of the cloud server, when the terminal reconnects to the cloud service to obtain the compilation feedback message, it is very likely to connect to a cloud computing unit different from the cloud computing unit used for editing. This results in the terminal only being able to obtain the message generated by the currently connected query cloud computing unit and not being able to receive the asynchronous compilation feedback message generated by the editing cloud computing unit, causing message loss. In the embodiments of the present application, by passing the asynchronous compilation feedback messages generated by different editing cloud computing units through the message cache unit, it is possible to avoid asynchronous message loss when the terminal does not need to maintain a long connection with the cloud server, improving the security and reliability of the compilation process.
[0111] In some embodiments, if the query request is used to call the message query interface corresponding to the message cache unit, the query cloud computing unit calls the message query interface to obtain the compilation feedback message stored in the message cache unit, including: the query cloud computing unit takes out the compilation feedback message from the storage list corresponding to the cache queue through the message query interface such as the Lrange interface. For example, the previously inserted compilation feedback messages are taken out sequentially from the left (i.e., the head) of the list.
[0112] In practical applications, the message query interface is usually only used to query the compilation feedback message stored in the message cache unit and will not delete the compilation feedback message stored in the message cache unit, so as to avoid repeatedly obtaining messages. Therefore, in some embodiments, the real-time compilation feedback messages are filtered through the historical first request identifier and historical request timestamp carried by the query request to avoid repeatedly obtaining messages. Specifically, the query request carries a historical query message identifier. If the query request is used to call the message query interface corresponding to the message cache unit, the query cloud computing unit calls the message query interface to obtain the compilation feedback message stored in the message cache unit, including:
[0113] If the query request is used to call the message query interface corresponding to the message cache unit, the query cloud computing unit calls the message query interface;
[0114] Through the message query interface, according to the historical query message identifier, the real-time compilation feedback messages are filtered from the obtained compilation feedback messages;
[0115] The obtained compilation feedback message is sent to the terminal so that the terminal processes the compilation task according to the compilation feedback message and deploys the target application on the cloud server according to the compilation task, including:
[0116] Send the real-time compilation feedback message to the terminal so that the terminal processes the compilation task according to the real-time compilation feedback message, and deploys the target application on the cloud server according to the compilation task.
[0117] Among them, the historical message identifier refers to the identifier used to identify the compilation feedback message queried by the historical query request and sent to the terminal. The historical query request refers to the query request for calling the message query interface at a historical moment, and this historical moment is the moment before the query request for the current call to the message query interface. For example, the historical message identifier may include the identifier of the historical message such as the message ID and the query timestamp. Among them, the query timestamp refers to the time value of the time point when the historical query request calls the message query interface.
[0118] In some embodiments, the historical message identifier may be the identifier (i.e., the last message identifier) used to identify the compilation feedback message queried by the last query request and sent to the terminal, and the historical request timestamp is the time value used to identify the time point when the last query request occurred. In this way, by recording the message identifier of the message queried by the last query request, the last message identifier can be compared with the messages stored in the message cache unit to only obtain the newly added or changed data, avoid repeatedly querying the data that has already been obtained, and improve the query efficiency and performance.
[0119] For example, when the query cloud computing unit returns the compilation feedback message returned by the message query interface to the terminal, the message identifier of the compilation feedback message can be returned to the terminal together. The terminal records the message identifier and, when generating the next query request, adds the recorded historical message identifier to the query request. When the query cloud computing unit calls the message query interface corresponding to the message cache unit, it can obtain the storage list of the message cache unit, obtain all the compilation feedback messages stored in the storage list from the head of the storage list, and then traverse all the compilation feedback messages according to the last message identifier to obtain the compilation feedback messages whose message identifier is after the identifier (ID) of the last message and / or the timestamp is later than the historical request timestamp. This compilation feedback message is the compilation feedback message after the last query request (i.e., the real-time compilation feedback message).
[0120] Since the stored list messages are sequentially stored at the tail of the storage list, in some embodiments, the compilation feedback messages stored in the message buffer unit can be sequentially retrieved from the head and tail of the storage list, and it can be determined whether the retrieved message is the compilation feedback message queried by the previous query request (i.e., the target compilation feedback message); when the target compilation feedback message is retrieved, the retrieval of the compilation feedback messages stored in the message buffer unit is stopped, and the compilation feedback messages other than the target compilation feedback message retrieved are used as the real-time compilation feedback messages, and the message identifier of the real-time compilation feedback message is after the identifier (ID) of the previous message and / or the timestamp is later than the historical request timestamp, thereby reducing the data volume of reading the compilation feedback messages from the storage list and improving the efficiency of obtaining the real-time compilation feedback messages.
[0121] If the terminal generates a query request for the first time, the terminal does not record the historical message identifier, and the generated query request does not carry the historical message identifier at this time. Therefore, in some embodiments, when the message buffer unit receives a query request, it can detect whether the query request carries a historical message identifier. If it does, it indicates that the compilation feedback message has been queried at a historical moment. Specifically, before screening the real-time compilation feedback messages from the retrieved compilation feedback messages according to the historical query message identifier through the message query interface, it further includes:
[0122] Detect the historical message identifier in the query request.
[0123] For example, if it is detected that the query request carries a historical message identifier, the real-time compilation feedback messages are screened from the retrieved compilation feedback messages according to the historical query message identifier through the message query interface, so as to send the real-time compilation feedback messages to the terminal. If it is not detected that the query request carries a historical message identifier, the retrieved compilation feedback messages are directly sent to the terminal. The terminal processes the compilation task according to the received real-time compilation feedback messages or compilation feedback messages, so as to deploy the target application on the cloud server according to the compilation task.
[0124] In practical applications, since the message query interface is usually only used to query the compilation feedback messages stored in the message buffer unit and does not delete the compilation feedback messages stored in the message buffer unit, the stored messages occupy too much system resources. In some embodiments, when the time difference between the current time and the query timestamp is greater than the preset duration, the compilation feedback messages stored in the message buffer unit are deleted to clear the expired messages in the message buffer unit.
[0125] In some embodiments, a query period can be preset so that the terminal regularly generates query requests and immediately obtains real-time messages generated by the cloud computing unit for compilation from the message cache unit. In this way, when no query request is received within a preset number of query periods, it can be considered that the cloud platform client running on the terminal is offline. Accordingly, the messages in the message cache unit can be deleted to avoid message accumulation after the terminal goes offline, which causes waste of cache resources. By specifying the query period to delete expired messages, unnecessary messages can be cleared in a timely manner, storage resources can be released, and the utilization rate of storage resources can be improved. Specifically, the query request is generated according to the query period. The compilation method further includes:
[0126] When no query request is received within a preset number of query periods, delete the compilation feedback messages stored in the message cache unit.
[0127] The query period refers to the period for the terminal to generate query requests, and this query period can be set according to actual requirements or application scenarios. For example, in order to immediately obtain real-time messages generated by the cloud computing unit for compilation, the query period can be set to a relatively short time such as 1 s (second). The preset number of query periods can be set according to actual requirements or application scenarios. For example, the preset number of query periods can be set to 10 query periods, that is, 10 s.
[0128] For example, it can be set that the terminal generates a query request every 1 s to call a message query interface once. When no query request is received within 10 query periods of the message cache unit, that is, within 10 s from the last query timestamp, it can be considered that the cloud platform client running on the terminal is offline. Accordingly, the messages in the message cache unit can be deleted to avoid message accumulation after the terminal goes offline. In this way, by setting the query period, real-time messages generated by the cloud computing unit for compilation can be obtained in a relatively short time, the real-time nature of message acquisition can be increased, and combined with the setting of the preset number of query periods, meaningless expired messages can be cleared in a timely manner, and the utilization rate of storage resources can be improved.
[0129] 150. If the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the cloud computing unit for query to obtain the compilation feedback messages received by the message subscription unit corresponding to the terminal.
[0130] For example, the cloud server further includes a subscription service unit, such as Figure 1gIn the process of the query compilation feedback message shown, after the cloud server receives a query request sent by the terminal, such as a long connection request, it will forward it to the query cloud computing unit, such as Cloud Computing Unit 1. After the query cloud computing unit receives the query request sent by the terminal for subscribing to the message subscription unit, it can initiate a subscription request to the subscription service unit to subscribe to the message subscription unit corresponding to the terminal. The subscription service unit establishes a subscription relationship between the terminal and the subscription channel of the user corresponding to the terminal according to the subscription request. The subscription channel will receive compilation feedback messages generated by the compilation cloud computing units, such as Cloud Computing Unit 2 and Cloud Computing Unit 3, such as Message A and Message B, and immediately push them to the terminal subscribing to it. The subscription channel can immediately push the latest compilation feedback message generated by the cloud computing unit to the terminal corresponding to the query cloud computing unit subscribing to it, while the cloud computing units that do not subscribe to this channel will not receive the messages of this channel, and the cloud computing units that subscribe to this channel will not receive the messages before subscribing to this channel. In this way, the terminal can subscribe to the corresponding subscription channel through the query cloud computing unit to obtain the latest compilation feedback messages generated by more than one cloud computing unit.
[0131] It can be understood that there may be multiple compilation tasks for the terminal, and multiple editing tasks may be assigned to multiple different editing cloud computing units for processing. Due to the random allocation mechanism of the cloud server, when the terminal queries and retrieves the compilation feedback message, it can only obtain the messages generated by the cloud computing unit currently accessed by the terminal, which also results in the inability to receive the asynchronous compilation feedback messages generated by the cloud computing units not accessed by the terminal, easily leading to message loss. For example, the terminal creates a connection to Cloud Computing Unit 1, and the messages generated by Cloud Computing Unit 1 can be sent to the terminal through the connection with the terminal. However, the asynchronous messages generated by other cloud computing units such as Cloud Computing Unit 2 and Cloud Computing Unit 3 cannot directly send the messages to the terminal because there is no connection to the terminal, resulting in message loss and business failures.
[0132] In contrast, in the embodiment of the present application, by subscribing to the message subscription unit corresponding to the terminal through the query cloud computing unit, the message subscription unit can transmit asynchronous compilation feedback messages generated by different editing cloud computing units to avoid the loss of asynchronous messages and improve the security and reliability of the compilation process.
[0133] In some embodiments, the message subscription unit corresponding to the terminal is determined through the request identifier carried in the query request to improve the security and reliability of the compilation process. Specifically, the query request carries a second request identifier. If the query request is used to subscribe to the message subscription unit, the query cloud computing unit subscribes to the message subscription unit corresponding to the terminal to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal, including:
[0134] Based on the second request identifier, subscribing to the message subscription unit corresponding to the terminal by querying the cloud computing unit;
[0135] The cloud computing unit is used to query and receive the compilation feedback message pushed by the message subscription unit corresponding to the terminal.
[0136] For example, the cloud computing unit 1 also initiates a subscription request to the subscription service unit according to the user identifier carried in the websocket connection request. The subscription service unit searches for the subscription channel corresponding to the user identifier according to the user identifier carried in the subscription request, establishes a subscription relationship between the terminal and the subscription channel corresponding to the user identifier, waits for the subscription channel to receive and push the compiled feedback message related to the user identifier to the query cloud computing unit, and the query cloud computing unit forwards it to the terminal through a long connection. Figure 1g In the process of querying and compiling feedback messages shown in the figure, when cloud computing unit 1 subscribes to subscription channel A corresponding to user ID A, new messages such as new message A and new message B generated by multiple cloud computing units in the cloud server, such as cloud computing units 1 to 3, related to user ID A will be sent to subscription channel A, which will be forwarded to cloud computing unit 1 that subscribes to it in real time, and then cloud computing unit 1 will send the new message A and new message B to the corresponding terminal through a websocket connection. In this way, the terminal can receive asynchronous messages generated by different cloud computing units through the subscription method and the long connection method, avoiding message loss, so as to improve the security and reliability of the compilation process.
[0137] In some implementations, the long connection can be disconnected and the message subscription unit can be unsubscribed according to the disconnection request of the terminal, so that the compilation feedback message obtained by the message subscription unit after the disconnection is no longer sent to the terminal, so as to avoid transmitting invalid messages and reduce the invalid occupation of system resources and network resources. Specifically, the compilation method also includes:
[0138] Disconnect the long connection between the terminal and the query cloud computing unit according to the disconnection request sent by the terminal;
[0139] The message subscription unit corresponding to the terminal subscribed by the cloud computing unit is unsubscribed for query.
[0140] The disconnection request refers to a request for disconnecting the persistent connection between the terminal and the query cloud computing unit. For example, the disconnection request may be generated by a logout operation of a cloud platform client running on the terminal, or may be generated by a request operation performed on the terminal, such as a touch operation on an offline button.
[0141] For example, Figure 1hThe process of unsubscribing from a subscribed channel is as follows. When a user clicks the offline button of the cloud platform client running on the terminal, a disconnection request can be generated and sent to the query cloud computing unit via a long connection. The query cloud computing unit verifies the request based on the user identification carried in the disconnection request. After successful verification, it disconnects the long connection with the terminal (i.e., closes the long connection) according to the disconnection request, deletes the locally stored long connection at the same time, and unsubscribes from the subscribed channel. After unsubscribing, the subscribed channel no longer sends messages to the query cloud computing unit, and thus no longer sends messages to the terminal connected to the query cloud computing unit, thereby reducing the ineffective occupation of system resources and network resources. For example, as Figure 1i In the process of unsubscribing from a subscribed channel as shown, among Subscriber 1 to Subscriber 3 of Subscribed Channel 1, when Subscriber 1 unsubscribes from Subscribed Channel 1, the subscribed channel no longer sends messages to Subscriber 1 after receiving the messages. Among them, the unsubscription channel command is UnSubscribe, and the command parameter is the channel, such as: UnSubscribe channel1.
[0142] In some embodiments, if any subscribed channel has no subscribers (i.e., the cloud computing unit subscribed to the channel), when the subscribed channel receives a compilation feedback message, the compilation feedback message is discarded. It can be understood that when any subscribed channel has no subscribers, it means that all terminal users corresponding to the subscribed channel are offline. Therefore, the received messages can be deleted at this time, so that the subscribed channel only stores the compilation feedback messages that can be sent to any subscriber in real time, and does not store expired compilation feedback messages, so as to feedback real-time compilation feedback messages to the terminal.
[0143] In some embodiments, when the query cloud computing unit disconnects from the message subscription unit corresponding to the terminal, the long connection between the terminal and the query cloud computing unit is disconnected, and the message subscription unit corresponding to the terminal stops sending compilation feedback messages to the query cloud computing unit. This is to ensure that when the query cloud computing unit disconnects from the message subscription unit due to a fault, restart, or other reasons, the message subscription unit corresponding to the terminal will not be sent to the query cloud computing unit, so as to avoid transmitting invalid messages and reduce the ineffective occupation of system resources and network resources. At the same time, disconnecting the long connection between the terminal and the query cloud computing unit allows the user to attempt to re-initiate a long connection request to establish a long connection between the terminal and any cloud computing unit (i.e., a new query cloud computing unit), and enable the new query cloud computing unit to subscribe to the message subscription unit corresponding to the terminal, so as to ensure that the compilation feedback messages sent by the subsequent message subscription unit are forwarded to the terminal via the new and normal query cloud computing unit, avoiding message loss and ensuring the security and quality of message transmission.
[0144] 160. Send the obtained compilation feedback message to the terminal so that the terminal can process the compilation task according to the compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0145] Among them, the processing process of the compilation task includes but is not limited to deploying the compilation task, debugging the compilation task, etc. Debugging refers to the process of modifying or adjusting the compilation task according to the compilation feedback message so that it can be successfully compiled.
[0146] For example, the obtained compilation feedback message can be converted into an interface response format to return a response to the terminal. After the terminal obtains the compilation feedback message, it can select to deploy the compilation task or debug the compilation task according to the compilation feedback message. For example, if the compilation feedback message is true (i.e., the compilation is successful), the target application corresponding to the compilation task or the function of the target application can be deployed on the cloud service for online use. For example, if the compilation feedback message is false (i.e., the compilation fails), the compilation task can be debugged according to the warning information, optimization, etc. in the compilation feedback message, and the debugged compilation task is sent to the cloud server, and the compilation cloud computing unit of the cloud server compiles it again until the compilation is successful.
[0147] The compilation solution provided by the embodiments of this application can be applied to various cloud service scenarios. For example, taking the cloud server as an example, obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the compilation cloud computing unit. The compilation cloud computing unit is any cloud computing unit; send the compilation feedback message to the message unit, and the message unit includes at least one of a message cache unit and a message subscription unit; obtain the query request sent by the terminal, and determine the query cloud computing unit associated with the terminal through the query request. The query cloud computing unit is any cloud computing unit; if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit; if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; send the obtained compilation feedback message to the terminal so that the terminal can process the compilation task according to the compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0148] As can be seen from the above, the embodiments of this application transmit the asynchronous compilation feedback messages generated by different compilation cloud computing units to the terminal through the message cache unit and the message subscription unit, avoiding the loss of asynchronous messages and improving the security and reliability of the compilation process.
[0149] The method described in the above embodiments will be further described in detail below.
[0150] In this embodiment, taking the compilation task of a blockchain contract as an example, the method of the embodiment of the present application will be described in detail.
[0151] The compilation method of the embodiment of the present application is applied to a cloud server, which includes a message unit and multiple cloud computing units. Among them, the message unit may include a cache service unit provided by a remote dictionary service. The remote dictionary service is a database of key-value (key-value) in-memory caches, supports multiple data structures, and is mostly used in cache systems. The cloud computing unit can be a Pod, which is the smallest deployable computing unit created and managed in a container orchestration engine. A Pod is a group (one or more) of containers; these containers share storage, network, and declarations of how to run these containers. The contents in a Pod are always colocated and scheduled together, and run in a shared context. What a Pod models is an application-specific "logical host", which contains one or more application containers that are relatively tightly coupled together. In a non-cloud environment, applications running on the same physical machine or virtual machine are similar to cloud applications running on the same logical host.
[0152] As Figure 2a and 2b shown, the specific process of a compilation method is as follows:
[0153] 210. Obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the cloud computing unit for compilation. The cloud computing unit for compilation is any cloud computing unit.
[0154] For example, if the target application is a blockchain network and its compilation task is the compilation task of a blockchain contract, the embodiment of the present application provides the function of an online blockchain IDE through a cloud platform. The terminal can access the cloud platform through a browser. The user can log in to the cloud platform through the browser running on the terminal, and online edit and simulate and debug the blockchain contract in the environment deployed by the cloud server. Since the IDE service runs in the cloud service cluster, it avoids the cumbersome environment installation and resource costs for users. At the same time, the process of simulating and debugging the blockchain contract (i.e., the compilation process) does not actually go on-chain, and the contract can be debugged immediately on the cloud server after editing the contract.
[0155] Specifically, the user can log in to the cloud platform through the browser running on the terminal and send the edited compilation task (i.e., the edited blockchain contract) to the cloud platform (i.e., the cloud server). After receiving the compilation task, the cloud platform randomly distributes it to a cloud computing unit for compilation processing. The compilation principle is that the cloud computing unit starts docker (container) in the background to simulate the execution of the blockchain contract code. After successful or failed compilation, the cloud computing unit can send the corresponding compilation feedback message to the message unit. The elements in the compilation feedback message are defined as: uuid_timestamp_message content (json content). Specifically: uuid is the unique identifier of the message, used for deduplication display of the message; timestamp is the message generation time, used to show the time when the message occurred, and the front end displays it in chronological order; the message content is a json string. The structured message is convenient for distinguishing the message categories, and the front end makes personalized displays according to different message categories. For example: {"dir":dir,"cmd":"build","file":"main.go","out":"buildsuccess"}. Among them, dir is the file directory, cmd is the type category, the action that generates the message, build represents the asynchronous message generated during program compilation, file is the compiled file, and out is the log output when compiling the file.
[0156] It should be noted that after sending the edited compilation task to the cloud platform, the browser running on the terminal can disconnect from the cloud platform due to reasons such as the user's logout operation, the touch operation on the offline button, or the server automatically disconnecting the connection.
[0157] 220. Send the compilation feedback message to the message cache unit and store the compilation feedback message in the message cache unit.
[0158] For example, all messages generated by the computing unit Pod on the cloud server will be sent to the cache service unit, and the cache service unit provides a queue service for temporary message storage (i.e., the cache queue). This cache queue uses a list (i.e., the storage list) as its underlying data structure. The storage list is a simple list of strings, which stores data in the insertion order and can batch retrieve messages from the list head or the list tail. In addition, the storage list supports TTL (message expiration time) setting to automatically delete messages when they expire. Therefore, when the TTL of the storage list is set to 10 times the query period, if no query request is received within 10 query periods, the messages in the storage list will be deleted.
[0159] 230. Obtain the query request sent by the terminal and call the query service interface through the query request.
[0160] 240. Verify the first request identifier carried in the query request through the query service interface.
[0161] 250. When the verification of the first request identifier passes, determine the query cloud computing unit associated with the terminal.
[0162] For example, after the user logs in to the browser running on the terminal, as Figure 2b shown in the process of the compilation method, the browser running on the terminal generates a query request according to the query cycle, and calls the query service interface (http short connection method) based on the query request to send the query request to the cloud server. When the query request calls the query service interface, the query service interface can identify and verify the user identifier (the first request identifier) carried in the query request through the authentication module. When the verification passes, the cloud server randomly forwards the query request to a certain Pod, such as Pod1 (i.e., the query cloud computing unit) to process the query request.
[0163] Specifically, the request method of the query service interface is HTTP GET. The request parameters of the query request include the uuid and timestamp (i.e., the last message identifier) of the last message of the previous request and the user ID (i.e., the first request identifier) of this request, and the user ID is used for the authentication module to identify.
[0164] It should be noted that in the embodiment of the present application, by setting a timing polling mechanism at the front end (i.e., the terminal browser), an empty response is returned when there is no message. At this time, there will be a small amount of network resource consumption. However, compared with the long connection method, in order to maintain the long connection, heartbeat packets need to be sent regularly for link keep-alive. The solution of the embodiment of the present application consumes less resource cost.
[0165] In the embodiment of the present application, the asynchronous compilation feedback messages generated by different editing cloud computing units are transmitted through the message cache unit, avoiding the loss of asynchronous messages and improving the security and reliability of the compilation process. In addition, the front end (i.e., the terminal browser) obtains the function of asynchronous messages through the timing polling query interface and the short connection method, so as to establish only one connection between the terminal and the server, close the connection after completing one data transmission, consume less server resources, and at the same time do not need to maintain a long connection, and also avoid the quantity limit of the long connection (the system needs container resources to maintain the long connection).
[0166] 260. Call the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit.
[0167] For example, as Figure 2b shown in the process of the compilation method, Pod1 calls the message query interface, such as the Lrange interface, to take out the compilation feedback message from the storage list corresponding to the cache queue. For example, take out the previously inserted compilation feedback messages in sequence from the left (i.e., the head) of the list.
[0168] 270. Detect the historical message identifier in the query request.
[0169] For example, as Figure 2b shown in the process of the compilation method, the message cache unit can detect whether the query request carries a historical message identifier. If it is detected that it does, it indicates that the compilation feedback message was queried at a historical moment.
[0170] 281. If it is detected that the query request carries a historical message identifier, then through the message query interface, according to the historical query message identifier, filter the real-time compilation feedback message from the obtained compilation feedback messages.
[0171] 282. Send the real-time compilation feedback message to the terminal so that the terminal can process the compilation task according to the real-time compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0172] For example, as Figure 2b shown in the process of the compilation method, if it is detected that the query request carries a historical message identifier, when Pod 1 (i.e., the cloud computing unit for query) calls the cache service query interface to query the cache queue, the message cache unit finds the recently generated messages A and B of Pod 2 and Pod 3 (i.e., filter the real-time feedback messages) according to the historical query message identifier. Messages A and B are converted into the interface response of the message query interface and returned to Pod 1. Pod 1 returns this returned data as the response of the query service interface to the browser running on the terminal, thus realizing the function of multi-Pod asynchronous message notification. After the user obtains the real-time compilation feedback message on the terminal browser, the user can choose to deploy the blockchain contract or debug the compilation task on the cloud server according to the real-time compilation feedback message.
[0173] Specifically, the data returned by the message query interface and the query service interface is in the format of a json array, and its array elements include uuid (string), timestamp (int64), info (string), which are the uuid of the message, the time when the message was generated, and the message content (json string) respectively.
[0174] 291. If it is not detected that the query request carries a historical message identifier, then send the obtained compilation feedback message to the terminal so that the terminal can process the compilation task according to the compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0175] For example, as Figure 2bFor the process of the compilation method shown, if it is not detected that the query request carries a historical message identifier, when Pod 1 calls the cache service query interface to query the cache queue, all messages in the cache queue are returned to Pod 1 as the response of the message query interface. Then Pod 1 converts the returned data into the interface response of the query service interface and returns it to the browser running on the terminal, thus realizing the function of multi-Pod asynchronous message notification. After the user obtains the compilation feedback message on the terminal browser, the user can choose to deploy the blockchain contract on the cloud server or debug the compilation task according to the compilation feedback message.
[0176] As can be seen from the above, in the embodiment of the present application, the asynchronous compilation feedback messages generated by different editing cloud computing units are transmitted through the message cache unit to implement the asynchronous message function, avoid the loss of asynchronous messages, and improve the security and reliability of the compilation process. In addition, the front end (i.e., the terminal browser) obtains the function of asynchronous messages by periodically polling the query interface and in a short connection manner, so that only one connection is established between the terminal and the server, and the connection is closed after one data transmission, resulting in lower server resource consumption. At the same time, there is no need to maintain a long connection, and the number limit of long connections is also avoided (the system needs container resources to maintain long connections).
[0177] According to the method described in the above embodiment, further detailed description will be made below.
[0178] In this embodiment, taking the compilation task of the blockchain contract as an example, the method of the embodiment of the present application will be described in detail.
[0179] The compilation method of the embodiment of the present application is applied to a cloud server, and the cloud server includes a message unit and multiple cloud computing units. Among them, the message unit may include a subscription service unit provided by a remote dictionary service. The remote dictionary service is a database of key-value (key-value) in-memory caches, which supports multiple data structures and is mostly used in cache systems. The subscription service unit provided by the remote dictionary service is a message communication mode, which sends messages through a sender (pub) and receives messages through a subscriber (sub). The subscriber can subscribe to any number of channels. The cloud computing unit can be the smallest deployable computing unit Pod created and managed in a container orchestration engine. A Pod is a group (one or more) of containers.
[0180] As Figure 3a and 3b shown, the specific process of a compilation method is as follows:
[0181] 310. Obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the compilation cloud computing unit.
[0182] For example, the target application is a blockchain network, and its compilation task is the compilation task of blockchain contracts. In the embodiments of the present application, the cloud platform provides the function of an online blockchain IDE, and the terminal can access the cloud platform through a browser. The user can log in to the cloud platform through the browser running on the terminal, and online edit and simulate and debug blockchain contracts in the environment deployed on the cloud server. Since the IDE service runs in the cloud service cluster, it avoids the cumbersome environment installation and resource costs for users. At the same time, the process of simulating and debugging blockchain contracts (i.e., the compilation process) does not actually go on-chain, and the contract can be instantly debugged on the cloud server after editing the contract.
[0183] Specifically, the user can log in to the cloud platform through the browser running on the terminal, such as Figure 3b the process of the compilation method shown, and send the edited compilation task (i.e., the edited contract) to the cloud platform (i.e., the cloud server). After receiving the compilation task, the cloud platform randomly distributes it to any one of the cloud computing units (i.e., the cloud computing unit for compilation) for compilation processing. The compilation principle is that the cloud computing unit starts docker (container) in the background to simulate the execution of the blockchain contract code. After successful or failed compilation, the cloud computing unit can send the corresponding compilation feedback message to the subscription channel corresponding to the user identifier of the user who generated it in the message subscription unit. After sending the edited compilation task to the cloud platform, the browser running on the terminal can disconnect from the cloud platform due to reasons such as the user's logout operation or the touch operation on the offline button.
[0184] 320. Obtain the long connection request sent by the terminal.
[0185] 330. Verify the second request identifier carried in the long connection request.
[0186] 340. When the verification of the second request identifier passes, establish a long connection between the terminal and the cloud computing unit for query through the long connection request.
[0187] For example, such as Figure 3b the process of the compilation method shown, based on the user's login operation to the cloud platform or the user's query operation, the terminal generates a long connection request such as a websocket connection request and sends the long connection request to the cloud server. The cloud server randomly allocates a Pod (i.e., the cloud computing unit for query) such as Pod1 according to the long connection request to establish a long connection with the terminal and saves it locally.
[0188] Specifically, after receiving a websocket connection request, Pod1 verifies the user identifier carried in the request. If the verification passes, it establishes a websocket connection (i.e., a long connection) with the terminal and maintains this websocket connection locally so that the same connection can be reused between multiple requests and responses. In addition, Pod1 also saves this websocket connection in the local connection Map container in the form of a key being the user ID and the value being the connection socket. When the user logs out of the terminal browser, the user closes the websocket connection. After receiving the request, the cloud service closes the connection, deletes the corresponding connection in the local websocket map, and unsubscribes from the user channel to complete the release of resources.
[0189] 350. Send the compilation feedback message to the message subscription unit.
[0190] For example, there are one or more message subscription units, which are determined according to the number of users on the cloud platform. The message subscription unit can be integrated into the subscription service unit. One message subscription unit is one subscription channel, and one subscription channel corresponds to one user. Messages generated by each cloud computing unit in the cloud server during task processing will be sent to the subscription channel of the user corresponding to the task. That is, the subscription channel of any user A receives all messages related to that user A. If there are no subscribers to this subscription channel, the messages received by this subscription channel will be discarded. If there are subscribers to this subscription channel, the messages will be published (sent) to the subscribers (i.e., the Pods that subscribe to this subscription channel).
[0191] 360. Based on the second request identifier, query the message subscription unit corresponding to the terminal using the cloud computing unit.
[0192] 370. Receive the compilation feedback message pushed by the message subscription unit corresponding to the terminal using the cloud computing unit by querying.
[0193] 380. The cloud computing unit for querying sends the obtained compilation feedback message to the terminal so that the terminal can process the compilation task according to the compilation feedback message and deploy the target application on the cloud server according to the compilation task.
[0194] For example, as Figure 3bIn the process of the compilation method shown in the figure, Pod1 also initiates a subscription request to the subscription service unit according to the user identifier carried in the websocket connection request. The subscription service unit searches for the subscription channel corresponding to the user identifier according to the user identifier carried in the subscription request, and establishes a subscription relationship between the terminal and the subscription channel corresponding to the user identifier, so as to wait for the subscription channel to receive and push the compilation feedback message related to the user identifier to the query cloud computing unit (waiting for asynchronous message). When the subscription unit receives the compilation feedback message, the query cloud computing unit parses and converts the message, and then forwards the message to the terminal browser through a long connection.
[0195] Specifically, when Pod1 subscribes to subscription channel A corresponding to user ID A, multiple Pods in the cloud server, such as Pod1~3, compile the compilation task of the blockchain contract sent by any terminal, and generate new messages related to user ID A, such as new message A and new message B. Then, both new message A and new message B will be sent to subscription channel A, which will be cached by subscription channel A and forwarded to Pod1 that subscribes to it in real time. After receiving the message, Pod1 will parse the message and convert it into websocket message format, find the local map to obtain the connection socket, and send the new message A and new message B in websocket message format to the terminal corresponding to the corresponding user ID A through the websocket connection. In this way, the terminal can receive asynchronous messages generated by different Pods through the subscription method and the long connection method to avoid message loss. After the user obtains the real-time compilation feedback message in the terminal browser, he can choose to deploy the blockchain contract or debug the compilation task on the cloud server according to the real-time compilation feedback message.
[0196] The message format that Pod1 sends to the terminal through the websocket connection is a json string, which includes uuid (string), timestamp (int64), and info (string), which are the uuid of the message, the time when the message was generated, and the message content (json string).
[0197] From the above, it can be seen that the embodiment of the present application constructs a subscription channel corresponding to the user through a message subscription unit. The messages generated by each cloud computing unit are published to the corresponding subscription channel, and the terminal is connected to the query cloud computing unit through a long connection. When the message is published to the channel, the cloud computing unit subscribed to the subscription channel will receive the message to push the message to the terminal through a long connection. In this way, the message subscription unit can transmit the asynchronous compilation feedback messages generated by different editing cloud computing units to realize the asynchronous message function, avoid the loss of asynchronous messages, and improve the security and reliability of the compilation process.
[0198] To better implement the above method, an embodiment of the present application further provides a compilation device, which can be specifically integrated in an electronic device, and the electronic device can be a device such as a terminal or a server. Among them, the terminal can be a device such as a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, or a personal computer; the server can be a single server or a server cluster composed of multiple servers.
[0199] For example, in this embodiment, taking the compilation device specifically integrated in a cloud server as an example, the cloud server includes a message unit and multiple cloud computing units, and the method of the embodiment of the present application will be described in detail.
[0200] For instance, as Figure 4 shown, the compilation device may include an acquisition module 410, a sending module 420, and a query module 430, as follows:
[0201] (1) Acquisition module 410
[0202] The acquisition module is used to acquire the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the cloud computing unit for compilation, and the cloud computing unit for compilation is any cloud computing unit.
[0203] In some embodiments, the compilation task includes the compilation task of the blockchain contract. Generating a compilation feedback message according to the compilation result of the compilation task by the cloud computing unit for compilation includes: generating a compilation command of the blockchain contract through the cloud computing unit for compilation, and invoking the compiler corresponding to the compilation command; executing the compilation command through the compiler to obtain a compilation result; generating a compilation feedback message corresponding to the compilation result.
[0204] The acquisition module is further used to acquire the query request sent by the terminal, and determine the cloud computing unit for query associated with the terminal through the query request, and the cloud computing unit for query is any cloud computing unit.
[0205] In some embodiments, the query request is used to invoke the message query interface corresponding to the message cache unit, and the query request carries a first request identifier. The acquisition module is specifically used to: acquire the query request sent by the terminal, and invoke the query service interface through the query request; verify the first request identifier carried by the query request through the query service interface; when the verification of the first request identifier passes, determine the cloud computing unit for query associated with the terminal.
[0206] In some embodiments, the query request is used to subscribe to the message subscription unit. The query request includes a long connection request, and the long connection request carries a second request identifier. The obtaining module is specifically configured to: obtain the long connection request sent by the terminal; verify the second request identifier carried in the long connection request; when the verification of the second request identifier passes, establish a long connection between the terminal and the cloud computing unit for query through the long connection request.
[0207] (2) Sending module 420
[0208] The sending module is configured to send the compilation feedback message to the message unit, and the message unit includes at least one of a message cache unit and a message subscription unit.
[0209] In some embodiments, the compilation feedback message carries a task identifier corresponding to the compilation task. The message cache unit includes a cache queue, and the compilation device further includes a storage module. The storage module is configured to: obtain the storage list corresponding to the cache queue according to the task identifier; insert the compilation feedback message at the end of the storage list so as to obtain the compilation feedback message stored in the message cache unit from the head of the storage list.
[0210] The sending module is further configured to send the obtained compilation feedback message to the terminal so that the terminal processes the compilation task according to the compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0211] In some embodiments, the sending module is specifically configured to: send the real-time compilation feedback message to the terminal so that the terminal processes the compilation task according to the real-time compilation feedback message, and deploy the target application on the cloud server according to the compilation task.
[0212] (3) Query module 430
[0213] The query module is configured to, if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the cloud computing unit for query to obtain the compilation feedback message stored in the message cache unit.
[0214] In some embodiments, the query request carries a historical query message identifier. The query module is specifically configured to: if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the cloud computing unit for query; screen the real-time compilation feedback message from the obtained compilation feedback messages according to the historical query message identifier through the message query interface;
[0215] In some embodiments, the query request is generated according to the query period. The compilation device further includes a deletion module. The deletion module is configured to: delete the compilation feedback message stored in the message cache unit when no query request is received within a preset number of query periods.
[0216] The query module is further configured to, if the query request is for subscribing to a message subscription unit, query the message subscription unit corresponding to the subscription terminal by using the cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal.
[0217] In some embodiments, the query request carries a second request identifier, and the query module is specifically configured to: based on the second request identifier, query the message subscription unit corresponding to the subscription terminal by using the cloud computing unit; receive the compilation feedback message pushed by the message subscription unit corresponding to the terminal through the cloud computing unit used for querying.
[0218] In some embodiments, the compilation device further includes an unsubscribe module, and the unsubscribe module is configured to: according to the disconnection request sent by the terminal, disconnect the long connection between the terminal and the cloud computing unit used for querying; unsubscribe from the message subscription unit corresponding to the terminal subscribed by the cloud computing unit used for querying.
[0219] In specific implementation, each of the above units can be implemented as an independent entity, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation of each of the above units, reference can be made to the foregoing method embodiments, which will not be elaborated herein.
[0220] Thus, in the embodiments of the present application, the asynchronous compilation feedback messages generated by different editing cloud computing units are transmitted to the terminal through the message cache unit and the message subscription unit, avoiding the loss of asynchronous messages and improving the security and reliability of the compilation process.
[0221] The embodiments of the present application further provide an electronic device, which can be a device such as a terminal or a server. Among them, the terminal can be a mobile phone, a tablet computer, a smart Bluetooth device, a notebook computer, a personal computer, etc.; the server can be a single server or a server cluster composed of multiple servers, etc.
[0222] In some embodiments, the compilation device can also be integrated in multiple electronic devices. For example, the compilation device can be integrated in multiple servers, and the compilation method of the present application is implemented by multiple servers.
[0223] In this embodiment, the electronic device in this embodiment is taken as a cloud server as an example for detailed description. For example, as Figure 5 shown, it shows a schematic structural diagram of the cloud server involved in the embodiments of the present application. Specifically:
[0224] The cloud server may include a processor 510 with one or more processing cores, a memory 520 with one or more computer-readable storage media, a power supply 530, an input module 540, and a communication module 550 and other components. Those skilled in the art can understand, Figure 5The cloud server structure shown does not limit the cloud server, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Among them:
[0225] The processor 510 is the control center of the cloud server, connecting various parts of the entire cloud server through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 520, and calling the data stored in the memory 520, it executes various functions of the cloud server and processes data. In some embodiments, the processor 510 may include one or more processing cores; in some embodiments, the processor 510 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above modem processor may not be integrated into the processor 510 either.
[0226] The memory 520 can be used to store software programs and modules. The processor 510 executes various functional applications and data processing by running the software programs and modules stored in the memory 520. The memory 520 may mainly include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the cloud server. In addition, the memory 520 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 520 may also include a memory controller to provide the processor 510 with access to the memory 520.
[0227] The cloud server further includes a power supply 530 for powering each component. In some embodiments, the power supply 530 may be logically connected to the processor 510 through a power management system, so as to implement functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 530 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or an inverter, and a power status indicator.
[0228] The cloud server may further include an input module 540, which can be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.
[0229] The cloud server may further include a communication module 550. In some embodiments, the communication module 550 may include a wireless module, and the cloud server may perform short-range wireless transmission through the wireless module of the communication module 550, thereby providing users with wireless broadband Internet access. For example, the communication module 550 may be used to help users send and receive emails, browse web pages, and access streaming media, etc.
[0230] Although not shown, the cloud server may further include a display unit, etc., which will not be elaborated here. Specifically, in this embodiment, the processor 510 in the cloud server will load the executable files corresponding to the processes of one or more application programs into the memory 520 according to the following instructions, and the processor 510 will run the application programs stored in the memory 520 to implement various functions as follows:
[0231] Obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the compilation cloud computing unit, where the compilation cloud computing unit is any cloud computing unit; send the compilation feedback message to the message unit, and the message unit includes at least one of a message cache unit and a message subscription unit; obtain the query request sent by the terminal, and determine the query cloud computing unit associated with the terminal through the query request, where the query cloud computing unit is any cloud computing unit; if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit; if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; send the obtained compilation feedback message to the terminal so that the terminal processes the compilation task according to the compilation feedback message to deploy the target application on the cloud server according to the compilation task.
[0232] For the specific implementation of each of the above operations, reference may be made to the previous embodiments, which will not be elaborated here.
[0233] As can be seen from the above, in the embodiment of the present application, the asynchronous compilation feedback messages generated by different compilation cloud computing units are transmitted to the terminal through the message cache unit and the message subscription unit, avoiding the loss of asynchronous messages and improving the security and reliability of the compilation process.
[0234] Those of ordinary skill in the art can understand that all or part of the steps in the above various methods can be completed by instructions, or by controlling relevant hardware through instructions. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0235] To this end, an embodiment of the present application provides a computer-readable storage medium, which stores multiple instructions that can be loaded by a processor to execute the steps in any of the compilation methods provided by the embodiments of the present application. For example, the instructions can execute the following steps:
[0236] Obtain the compilation task of the target application sent by the terminal, and generate a compilation feedback message according to the compilation result of the compilation task by the cloud computing unit for compilation, where the cloud computing unit for compilation is any cloud computing unit; send the compilation feedback message to the message unit, where the message unit includes at least one of a message cache unit and a message subscription unit; obtain the query request sent by the terminal, and determine the cloud computing unit for query associated with the terminal through the query request, where the cloud computing unit for query is any cloud computing unit; if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the cloud computing unit for query to obtain the compilation feedback message stored in the message cache unit; if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the cloud computing unit for query to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; send the obtained compilation feedback message to the terminal so that the terminal processes the compilation task according to the compilation feedback message to deploy the target application on the cloud server according to the compilation task.
[0237] Among them, the storage medium may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), a magnetic disk, an optical disc, etc.
[0238] According to an aspect of the present application, there is provided a computer program product or a computer program, including a computer program or instructions, and when the computer program or instructions are executed by a processor, the steps in the methods provided in various optional implementation manners provided in the above embodiments are implemented. The computer program / instructions are stored in a computer-readable storage medium. The processor of the electronic device reads the computer program / instructions from the computer-readable storage medium, and the processor executes the computer program / instructions, so that the electronic device executes the methods provided in various optional implementation manners provided in the above embodiments.
[0239] Since the instructions stored in the storage medium can execute the steps in any of the compilation methods provided by the embodiments of the present application, the beneficial effects that can be achieved by any of the compilation methods provided by the embodiments of the present application can be realized. For details, see the previous embodiments and will not be elaborated here.
[0240] The above has introduced in detail a compilation method, device, electronic device, storage medium, and program product provided by embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation on the present application.
Claims
1. A compilation method, characterized in that Applied to a cloud server, the cloud server includes a message unit and a plurality of cloud computing units, and the method includes: Obtain a compilation task of a target application sent by a terminal, and generate a compilation feedback message according to the compilation result of the compilation task by a cloud computing unit for compilation, where the cloud computing unit for compilation is any one of the cloud computing units; Send the compilation feedback message to the message unit, where the message unit includes at least one of a message cache unit and a message subscription unit; Obtain a query request sent by the terminal, and determine a cloud computing unit for query associated with the terminal through the query request, where the cloud computing unit for query is any one of the cloud computing units; If the query request is used to call a message query interface corresponding to the message cache unit, call the message query interface through the cloud computing unit for query to obtain the compilation feedback message stored in the message cache unit; If the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the cloud computing unit for query to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; Send the obtained compilation feedback message to the terminal, so that the terminal processes the compilation task according to the compilation feedback message, and deploys the target application on the cloud server according to the compilation task.
2. The compilation method according to claim 1, characterized in that The compilation feedback message carries a task identifier corresponding to the compilation task, and the message cache unit includes a cache queue. After sending the compilation feedback message to the message unit, it further includes: Obtain a storage list corresponding to the cache queue according to the task identifier; Insert the compilation feedback message at the end of the storage list, so as to obtain the compilation feedback message stored in the message cache unit from the head of the storage list.
3. The compilation method according to claim 1, characterized in that The query request is used to call a message query interface corresponding to the message cache unit, and the query request carries a first request identifier. Obtaining the query request sent by the terminal and determining a cloud computing unit for query associated with the terminal through the query request includes: Obtain the query request sent by the terminal, and call a query service interface through the query request; Verify the first request identifier carried by the query request through the query service interface; When the verification of the first request identifier passes, determine the cloud computing unit for query associated with the terminal.
4. The compilation method according to claim 1, characterized in that The query request carries a historical query message identifier. If the query request is used to call a message query interface corresponding to the message cache unit, calling the message query interface through the cloud computing unit for query to obtain the compilation feedback message stored in the message cache unit includes: If the query request is used to call a message query interface corresponding to the message cache unit, call the message query interface through the cloud computing unit for query; Filter real-time compilation feedback messages from the obtained compilation feedback messages according to the historical query message identifier through the message query interface; Sending the obtained compilation feedback message to the terminal so that the terminal processes the compilation task according to the compilation feedback message, and deploying the target application on the cloud server according to the compilation task, includes: Sending the real-time compilation feedback message to the terminal so that the terminal processes the compilation task according to the real-time compilation feedback message, and deploying the target application on the cloud server according to the compilation task.
5. The compilation method according to claim 1, characterized in that The query request is generated according to a query period, and the method further includes: When the query request is not received within a preset number of query periods, deleting the compilation feedback message stored in the message cache unit.
6. The compilation method according to claim 1, characterized in that, The query request is used to subscribe to the message subscription unit. The query request includes a long connection request that carries a second request identifier. Obtaining the query request sent by the terminal and determining the query cloud computing unit associated with the terminal through the query request includes: Obtaining the long connection request sent by the terminal; Verifying the second request identifier carried by the long connection request; When the verification of the second request identifier passes, establishing a long connection between the terminal and the query cloud computing unit through the long connection request.
7. The compilation method according to claim 1, characterized in that The query request carries a second request identifier. If the query request is used to subscribe to the message subscription unit, subscribing to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal, includes: Based on the second request identifier, subscribing to the message subscription unit corresponding to the terminal through the query cloud computing unit; Receiving, through the query cloud computing unit, the compilation feedback message pushed by the message subscription unit corresponding to the terminal.
8. The compilation method according to claim 7, wherein, The method further includes: Disconnecting the long connection between the terminal and the query cloud computing unit according to the disconnection request sent by the terminal; Unsubscribing from the message subscription unit corresponding to the terminal subscribed by the query cloud computing unit.
9. The compilation method according to any one of claims 1 to 8, characterized in that, The compilation task includes a compilation task of a blockchain contract. Generating a compilation feedback message according to the compilation result of the compilation task by the compilation cloud computing unit includes: Generating, by the compilation cloud computing unit, a compilation command for the blockchain contract and invoking a compiler corresponding to the compilation command; Executing the compilation command by the compiler to obtain the compilation result; Generating the compilation feedback message corresponding to the compilation result.
10. A compilation device, characterized in that, Applied to a cloud server, the cloud server includes a message unit and multiple cloud computing units. The device includes: An obtaining module, configured to obtain a compilation task of a target application sent by a terminal, and generate a compilation feedback message according to the compilation result of the compilation task by a compilation cloud computing unit, where the compilation cloud computing unit is any one of the cloud computing units; A sending module, configured to send the compilation feedback message to the message unit, where the message unit includes at least one of a message cache unit and a message subscription unit; The obtaining module is further configured to obtain a query request sent by the terminal, and determine a query cloud computing unit associated with the terminal through the query request, where the query cloud computing unit is any one of the cloud computing units; The query module is configured to, if the query request is used to call the message query interface corresponding to the message cache unit, call the message query interface through the query cloud computing unit to obtain the compilation feedback message stored in the message cache unit; The query module is further configured to, if the query request is used to subscribe to the message subscription unit, subscribe to the message subscription unit corresponding to the terminal through the query cloud computing unit to obtain the compilation feedback message received by the message subscription unit corresponding to the terminal; The sending module is further configured to send the obtained compilation feedback message to the terminal, so that the terminal processes the compilation task according to the compilation feedback message, and deploys the target application on the cloud server according to the compilation task.
11. An electronic device, characterized in that, It includes a processor and a memory, and the memory stores multiple instructions; the processor loads the instructions from the memory to execute the steps in the compilation method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores multiple instructions, and the instructions are suitable for being loaded by a processor to execute the steps in the compilation method according to any one of claims 1 to 9.
13. A computer program product, comprising a computer program or instructions, characterized in that, When the computer program or instructions are executed by a processor, the steps in the compilation method according to any one of claims 1 to 9 are implemented.