A page update method, device, electronic device and storage medium
By listening to static resource update events in a serverless architecture, obtaining configuration data to generate candidate pages and updating local collections, network latency and flash problems in page rendering are solved, and efficient page loading and rendering is achieved.
Patent Information
- Application Number
- CN202110395083.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-13
- Publication Date
- 2025-06-13
- Estimated Expiration
- 2041-06-13
AI Technical Summary
In the prior art, page presentation often results in network delays and page flashes due to JS loading logic, and the direct service depends on the server load capacity, which is relatively expensive.
In a serverless architecture, by listening to the update event of static resources, obtaining static resource configuration data, generating candidate pages, and updating the local candidate page collection, avoiding the client pulling the page resource configuration for rendering.
This solution circumvents traditional server load problems, reduces costs, reduces network latency and page flash, and improves page loading speed and presentation quality.
Smart Images

Figure CN113239299B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet communication technologies, and in particular, to a page update method, apparatus, electronic device, and storage medium. Background Art
[0002] With the development of Internet communication technologies, more and more users obtain various information through the Internet. Internet products can meet users' information acquisition needs by presenting relevant pages to them. In related technologies, the following solutions can be used to implement page presentation on the client side. Solution 1): The client can pull page resource configurations through relevant interfaces to render and output pages. Solution 2): The client can obtain the rendered pages with the help of a direct output service for presentation. However, in Solution 1), the page presentation involved often has problems such as network latency and page flickering due to the loading logic for JS (JavaScript), and it is necessary to pull page resource configurations to render and output pages only after the execution of this script, thus unable to ensure the page loading speed and presentation quality. In Solution 2), the page presentation involved tests the server's load capacity and is accompanied by a relatively high cost. Summary of the Invention
[0003] In view of the above problems, this application provides a page update method, apparatus, electronic device, and storage medium that overcome the above problems or at least solve some of the above problems.
[0004] According to the first aspect of this application, a page update method is provided, which is applied to a serverless environment where a service constructed by a function chain is deployed. The method includes:
[0005] Listening for update events for static resources;
[0006] Obtaining corresponding static resource configuration data according to the listened update events;
[0007] Generating a candidate page based on the static resource configuration data;
[0008] Updating the local candidate page set according to the candidate page.
[0009] According to the second aspect of this application, a page update apparatus is provided, which is applied to a serverless environment where a service constructed by a function chain is deployed. The apparatus includes:
[0010] A listening module: used to listen for update events for static resources;
[0011] An obtaining module: used to obtain corresponding static resource configuration data according to the listened update events;
[0012] Generation module: configured to generate a candidate page based on the static resource configuration data;
[0013] Update module: configured to update the local candidate page set according to the candidate page.
[0014] According to a third aspect of the present application, there is provided an electronic device, which includes a processor and a memory. At least one instruction or at least one program segment is stored in the memory, and the at least one instruction or the at least one program segment is loaded and executed by the processor to implement the page update method as described in the first aspect.
[0015] According to a fourth aspect of the present application, there is provided a computer-readable storage medium, in which at least one instruction or at least one program segment is stored, and the at least one instruction or the at least one program segment is loaded and executed by a processor to implement the page update method as described in the first aspect.
[0016] According to a fifth aspect of the present application, there is provided a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the page update method as described in the first aspect.
[0017] A page update method, device, electronic device and storage medium provided by the present application have the following technical effects:
[0018] The page update solution provided by the present application is applied to a serverless environment. By listening for update events for static resources to obtain corresponding static resource configuration data, candidate pages are generated using the static resource configuration data and the local candidate page set is updated according to the candidate pages. The serverless deployment has services constructed by function chains, and the serverless is used to listen for updates of static resources to automatically update the local candidate page set. The use of serverless can avoid the load problems that need to be considered in traditional servers and can also reduce costs. Based on the local candidate page set, when the page is subsequently displayed, the client no longer needs to pull the page resource configuration for rendering, reducing the probability of problems such as network latency and page flickering, and improving the page loading speed and page presentation quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] To more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0020] Figure 1 It is a schematic diagram of an application environment provided by an embodiment of the present application;
[0021] Figure 2 It is a schematic flowchart of a page update method provided by an embodiment of the present application;
[0022] Figure 3 It is a schematic flowchart of obtaining corresponding static resource configuration data according to the monitored update event provided by an embodiment of the present application;
[0023] Figure 4 It is a schematic flowchart of generating a candidate page based on static resource configuration data provided by an embodiment of the present application;
[0024] Figure 5 It is a schematic flowchart of displaying a target page provided by an embodiment of the present application;
[0025] Figure 6 It is a schematic diagram of the interface of an activity page provided by an embodiment of the present application;
[0026] Figure 7 It is a schematic diagram of the user interface provided by the static resource management end in an embodiment of the present application;
[0027] Figure 8 It is a schematic diagram of a serverless architecture design provided by an embodiment of the present application;
[0028] Figure 9 It is also a schematic flowchart of displaying a target page provided by an embodiment of the present application;
[0029] Figure 10 It is a block diagram of the composition of a page update device provided by an embodiment of the present application;
[0030] Figure 11 It is a schematic diagram of a blockchain system provided by an embodiment of the present application;
[0031] Figure 12 It is a schematic diagram of a block structure provided by an embodiment of the present application;
[0032] Figure 13 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Detailed implementation manners
[0033] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to 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. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0034] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above accompanying drawings are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or server including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0035] Please refer to Figure 1 , Figure 1 which is a schematic diagram of an application environment provided by an embodiment of the present application. The application environment may include a client 10 and a server 20. The client 10 and the server 20 may be directly or indirectly connected through wired or wireless communication means. The server 20 monitors the update of static resources to automatically update the local candidate page set. When the client 10 displays a page, it requests a target page from the local candidate page set from the server for presentation. It should be noted that Figure 1 is only an example.
[0036] The client 10 may be a physical device such as a smart phone, a desktop computer, a tablet computer, a laptop computer, an augmented reality (AR) / virtual reality (VR) device, a digital assistant, a smart speaker, a smart wearable device, etc., or may be software running on the physical device, such as a computer program. The operating system corresponding to the client may be an Android system, an IOS system (a mobile operating system developed by Apple Inc.), a Linux (an operating system), a Microsoft Windows (a Microsoft Windows operating system), etc.
[0037] The server 20 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms. The server can include a network communication unit, a processor, a memory, etc. The server can provide background services for the corresponding client.
[0038] Among them, cloud computing refers to the delivery and usage model of IT infrastructure, which means obtaining the required resources in a on-demand and easily scalable manner through the network; generalized cloud computing refers to the delivery and usage model of services, which means obtaining the required services in a on-demand and easily scalable manner through the network. Such services can be related to IT and software, the Internet, or other services. Cloud computing is the product of the development and integration of traditional computer and network technologies such as Grid Computing, Distributed Computing, Parallel Computing, Utility Computing, Network Storage Technologies, Virtualization, and Load Balance.
[0039] In practical applications, the client 10 can be a browser, and the server 20 can adopt a serverless architecture design. The page rendered by the server and displayed by the client can be an active page, such as a lottery activity page, a festival activity page, etc.
[0040] The following introduces a specific embodiment of a page update method of the present application. Figure 2 It is a schematic flowchart of a page update method provided by an embodiment of the present application. The present application provides the method operation steps as described in the embodiment or flowchart, but based on routine or non-creative labor, it can include more or fewer operation steps. The step order listed in the embodiment is only one of the execution orders of many steps and does not represent the only execution order. When the actual system or product is executed, it can be executed in the order of the method shown in the embodiment or the drawings or executed in parallel (for example, in an environment of parallel processors or multi-threaded processing). Specifically, as Figure 2 shown, the method may include:
[0041] S201: Listen for update events for static resources;
[0042] In the embodiments of the present application, the server listens for update events for static resources. For example, Figure 8 as shown, the server can adopt a serverless architecture design, and a service constructed by a function chain is deployed in the serverless architecture design. Serverless refers to the concept of building and running applications without server management. Functions as a Service (FaaS) in serverless, as a new way of providing computing power, can no longer focus on server configuration and management, but focus on writing and uploading core business code. In practical applications, cloud functions providing relevant services can be used to listen for update events for static resources.
[0043] Static resources refer to resources developed using static web technologies, such as Hypertext Markup Language (Html) objects, JS (JavaScript) objects, Cascading Style Sheet (CSS) objects, etc. The object listened by the server can be a static resource pool storing multiple static resources. Update events for static resources include addition events of static resources in the static resource pool (such as adding static resource A that did not exist before), deletion events of static resources in the static resource pool (such as deleting static resource B that existed before), and change events of static resources in the static resource pool (such as changing the configuration information of static resource C that existed before).
[0044] As a possible implementation, the server can establish a listening relationship with the static resource pool using a preset interface, so as to listen for update notifications for static resources received by the preset interface. The server adopting the serverless architecture design does not need to care about underlying resources, nor does it need to log in to the server and optimize the server. The core code snippets are completely triggered by events or requests, and the service resources can be automatically adjusted in parallel according to requests. When the server is idle, it can not run any resources to save resources and costs, and can be deployed and executed immediately when an interface request is triggered.
[0045] In practical applications, when building a server environment, a cloud function providing relevant services can set a preset interface and expose the preset interface for other parties to call. The preset interface can be an Application Programming Interface (API). For the storage of multiple static resources in the static resource pool, a distributed storage service can be used, such as Cloud Object Storage (COS). Object storage is a distributed storage service without a directory hierarchy, without data format restrictions, capable of accommodating a large amount of data, and supporting access via the HTTP / HTTPS (HyperText Transfer Protocol / HyperText Transfer Security Protocol) protocol. The static resource pool can store multiple static resources in the form of a COS bucket. The server uses the preset interface to establish a listening relationship with the COS bucket, and can listen for changes in the static resources in the COS bucket by means of the update notification received through the preset interface, or can also listen for changes in the static resources in the COS bucket by means of the preset interface. Based on the changes in the static resources in the COS bucket monitored by the server, subsequent candidate page generation and local candidate page set update are triggered.
[0046] It should be noted that the implementation of "listening for changes in the static resources in the COS bucket by means of the update notification received through the preset interface" can be achieved in the following way: The static resources in the COS bucket are managed by a static resource management end, and the preset interface provided by the server can be called by the static resource management end. When the static resource management end executes the update of the static resources in the COS bucket in response to the received update request, the static resource management end can call the preset interface to send an update notification for the static resources. Correspondingly, the server listens for the update notification for the static resources received by the preset interface to learn that the static resources in the COS bucket have changed.
[0047] See Figure 7 , the static resource management end can provide a user interface for staff. The user interface can have interactive operation controls indicating configuration information updates. In response to the staff's triggering of the relevant interactive operation controls, the user interface displays the updated configuration information. The interactive operation controls indicating configuration information updates can include a selection operation control indicating color configuration, a drag-and-drop upload control indicating picture configuration, an input box control indicating information filling, etc.
[0048] Exemplarily, when storing multiple static resources, the static resource pool is based on the page dimension. Static resources pointing to different pages can be grouped and stored, and the same page identifier can be marked for static resources pointing to the same page. Combining the above-mentioned content related to the static resource management end and update notifications, a corresponding update notification can be generated when a static resource changes, or a corresponding update notification can be generated when at least two static resources pointing to the same page change within a preset time.
[0049] S202: Obtain the corresponding static resource configuration data according to the monitored update event;
[0050] In the embodiments of the present application, the server obtains the corresponding static resource configuration data according to the monitored update event. Considering that the static resource configuration data will be used to generate candidate pages later, when the corresponding static resource configuration data obtained according to the monitored update event does not point to the same page, the static resource configuration data can be split based on the page dimension. When the monitored update event is the above-mentioned new event, determine the newly added static resource A, and then obtain the static resources that also point to the same page based on the page pointed to by the static resource A to obtain the corresponding static resource data (including the relevant data of the static resource A). When the monitored update event is the above-mentioned deletion event, determine the deleted static resource B, and then obtain the static resources that also point to the same page based on the page pointed to by the static resource B to obtain the corresponding static resource data (excluding the relevant data of the static resource B). When the monitored update event is the above-mentioned change event, determine the changed static resource C, and then obtain the static resources that also point to the same page based on the page pointed to by the static resource C to obtain the corresponding static resource data (including the relevant data of the static resource C).
[0051] As a possible implementation, as Figure 3 shown, the obtaining of the corresponding static resource configuration data according to the monitored update event includes:
[0052] S301: Determine the specified page element whose configuration information is updated according to the monitored update event;
[0053] S302: Determine the corresponding candidate page identifier based on the specified page element;
[0054] S303: Determine the page template file indicated by the candidate page identifier and the page configuration file describing the configuration information of the relevant page elements;
[0055] S304: Obtain the static resource configuration data based on the updated configuration information corresponding to the specified page element, the page template file, and the page configuration file.
[0056] The static resources pointing to a candidate page can be composed of independent page elements. Considering the efficiency of page development and maintenance or the style consistency of the target website pages, the static resources pointing to a candidate page can be composed of a page template and independent page elements. Page elements can be text, pictures, videos, floating windows, pop-up windows, etc.
[0057] For example, the static resources pointing to candidate page 1 include page template A, page element a, page element b, and page element c. 1) When the monitored update event is the above-mentioned addition event, determine that the newly added static resource is page element d, and the configuration information update that occurs to page element d is from none to existing. Based on page element d, determine the corresponding candidate page identifier, such as the identifier pointing to candidate page 1. Then determine the page template file (corresponding to page template A) and page configuration file (corresponding to page elements a, b, and c) indicated by the identifier of candidate page 1. The static resource configuration data then includes the updated configuration information corresponding to page element d, the page template file, and the page configuration file. 2) When the monitored update event is the above-mentioned deletion event, determine that the deleted static resource is page element a, and the configuration information update that occurs to page element a is from existing to none. Based on page element a, determine the corresponding candidate page identifier, such as the identifier pointing to candidate page 1. Then determine the page template file (corresponding to page template A) and page configuration file (corresponding to page elements b and c) indicated by the identifier of candidate page 1. The static resource configuration data then includes the updated configuration information corresponding to page element a, the page template file, and the page configuration file. 3) When the monitored update event is the above-mentioned change event, determine that the changed static resource is page element b, and the configuration information update that occurs to page element b is from the original information to the current information. Based on page element b, determine the corresponding candidate page identifier, such as the identifier pointing to candidate page 1. Then determine the page template file (corresponding to page template A) and page configuration file (corresponding to page elements a and c) indicated by the identifier of candidate page 1. The static resource configuration data then includes the updated configuration information (current information) corresponding to page element b, the page template file, and the page configuration file.
[0058] In practical applications, as Figure 6 shown, the candidate page can be an activity page, and users can participate in page activities and perform operations such as lottery draws. For different festivals and purposes, different styles of content can be designed to achieve different page effects, and the customization of the activity page can be realized.
[0059] Of course, large chunks of the activity content can be extracted and solidified to form a page template, while the title, copywriting, overall color tone, border, prizes, etc. can be configured separately. The page content can be divided into template content and configurable content. The template content is extracted to form a page template, and the configurable content, as individual page elements, can accept updates to the configuration information. The colors, pictures, etc. involved in the page elements can be defined using a style sheet. This can enable the rapid launch of activities and reduce the development volume. Combining with the static resource management terminal mentioned in the foregoing step S201, the updates to the configuration information received by the page elements can come from the static resource management terminal, and the staff can achieve real-time editing of the relevant static resources at the static resource management terminal. The static resource management terminal can provide a notification interface for changes in the relevant static resource configuration data to the server.
[0060] S203: Generate a candidate page based on the static resource configuration data;
[0061] In the embodiment of the present application, the server generates a candidate page based on the static resource configuration data. Since the static resources are resources developed using static web technologies such as Html objects, JS objects, CSS objects, etc., the static resource configuration data is the configuration data of these static resources. The process of generating a candidate page using the static resource configuration data can be referred to as follows: Parse the HTML document and convert each tag into a DOM node on the DOM tree (content tree; DOM is the abbreviation of Document Object Model) one by one. The DOM tree is a tree structure composed of DOM elements and attribute nodes. Parse the CSS object and the style data in the style element to obtain a CSS rule tree. Combine the CSS rule tree and the DOM tree to generate a presentation tree (rendering tree). After the presentation tree is constructed, layout and drawing are performed on the presentation tree to obtain the candidate page.
[0062] As a possible implementation, as Figure 4 shown, the generating a candidate page based on the static resource configuration data includes:
[0063] S401: Obtain a preset script file;
[0064] S402: Render the static resource configuration data using the preset script file to obtain the candidate page.
[0065] First, obtain a preset script file, which can be used for page initialization. Then, use the preset script file to render the static resource configuration data to construct a candidate page. Rendering the static resource configuration data in the preset script file on the server side can obtain a candidate page through one-time rendering. The attributes of the static resource configuration data also ensure the smoothness and timeliness of the rendering execution. Combining the relevant records in the foregoing steps S301 to S304, this can facilitate the transformation and extraction of all configurable content, enabling all content such as text and pictures to be extracted into the preset script file for rendering, achieving variableization.
[0066] Exemplarily, an initial page can be constructed using a preset script file and a page template file; then, the updated configuration information and page configuration file are injected into the initial page in the form of a plugin to obtain a candidate page.
[0067] When performing page rendering, read the global configuration information and use the injected variables at each variable location. Completing the rendering of the candidate page on the server side can improve the efficiency of subsequent page display on the client side. The server reads the configuration data directly output by the page for rendering, and the client no longer needs to pull the page resource configuration for rendering, which can avoid the occurrence of page flickering.
[0068] S204: Update the local candidate page set according to the candidate page.
[0069] In the embodiment of the present application, the server updates the local candidate page set according to the candidate page. For example, each candidate page in the local candidate page set has a corresponding candidate page identifier. If the candidate page identifier pointed to by candidate page 2 obtained from the foregoing step S203 is not existing, then add candidate page 2 to the local candidate page set to complete the update of the set. If the candidate page identifier pointed to by candidate page 2 obtained from the foregoing step S203 is existing, then when adding candidate page 2 to the local candidate page set, it is necessary to remove the existing candidate page pointing to the same candidate page identifier as candidate page 2 from the local candidate page set to complete the update of the set.
[0070] As a possible implementation, as Figure 5 shown, the method further includes:
[0071] S205: Receive a page display request carried with a target page identifier sent by the client;
[0072] S206: Determine a target page corresponding to the target page identifier from the local candidate page set;
[0073] S207: Send the target page to the client so that the client displays the target page.
[0074] See Figure 9 When the client sends a page display request carrying a target page identifier to the server, the server finds the target page corresponding to the target page identifier in the local candidate page set, and the server returns the target page to the client. The target page is already rendered, and the client can directly output the target page, which can greatly shorten the page loading time. While the page experience is optimized, the traffic of related interfaces is also reduced. When the user accesses relevant pages using the client, the client can obtain the page showing the final rendering effect from the server and display it, which also improves the user experience.
[0075] In practical applications, the server can deploy multiple content distribution nodes to build a content distribution network, and the content distribution network is used to store the local candidate page set. When receiving the page display request sent by the client, the content distribution network determines the corresponding page to return to the client. The application of the content distribution network can distribute the content from the server center to the server edge close to the user, so as to achieve distributed and proximity access to the content. The utilization of the content distribution network further improves the efficiency of the client to obtain the target page and improves the quality of providing page access services for users. At the same time, the utilization of the content distribution network can ensure the support for large-scale concurrent access capabilities.
[0076] As can be seen from the technical solutions provided by the embodiments of the present application above, the page update solution provided by the embodiments of the present application is applied to a serverless environment. By listening for update events for static resources to obtain corresponding static resource configuration data, candidate pages are generated using the static resource configuration data and the local candidate page set is updated according to the candidate pages. The serverless environment is deployed with a service constructed by a function chain, and the serverless environment is used to listen for updates of static resources to automatically update the local candidate page set. The use of serverless can avoid the load problems that need to be considered in traditional servers and can also reduce costs. Based on the local candidate page set, when performing page display subsequently, the client no longer needs to pull page resource configurations for rendering, nor does it need to set up page resource pull interfaces that occupy system service resources, reducing the probability of problems such as network latency and page flickering, and improving the page loading speed and page rendering quality.
[0077] The embodiments of the present application also provide a page update device, as Figure 10 shown. The page update device 10 is applied to a serverless environment, and the serverless environment is deployed with a service constructed by a function chain. The page update device 10 includes:
[0078] A listening module 101: configured to listen for update events for static resources;
[0079] Acquisition module 102: configured to acquire corresponding static resource configuration data according to the monitored update event;
[0080] Generation module 103: configured to generate a candidate page based on the static resource configuration data;
[0081] Update module 104: configured to update the local candidate page set according to the candidate page.
[0082] As a possible implementation, the apparatus further includes:
[0083] Receiving module: configured to receive a page display request carrying a target page identifier sent by a client;
[0084] Determination module: configured to determine a target page corresponding to the target page identifier from the local candidate page set;
[0085] Sending module: configured to send the target page to the client so that the client displays the target page.
[0086] As a possible implementation, the apparatus further includes: Deployment module: configured to deploy multiple content distribution nodes to build a content distribution network;
[0087] The sending module includes: Sending unit: configured to send the target page to the client by using the content distribution network.
[0088] As a possible implementation, the apparatus further includes: Establishment module: configured to establish a monitoring relationship with a static resource pool by using a preset interface;
[0089] The monitoring module includes: Monitoring unit: configured to monitor update notifications for static resources received by the preset interface.
[0090] As a possible implementation, the acquisition module includes:
[0091] Designated page element determination unit: configured to determine a designated page element whose configuration information is updated according to the monitored update event;
[0092] Candidate page identifier determination unit: configured to determine a corresponding candidate page identifier based on the designated page element;
[0093] File determination unit: configured to determine a page template file indicated by the candidate page identifier and a page configuration file describing configuration information of related page elements;
[0094] Data acquisition unit: configured to obtain the static resource configuration data based on the updated configuration information corresponding to the designated page element, the page template file, and the page configuration file.
[0095] As a possible implementation, the generating module includes:
[0096] A script file acquisition unit: configured to acquire a preset script file;
[0097] A rendering unit: configured to render the static resource configuration data by using the preset script file to obtain the candidate page.
[0098] As a possible implementation, the rendering unit includes:
[0099] An initial page construction unit: configured to construct an initial page by using the preset script file and the page template file;
[0100] An injection unit: configured to inject the updated configuration information and the page configuration file into the initial page in a plug-in manner to obtain the candidate page.
[0101] It should be noted that the device in the device embodiment and the method embodiment are based on the same inventive concept.
[0102] The system involved in the embodiments of the present application may be a distributed system formed by connecting a client and multiple nodes (any form of computing device accessing the network, such as a server, a user terminal) through network communication.
[0103] Taking the distributed system as a blockchain system as an example, refer to Figure 11 , Figure 11 is an optional structural schematic diagram of the distributed system 100 provided by the embodiments of the present application applied to the blockchain system, formed by multiple nodes (any form of computing device accessing the network, such as a server, a user terminal) and a client. A peer-to-peer (P2P) network is formed between the nodes. The P2P protocol is an application layer protocol running on top of the Transmission Control Protocol (TCP). In a distributed system, any machine such as a server or a terminal can join and become a node. A node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.
[0104] Refer to Figure 11 shows the functions of each node in the blockchain system. The functions involved include:
[0105] 1) Routing, a basic function of a node, used to support communication between nodes.
[0106] In addition to the routing function, a node may also have the following functions:
[0107] 2) An application, which is used to be deployed in a blockchain, implements specific business according to actual business requirements, records data related to the implemented functions to form recorded data, carries a digital signature in the recorded data to indicate the source of the task data, and sends the recorded data to other nodes in the blockchain system. When other nodes verify the source and integrity of the recorded data successfully, the recorded data is added to a temporary block.
[0108] For example, the business implemented by the application includes:
[0109] 2.1) A wallet, which is used to provide the function of conducting electronic currency transactions, including initiating a transaction (that is, sending the transaction record of the current transaction to other nodes in the blockchain system. After other nodes verify successfully, as a response to acknowledging the validity of the transaction, the recorded data of the transaction is deposited into the temporary block of the blockchain. Of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;
[0110] 2.2) A shared ledger, which is used to provide functions such as storage, query, and modification of account data. The recorded data of the operations on the account data is sent to other nodes in the blockchain system. After other nodes verify its validity, as a response to acknowledging the validity of the account data, the recorded data is deposited into the temporary block, and can also send a confirmation to the node that initiated the operation.
[0111] 2.3) A smart contract, which is a computerized protocol that can execute the terms of a certain contract. It is implemented through code deployed on the shared ledger and executed when certain conditions are met. According to actual business requirements, the code is used to complete automated transactions, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.
[0112] 3) A blockchain includes a series of blocks (Blocks) that are sequentially connected in the order of generation. Once a new block is added to the blockchain, it will not be removed again. The block records the recorded data submitted by nodes in the blockchain system.
[0113] See Figure 12 , Figure 12This is an optional schematic diagram of the block structure provided by the embodiments of the present application. Each block includes the hash value of the transaction records stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected through the hash value to form a blockchain. In addition, the block may further include information such as a timestamp when the block is generated. A blockchain, in essence, is a decentralized database, a series of data blocks generated by using cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.
[0114] The embodiments of the present application provide an electronic device, which includes a processor and a memory. At least one instruction or at least one program segment is stored in the memory, and the at least one instruction or the at least one program segment is loaded and executed by the processor to implement the page update method provided by the above method embodiments.
[0115] Furthermore, Figure 13 It shows a schematic diagram of the hardware structure of an electronic device for implementing the page update method provided by the embodiments of the present application. The electronic device may participate in forming or include the page update device provided by the embodiments of the present application. As Figure 13 shown, the electronic device 130 may include one or more (shown as 1302a, 1302b,..., 1302n in the figure) processors 1302 (the processor 1302 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1304 for storing data, and a transmission device 1306 for communication functions. In addition, it may further include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, a power supply, and / or a camera. Those of ordinary skill in the art can understand that Figure 13 the structure shown is only schematic and does not limit the structure of the above electronic device. For example, the electronic device 130 may further include more or fewer components than Figure 13 shown, or have a different configuration from Figure 13 shown.
[0116] It should be noted that one or more of the above-mentioned processors 1302 and / or other data processing circuits can generally be referred to as "data processing circuits" herein. The data processing circuit can be embodied in software, hardware, firmware, or any combination thereof, in whole or in part. In addition, the data processing circuit can be a single independent processing module, or be incorporated in whole or in part into any one of the other components in the electronic device 130 (or mobile device). As involved in the embodiments of the present application, the data processing circuit is a kind of processor control (such as the selection of a variable resistance terminal path connected to an interface).
[0117] The memory 1304 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the page update method described in the embodiments of the present application. The processor 1302 executes various functional applications and data processing by running the software programs and modules stored in the memory 134, that is, to implement the above-mentioned page update method. The memory 1304 can include a high-speed random access memory, and can also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memories. In some instances, the memory 1304 can further include a memory remotely disposed relative to the processor 1302, and these remote memories can be connected to the electronic device 130 through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0118] The transmission device 1306 is used to receive or send data via a network. Specific examples of the above-mentioned network can include a wireless network provided by a communication provider of the electronic device 130. In one instance, the transmission device 1306 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station and thus can communicate with the Internet. In one embodiment, the transmission device 1306 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0119] The display can be, for example, a touch-screen liquid crystal display (LCD), which enables a user to interact with the user interface of the electronic device 130 (or mobile device).
[0120] The embodiments of the present application also provide a computer-readable storage medium, which can be disposed in the electronic device to store at least one instruction or at least one segment of a program related to implementing a page update method in the method embodiments. The at least one instruction or the at least one segment of the program is loaded and executed by the processor to implement the page update method provided in the above method embodiments.
[0121] Optionally, in this embodiment, the above storage medium may be located in at least one of multiple network servers in a computer network. Optionally, in this embodiment, the above storage medium may include, but is not limited to: various media that can store program codes such as USB flash drives, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), mobile hard disks, magnetic disks, or optical discs.
[0122] It should be noted that: the above sequence of embodiments of the present application is only for description and does not represent the superiority or inferiority of the embodiments. And the above specific embodiments of the present application have been described. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be executed in a different order than in the embodiments and still achieve the desired results. Additionally, the processes depicted in the drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0123] Each embodiment in this application is described in a progressive manner. The same or similar parts among the embodiments can be referred to each other, and the differences between each embodiment and other embodiments are emphasized. In particular, for the device and electronic device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0124] Those of ordinary skill in the art can understand that all or part of the steps to implement the above embodiments can be completed by hardware or by a program instructing relevant hardware. The program can be stored in a computer-readable storage medium, and the above-mentioned storage medium can be a read-only memory, a magnetic disk, or an optical disc, etc.
[0125] The above are only the preferred embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A page update method, characterized in that, applied to a serverless environment where the serverless is deployed with a service constructed by a function chain, the method comprising: Listening for update events for static resources, and the static resource pool stores multiple static resources grouped by page dimension; Obtaining corresponding static resource configuration data according to the listened update events; Generating a candidate page based on the static resource configuration data; Updating the local candidate page set according to the candidate page; Wherein, the method further comprises: in the case of deploying multiple content distribution nodes to construct a content distribution network, using the content distribution network to receive a page display request sent by a client carrying a target page identifier; using the content distribution network to determine a target page corresponding to the target page identifier from the local candidate page set; using the content distribution network to send the target page to the client so that the client can display the target page, and the local candidate page set is stored by the content distribution network; The obtaining corresponding static resource configuration data according to the listened update events includes: determining a specified page element with updated configuration information according to the listened update event; determining a corresponding candidate page identifier based on the specified page element; determining a page template file indicated by the candidate page identifier and a page configuration file describing the configuration information of relevant page elements; obtaining the static resource configuration data based on the updated configuration information corresponding to the specified page element, the page template file, and the page configuration file; The generating a candidate page based on the static resource configuration data includes: obtaining a preset script file; using the preset script file to render the static resource configuration data to obtain the candidate page.
2. The method according to claim 1, characterized in that: Before the listening for update events for static resources, the method further comprises: Establishing a listening relationship with the static resource pool using a preset interface; The listening for update events for static resources includes: Listening for update notifications for static resources received by the preset interface.
3. The method according to claim 1, characterized in that, The using the script file to render the static resource configuration data to obtain the candidate page includes: Constructing an initial page using the preset script file and the page template file; Injecting the updated configuration information and the page configuration file into the initial page in the form of a plugin to obtain the candidate page.
4. A page update device, characterized in that, applied to a serverless environment where the serverless is deployed with a service constructed by a function chain, the device comprising: A listening module: for listening for update events for static resources, and the static resource pool stores multiple static resources grouped by page dimension; An obtaining module: for obtaining corresponding static resource configuration data according to the listened update events; A generating module: for generating a candidate page based on the static resource configuration data; An updating module: for updating the local candidate page set according to the candidate page; Wherein, the device further includes: a receiving module: configured to, when deploying multiple content distribution nodes to build a content distribution network, receive a page display request carrying a target page identifier sent by a client by using the content distribution network; a determining module: configured to determine a target page corresponding to the target page identifier from the local candidate page set by using the content distribution network; a sending module: configured to send the target page to the client by using the content distribution network, so that the client displays the target page, and the local candidate page set is stored by the content distribution network; The obtaining module includes: a specified page element determining unit: configured to determine a specified page element for which configuration information is updated according to a monitored update event; a candidate page identifier determining unit: configured to determine a corresponding candidate page identifier based on the specified page element; a file determining unit: configured to determine a page template file indicated by the candidate page identifier and a page configuration file describing configuration information of related page elements; a data obtaining unit: configured to obtain the static resource configuration data based on the updated configuration information corresponding to the specified page element, the page template file, and the page configuration file; The generating module includes: a script file obtaining unit: configured to obtain a preset script file; a rendering unit: configured to render the static resource configuration data by using the preset script file to obtain the candidate page.
5. The device according to claim 4, wherein, the device further includes: a establishing module: configured to establish a monitoring relationship with the static resource pool by using a preset interface; The monitoring module includes: a monitoring unit: configured to monitor an update notification for a static resource received by the preset interface.
6. The device according to claim 4, wherein, the rendering unit includes: an initial page building unit: configured to build an initial page by using the preset script file and the page template file; an injection unit: configured to inject the updated configuration information and the page configuration file into the initial page in a plug-in manner to obtain the candidate page.
7. An electronic device, wherein, the electronic device includes a processor and a memory, and at least one instruction or at least one segment of program is stored in the memory, and the at least one instruction or the at least one segment of program is loaded and executed by the processor to implement the page update method according to any one of claims 1-3.
8. A computer-readable storage medium, wherein, at least one instruction or at least one segment of program is stored in the storage medium, and the at least one instruction or the at least one segment of program is loaded and executed by a processor to implement the page update method according to any one of claims 1-3.
Citation Information
Patent Citations
Page resource loading method and device, computer equipment and storage medium
CN110647700A
Event driving method and apparatus
US20200364098A1