Data acquisition method and device, storage medium and electronic equipment
By determining the operation type of the subset of nodes in the data acquisition request and processing asynchronously, the problem of low data acquisition efficiency in the prior art is solved, and efficient acquisition of the target distributed server data is achieved.
Patent Information
- Application Number
- CN202310688450.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-09
- Publication Date
- 2024-12-10
- Estimated Expiration
- 2043-06-09
AI Technical Summary
Existing data acquisition methods have problems with low operation efficiency in data sets, especially when monitoring changes in data subsets, the entire data set needs to be repeatedly configured, resulting in inefficiency.
By receiving data acquisition requests, we determine the type of data acquisition operation performed by the subset of nodes in the target node set, and send data operation requests asynchronously in the request queue, avoiding repeated operations on the entire data set in the same way, improving data Obtain efficiency.
It realizes efficient acquisition of data in the target distributed server, reduces the average delay and processing delay of data acquisition operations, and improves the operation efficiency of data acquisition.
Smart Images

Figure CN119105879A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computers, and in particular to a data acquisition method and device, a storage medium and an electronic device. Background Art
[0002] When developers develop methods to obtain data from a data storage server, the operation granularity is usually the entire data set. However, in many cases, actual development needs do not require the same operation configuration for the entire data set. For example, data change monitoring is performed on a target data subset of a target data set.
[0003] However, since there is usually a hierarchical relationship between different data subsets in a data set, in the process of monitoring data changes for the lowest-level data subset, it is usually necessary to configure monitoring operations for changes in data subsets at other levels, which will seriously affect the efficiency of data acquisition. In other words, the existing data acquisition method has the technical problem of low operation efficiency.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a data acquisition method and device, a storage medium and an electronic device, so as to at least solve the technical problem that the existing data acquisition method has low operation efficiency.
[0006] According to one aspect of an embodiment of the present invention, a data acquisition method is provided, comprising: receiving a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a node set stored in a target distributed server; in a case where the target node data is not acquired from a reference node set stored locally, determining an operation type of a data acquisition operation performed on at least one node subset in the target node set according to request description information carried in the data acquisition request, wherein the reference node set is a node set constructed according to a data set pre-returned by the target distributed server; according to the operation type of the data acquisition operation, adding a data operation request corresponding to the at least one node subset to a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and sending the target node data returned by the target distributed server according to the data operation request.
[0007] According to another aspect of an embodiment of the present invention, a data acquisition device is also provided, including: a receiving unit, used to receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a node set stored in a target distributed server; a determining unit, used to determine, when the target node data is not acquired from a reference node set stored locally, an operation type of a data acquisition operation performed on at least one node subset in the target node set according to request description information carried in the data acquisition request, and the reference node set is a node set constructed according to a data set pre-returned by the target distributed server; an asynchronous processing unit, used to add a data operation request corresponding to the at least one node subset in a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and a sending unit, used to send the target node data returned by the target distributed server according to the data operation request.
[0008] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above data acquisition method when running.
[0009] According to another aspect of the embodiments of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer instruction being stored in a computer-readable storage medium. A processor of a computer device reads the computer program / instruction from the computer-readable storage medium, and the processor executes the computer program / instruction, so that the computer device executes the above data acquisition method.
[0010] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data acquisition method through the computer program.
[0011] In an embodiment of the present invention, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a node set stored in a target distributed server; in the case that the target node data is not acquired from a reference node set stored locally, an operation type of a data acquisition operation performed on at least one node subset in the target node set is determined based on request description information carried in the data acquisition request, wherein the reference node set is a node set constructed based on a data set pre-returned by the target distributed server; based on the operation type of the data acquisition operation, a data operation request corresponding to at least one node subset is added to a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and the target node data returned by the target distributed server based on the data operation request is sent, thereby achieving acquisition of data in the target distributed server.
[0012] In the above-mentioned implementation mode of the present application, the received data acquisition request may include specific request description information, which carries the operation type of the data acquisition operation corresponding to each of the multiple node subsets in the target node set, and then the node subsets are refined according to the operations corresponding to each of the node subsets, thereby avoiding repeated acquisition operations for the entire target node set using the same acquisition method, thereby improving data acquisition efficiency; in addition, in the above-mentioned implementation mode, the data to be acquired can be queried locally first, and if the data is not found, a data acquisition request can be sent to the target distributed server, thereby improving and reducing the average delay of the data acquisition operation; in addition, corresponding operation requests are added to the request queue for the operation type of the data acquisition operation, thereby realizing asynchronous processing of the data acquisition request, avoiding processing delays caused by high-concurrency processing processes, improving the operational efficiency of the data acquisition operation, and solving the technical problem of low operational efficiency of the existing data acquisition method. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0014] Figure 1 is a schematic diagram of a hardware environment of an optional data acquisition method according to an embodiment of the present invention;
[0015] Figure 2 is a flow chart of an optional data acquisition method according to an embodiment of the present invention;
[0016] Figure 3 is a schematic diagram of an optional data acquisition method according to an embodiment of the present invention;
[0017] Figure 4 is a schematic diagram of another optional data acquisition method according to an embodiment of the present invention;
[0018] Figure 5 is a flowchart of another optional data acquisition method according to an embodiment of the present invention;
[0019] Figure 6 is a flowchart of another optional data acquisition method according to an embodiment of the present invention;
[0020] Figure 7 is a flowchart of another optional data acquisition method according to an embodiment of the present invention;
[0021] Figure 8 is a schematic structural diagram of an optional data acquisition device according to an embodiment of the present invention;
[0022] Fig. 9 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0023] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0024] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] The following is an explanation of the technical terms used in this application:
[0026] Cloud storage is a new concept that extends and develops from the concept of cloud computing. A distributed cloud storage system (hereinafter referred to as storage system) refers to a storage system that uses cluster applications, grid technology, and distributed storage file systems to bring together a large number of different types of storage devices (storage devices are also called storage nodes) in the network through application software or application interfaces to work together and provide external data storage and business access functions.
[0027] At present, the storage method of the storage system is: create a logical volume, and when creating a logical volume, allocate physical storage space for each logical volume. The physical storage space may be composed of disks of a storage device or several storage devices. The client stores data on a logical volume, that is, stores the data on the file system. The file system divides the data into many parts, each of which is an object. The object contains not only data but also additional information such as data identification (ID, ID entity). The file system writes each object to the physical storage space of the logical volume, and the file system records the storage location information of each object, so that when the client requests to access the data, the file system can allow the client to access the data according to the storage location information of each object;
[0028] The process of allocating physical storage space to a logical volume by the storage system is as follows: according to the estimated capacity of the objects stored in the logical volume (the estimated capacity is often much larger than the actual capacity of the objects to be stored) and the grouping of the Redundant Array of Independent Disks (RAID), the physical storage space is pre-divided into stripes. A logical volume can be understood as a stripe, thereby allocating physical storage space to the logical volume;
[0029] ZK: short for zookeeper server;
[0030] ZK path: The data stored in zk is stored in a tree format. In addition to child nodes, each node can also store a string of data. The data nodes stored on zk can be identified through the zk path;
[0031] Incremental event: refers to turning the child node or data change of the path on zk into an incremental event. The incremental event describes the changes on the zk path generated by this zk event. For example, a child node is added or deleted.
[0032] Watch callback: refers to a callback for an event change set for a specified zk path through the zk interaction protocol;
[0033] Unwatch: means marking a zk path as uninteresting. When receiving events from this path again, no related processing will be performed.
[0034] Zk events: refers to events that occur on Zk, such as child node changes, data changes, path deletions, session timeouts, etc.
[0035] According to one aspect of an embodiment of the present invention, a data acquisition method is provided. As an optional implementation, the data acquisition method can be applied to, but is not limited to, Figure 1 The data acquisition system in the hardware environment shown in FIG. 1 includes, but is not limited to, a terminal device 102, a network 104, a server 106, and a database 108. The terminal device 102 runs a target client (such as Figure 1 As shown, the target client is an application client that can obtain target node data from the node set in the target server as an example). The above-mentioned terminal device 102 includes a human-computer interaction screen, a processor and a memory. The human-computer interaction screen is used to display the data acquisition operation interface, and is also used to provide a human-computer interaction interface to receive human-computer interaction operations for controlling the controlled virtual characters in the virtual scene. The processor is used to generate an interaction instruction in response to the above-mentioned human-computer interaction operation, and send the data operation request corresponding to the interaction instruction to the server. The memory is used to store the node set constructed by the data set returned in advance by the target distributed server.
[0036] In addition, the server 106 includes a processing engine, which is used to perform storage or reading operations on the database 108. Specifically, the processing engine reads the node data of each node in the node set from the database 108.
[0037] Assumptions Figure 1 A client for acquiring target node data is run in the terminal device 102 in the embodiment. The specific process of this embodiment is as follows: as in steps S102 to S106, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a node set stored in a target distributed server; in the case that the target node data is not acquired from a reference node set stored locally, an operation type of a data acquisition operation performed on at least one node subset in the target node set is determined according to request description information carried in the data acquisition request, wherein the reference node set is a node set constructed according to a data set pre-returned by the target distributed server; according to the operation type of the data acquisition operation, a data operation request corresponding to at least one node subset is added to a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server;
[0038] Then, as in step S108, the terminal device 102 sends a data operation request to the server 106 via the network 104. The server 106 executes steps S110 and S112, searches the target node set for target node data that matches the data operation request, and sends the target node data to the terminal device 102 via the network 104. Finally, the terminal device 102 executes step S114 to send the target node data returned by the target distributed server according to the data operation request.
[0039] Optionally, in this embodiment, the terminal device 102 may be a terminal device configured with a target client, which may include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client may be a client that supports providing shooting game tasks, such as a video client, an instant messaging client, a browser client, an educational client, etc. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, WIFI, and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and this embodiment does not make any limitation to this.
[0040] The server can be an independent physical server, or a server cluster or 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, and big data and artificial intelligence platforms. The terminal can be a smart phone, tablet computer, laptop computer, desktop computer, smart speaker, smart watch, etc., but is not limited to this. The terminal and the server can be directly or indirectly connected via wired or wireless communication, which is not limited in this application.
[0041] In an embodiment of the present invention, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a node set stored in a target distributed server; in the case that the target node data is not acquired from a reference node set stored locally, an operation type of a data acquisition operation performed on at least one node subset in the target node set is determined based on request description information carried in the data acquisition request, wherein the reference node set is a node set constructed based on a data set pre-returned by the target distributed server; based on the operation type of the data acquisition operation, a data operation request corresponding to at least one node subset is added to a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and the target node data returned by the target distributed server based on the data operation request is sent, thereby achieving acquisition of data in the target distributed server.
[0042] In the above-mentioned implementation mode of the present application, the received data acquisition request may include specific request description information, which carries the operation type of the data acquisition operation corresponding to each of the multiple node subsets in the target node set, and then the node subsets are refined according to the operations corresponding to each of the node subsets, thereby avoiding repeated acquisition operations for the entire target node set using the same acquisition method, thereby improving data acquisition efficiency; in addition, in the above-mentioned implementation mode, the data to be acquired can be queried locally first, and if the data is not found, a data acquisition request can be sent to the target distributed server, thereby improving and reducing the average delay of the data acquisition operation; in addition, corresponding operation requests are added to the request queue for the operation type of the data acquisition operation, thereby realizing asynchronous processing of the data acquisition request, avoiding processing delays caused by high-concurrency processing processes, improving the operational efficiency of the data acquisition operation, and solving the technical problem of low operational efficiency of the existing data acquisition method.
[0043] As an optional implementation, Figure 2 As shown, the above data acquisition method includes the following steps:
[0044] S202, receiving a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, where the target node set is a node set stored in a target distributed server;
[0045] S204, when the target node data is not obtained from the reference node set stored locally, determine the operation type of the data acquisition operation performed on at least one node subset in the target node set according to the request description information carried in the data acquisition request, wherein the reference node set is a node set constructed according to the data set pre-returned by the target distributed server;
[0046] S206, adding a data operation request corresponding to at least one node subset to a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server;
[0047] S208, sending the target node data returned by the target distributed server according to the data operation request.
[0048] It should be noted that the above implementation can be applied to a terminal in which a client is running, and the client can respond to a user's request to obtain data in a data node in a target distributed server. In a specific manner, the target distributed server can be a zookeeper server.
[0049] In the above step S202, the above data acquisition request can be used to obtain the target node data corresponding to the target node set, and the above target node set can be a node set composed of data nodes in the target node tree stored in the above zookeeper server. The data type of the above target node data corresponding to the target node set can include but is not limited to the node data stored in each data node in the above target node set, and can also be the child node data corresponding to each of the above data nodes.
[0050] More specifically, the target node data may include node data corresponding to different node subsets in the target node set. For example, the target node set may include subset A, subset B, and subset C. The target node data may indicate a first data set consisting of node data stored in each node in subset A, a second data set consisting of node identifiers of child nodes corresponding to each node in subset B, and a third data set consisting of node data stored in each node in subset C and node identifiers of child nodes of each node in subset C. In another embodiment, the node data may also be used to indicate node change data corresponding to each node subset, such as newly added node data stored in a node, or node identifiers of newly added child nodes corresponding to a node. In this embodiment, the specific content included in the target node data is not limited.
[0051] Further, in the above step S204, the above request description information can be used to indicate the operation type of the data acquisition operation of the above data acquisition request for each node subset in the target node set. For example, the above data acquisition operation may include but is not limited to the acquisition operation of node data, the acquisition operation of the node's child node, the monitoring operation of node data, and the monitoring operation of the node's child node. Among them, the above monitoring operation indicates a data acquisition method for obtaining the changed related data when the above node data or the node's child node data changes in the server. In an optional manner, the above data acquisition operation for a node subset may include a combination of one or more of the above operations. In this embodiment, the operation type of the above data acquisition operation is not limited.
[0052] It is understandable that in another optional manner, after receiving the data acquisition request, the relevant data can be first queried in the reference node set stored locally, and if the query is successful, the target node data can be determined according to the query result. Among them, the reference node set is a node set constructed according to the data set pre-returned by the target distributed server.
[0053] In the above step S206, a data operation request corresponding to at least one node subset may be added to a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server.
[0054] It should be noted that the method of adding data operation requests according to the operation type of the data acquisition operation can be but is not limited to adding one data operation request to the request queue for one type of data acquisition operation; it can also be that when the data acquisition operation includes multiple sub-operations, multiple operation requests corresponding to each sub-operation are added to the request queue. In this embodiment, the above-mentioned method of adding data operation requests is not limited.
[0055] Finally, in the above step S208, after obtaining the target node data returned by the target distributed server according to the data operation request, the target node data can be sent. In one embodiment, when the terminal performing the above operation is different from the data request terminal sending the data acquisition request, the above sending operation can be sending the above target node data to the data request terminal through the network; when the terminal performing the above operation is the same as the terminal sending the data acquisition request, the above sending operation can be sending the above target node data to another data receiving interface through a processing module in the client.
[0056] The following is a detailed description of the technical problems that can be solved by this application in combination with the ZK development scenario.
[0057] When currently developing applications based on ZK, when pulling ZK data or registering a watch, data will be pulled synchronously or asynchronously at the granularity of the ZK path, and returned, and corresponding business logic will be performed for each returned data. For example, there is the following data on ZK:
[0058] path: / A / B; child nodes of this path: C1, C2, C3...Cn; each child node has child nodes: D1, D2, D3...Dn;
[0059] The logic of an application is to get child nodes from the path " / A / B". If there are child nodes, get grandchild nodes again. This process continues until all data is pulled. A watch callback for the children change event is set on " / A / B" to detect changes in its child nodes. A watch callback for the childrenchange event is also set on the child nodes of this path to detect changes in its grandchild nodes. The data required by the actual application is the last layer of D1, D2, D3...Dn.
[0060] In the above process, even if Dx data is used, in order to obtain Dx, it is necessary to implement the watch callback of the upper layer of Dx and do some code development. If there are many intermediate layers, there will be more watch callbacks that need to be implemented here. But in fact, they are all some common implementations. The existing implementation scheme does not have batch processing and is not efficient enough. For example, when obtaining Dx data, if there are 10,000 Cx, when the first full data is pulled, even if the data can be aggregated, there are at least 10,000 function calls to process the child node Dx pulled by each Cx. Therefore, the data acquisition method in the existing ZK development scenario has the technical problem of low data acquisition efficiency.
[0061] In an embodiment of the present invention, a data acquisition request is received, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, and the target node set is a node set stored in a target distributed server; in the case that the target node data is not acquired from a reference node set stored locally, an operation type of a data acquisition operation performed on at least one node subset in the target node set is determined based on request description information carried in the data acquisition request, wherein the reference node set is a node set constructed based on a data set pre-returned by the target distributed server; based on the operation type of the data acquisition operation, a data operation request corresponding to at least one node subset is added to a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; and the target node data returned by the target distributed server based on the data operation request is sent, thereby achieving acquisition of data in the target distributed server.
[0062] In the above-mentioned implementation mode of the present application, the received data acquisition request may include specific request description information, which carries the operation type of the data acquisition operation corresponding to each of the multiple node subsets in the target node set, and then the node subsets are refined according to the operations corresponding to each of the node subsets, thereby avoiding repeated acquisition operations for the entire target node set using the same acquisition method, thereby improving data acquisition efficiency; in addition, in the above-mentioned implementation mode, the data to be acquired can be queried locally first, and if the data is not found, a data acquisition request can be sent to the target distributed server, thereby improving and reducing the average delay of the data acquisition operation; in addition, corresponding operation requests are added to the request queue for the operation type of the data acquisition operation, thereby realizing asynchronous processing of the data acquisition request, avoiding processing delays caused by high-concurrency processing processes, improving the operational efficiency of the data acquisition operation, and solving the technical problem of low operational efficiency of the existing data acquisition method.
[0063] In an optional implementation, the determining, according to the request description information carried in the data acquisition request, the operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set includes:
[0064] S1, obtaining node path information in the request description information, wherein the node path information is used to indicate the node path where the target node tree is located, and the target node set is a node set composed of data nodes in the target node tree;
[0065] S2, obtaining at least one operation identifier in the request description information, wherein the operation identifier is used to indicate the operation type of the data acquisition operation, and the at least one node subset is a node set composed of data nodes in at least one layer of nodes;
[0066] S3: Determine the operation type of the data acquisition operation corresponding to at least one layer of nodes according to at least one operation identifier.
[0067] It should be noted that, when the target node set is a set of nodes in a target node tree stored in the target distributed server, the node path information can be used to indicate the target node tree. Figure 3 As shown, node A is the root node of a node tree, node B is the child node of node A, nodes C1, C2, and C3 are the child nodes of node B, nodes D1 and D2 are the child nodes of node C1, node D3 is the child node of node C2, and nodes D4 and D5 are the child nodes of node C3. When the acquired data acquisition request is used to acquire the target node data corresponding to the target node set composed of nodes C1, C2, C3, D1, D2, D3, D4, and D5, it can be determined that the target node tree corresponding to the above node set is the node tree composed of the child nodes corresponding to node B, that is, the node path information of the above target node tree can be determined to be A\B, that is, the node tree is identified by the preceding node sequence of the node tree, that is, the initial node of the node tree is node B.
[0068] Furthermore, an operation identifier in the above request description information can be used to indicate the operation type of the data acquisition operation corresponding to the first-layer node. In an optional manner, the above-mentioned first-layer node can be used to indicate multiple nodes with the same hierarchical relationship. For example, the above-mentioned C1, C2, and C3 are first-layer nodes, and D1, D2, D3, D4, and D5 are first-layer nodes. In this embodiment, the operation granularity for operating on the node set can include a first subset consisting of C1, C2, and C3, and a second subset consisting of D1, D2, D3, D4, and D5; in another optional manner, the above-mentioned first-layer node can also be used to indicate multiple peer sub-nodes belonging to the same node. For example, C1, C2, and C3 are all child nodes of node B, and can be determined as multiple peer child nodes belonging to the same node; nodes D1 and D2 are child nodes belonging to node C1, node D3 is a child node belonging to node C2, and nodes D4 and D5 are child nodes belonging to node C3. In this embodiment, the operation granularity for operating the node set can include a first subset composed of C1, C2, and C3, a second subset of D1 and D2, a third subset composed of D3, and a fourth subset composed of D4 and D5. It can be understood that each layer of nodes can correspond to an operation identifier, and then determine that the same node operation is performed on the nodes of that layer.
[0069] Through the above-mentioned implementation mode of the present application, the node path information in the request description information is obtained; at least one operation identifier in the request description information is obtained; the operation type of the data acquisition operation corresponding to at least one layer of nodes is determined according to the at least one operation identifier, so that the node subsets are refined according to the operations corresponding to each node subset, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set, thereby improving data acquisition efficiency.
[0070] In an optional implementation, the operation type of the data acquisition operation corresponding to at least one layer of nodes is determined according to at least one operation identifier, and includes at least one of the following:
[0071] In the case where the operation identifier is the first identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes, and monitoring a change state of the child nodes corresponding to each node in at least one layer of nodes;
[0072] In the case where the operation identifier is the second identifier, determining that the data acquisition operation is used to acquire node data stored in each node in at least one layer of nodes, and monitoring data changes of the node data stored in each node in at least one layer of nodes;
[0073] In the case where the operation identifier is the third identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes, monitoring a change state of the corresponding child nodes of each node in at least one layer of nodes, acquiring node data stored in each node in at least one layer of nodes, and monitoring a data change of the node data stored in each node in at least one layer of nodes;
[0074] When the operation identifier is the fourth identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes;
[0075] When the operation identifier is the fifth identifier, determining that the data acquisition operation is used to acquire node data stored in each node in at least one layer of nodes;
[0076] When the operation identifier is the sixth identifier, it is determined that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes, and acquire node data stored in each node in at least one layer of nodes.
[0077] It can be understood that in this embodiment, for multi-layer nodes, different operation identifiers can be used to indicate the operation type of the corresponding data acquisition operation.
[0078] In a specific manner, the request description information may be organized in a tree-like description format. Specifically, the data pull request content described in the tree-like description includes the rootPath and watchTypes parameters, which have the following specific meanings:
[0079] 1. rootPath: used to identify the initial node of the current request;
[0080] 2. watchTypes: used to describe the operations (watchType) that the zk nodes of each layer need to perform. The operation types (watchType) include:
[0081] (1) Pull and set the children change event callback;
[0082] (2) Pull and set the value change (node data change) event callback;
[0083] (3) Pull and set the callbacks for children change and value change events;
[0084] (4) Only pull the child nodes of the current node;
[0085] (5) Only pull the data of the current node;
[0086] (6) Pull the child nodes and data of the current node.
[0087] It is understandable that the above monitoring operation can be implemented by setting a callback. Specifically, the callback operation can be set on the ZK server, and then when the ZK server detects a corresponding event, the relevant data is returned to the local.
[0088] Through the above-mentioned implementation mode of the present application, the node path information in the request description information is obtained; at least one operation identifier in the request description information is obtained; the operation type of the data acquisition operation corresponding to at least one layer of nodes is determined according to the at least one operation identifier, so that the node subsets are refined according to the operations corresponding to each node subset, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set, thereby improving data acquisition efficiency.
[0089] In an optional implementation, the adding of a data operation request corresponding to at least one node subset in the request queue according to the operation type of the data acquisition operation includes:
[0090] In a case where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data pull sub-operation, adding an asynchronous pull operation request in the request queue, wherein the node data pull sub-operation is used to obtain node-associated data corresponding to at least one node subset, the node-associated data including node data stored in data nodes in the node subset, and / or reference node subsets corresponding to each of the data nodes in the node subset;
[0091] When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset.
[0092] It can be understood that in this embodiment, the above-mentioned adding of data operation requests corresponding to at least one node subset in the request queue according to the operation type of the data acquisition operation can be based on the operation type of the sub-operation included in the data acquisition operation, and adding a corresponding asynchronous request in the request queue.
[0093] In this embodiment, when the target node data is not obtained from the locally stored reference node set, a corresponding data operation request can be added to the request queue according to the operation type of the data acquisition operation. Figure 3 As shown, when the data acquisition operation for the node subsets C1, C2, and C3 is "pull and set callbacks for children change and value change events", the following data operation request can be added to the request queue:
[0094] 1. Pull the sub-node changes of C1, C2, and C3;
[0095] 2. Pull the changes of node data of C1, C2 and C3;
[0096] 3. Set the callback of children change event of C1, C2 and C3;
[0097] 4. Set the callback of the value change event of C1, C2, and C3.
[0098] Therefore, in the process of sending a request to the server, a type of data acquisition operation for the same layer node is broken down into more detailed operation requests.
[0099] Through the above-mentioned implementation mode of the present application, the node subsets are refined according to the operations corresponding to each node subset, and more refined data requests are generated, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set, thereby improving data acquisition efficiency.
[0100] In an optional implementation manner, after receiving the data acquisition request, the method further includes:
[0101] S1, when the target node data is obtained from the locally stored reference node set, the target node data is sent;
[0102] S2, determining, according to the request description information carried in the data acquisition request, an operation type of the data acquisition operation to be performed on at least one subset of nodes in the target node set;
[0103] S3. When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset, and the node-associated data includes node data stored in the data nodes in the node subset, and / or reference node subsets corresponding to each of the data nodes in the node subset.
[0104] It can be understood that in this embodiment, when the target node data is obtained from a locally stored reference node set, the request description information carried in the data acquisition request can be further obtained to add an asynchronous data monitoring operation request corresponding to the node data monitoring sub-operation in the request queue according to the node data monitoring sub-operation indicated in the request description information.
[0105] In an optional embodiment, when the request description information carried in the received data acquisition request indicates that different data acquisition operations are to be performed on different node subsets, data can be queried first from the local reference node set, and when some node data in the target node data is queried, a corresponding asynchronous pull operation request can be further added to the request queue based on the node data that has not been queried; when the request description information carried in the received data acquisition request indicates that a node data monitoring sub-operation is to be performed on a node subset, an asynchronous data monitoring operation request can be added to the request queue at the same time.
[0106] Through the above implementation of the present application, by just passing in the root node, and then describing how to operate each layer by level (setting watch (data callback) or just pulling data), and marking the path that needs to be merged as needed, and passing in an event callback method, the data of the entire tree can be obtained and returned at one time, avoiding multiple calls and improving the operating efficiency of data acquisition operations.
[0107] In an optional implementation manner, after adding the data operation request corresponding to at least one node subset to the request queue, the method further includes:
[0108] S1, when the request queue includes data operation requests that have not been sent, obtain a data operation request from the request queue as the current operation request, and asynchronously send the current operation request to the target distributed server;
[0109] S2, adding a current response request corresponding to the current operation request to the return queue, wherein the return queue stores response requests corresponding to multiple response data that have not yet been obtained, and the current response request is used to obtain response data returned by the target distributed server in response to the current operation request;
[0110] S3, when receiving the response data returned by the target distributed server, delete the current response request from the return queue, and determine the target node data according to the response data.
[0111] It is understandable that in this embodiment, the operation of sending asynchronous requests can be implemented by setting an asynchronous task queue module. Specifically, in this embodiment, all zk requests are asynchronous. The asynchronous task queue module is a unified management module for these tasks. It mainly completes the following functional tasks.
[0112] First, the asynchronous task queue module can be used to receive asynchronous zk requests:
[0113] Receive asynchronous zk request tasks, give each request a globally unique jobId, and make reasonable request rate limits based on the set number of concurrent requests. Then send the request to zk's sending thread. Finally, put the current jobId into the queue waiting to be returned.
[0114] Secondly, the asynchronous task queue module can be used to receive asynchronous data callbacks:
[0115] Receive the asynchronous data pull return from the zk receiving thread. After receiving the asynchronous data pull return request, get the jobId, remove the job previously placed in the waiting return queue from the waiting return queue, and transmit the data back. Wait for the main logic module to complete the processing. Then check whether there is a request task waiting to be sent. If there is, take out a request and send it to the zk sending module.
[0116] In addition, the zk request sending module can be set to send the request in the queue. Specifically, the zk request sending module accepts the zk request from the task queue module, encapsulates the zk request data message, and sends the data message to the zk server through the network.
[0117] Through the above-mentioned implementation mode of the present application, when the request queue includes a data operation request that has not yet been sent, a data operation request is obtained from the request queue as the current operation request, and the current operation request is sent asynchronously to the target distributed server; a current response request corresponding to the current operation request is added to the return queue, wherein the return queue stores response requests corresponding to multiple response data that have not yet been obtained, and the current response request is used to obtain the response data returned by the target distributed server in response to the current operation request; when the response data returned by the target distributed server is received, the current response request is deleted from the return queue, and the target node data is determined according to the response data, thereby performing zk access acceleration in a fully asynchronous access to zk manner, thereby improving data acquisition efficiency.
[0118] In an optional implementation manner, the above-mentioned determining the target node data according to the response data includes:
[0119] S1, comparing the node data included in the response data with the node data of the corresponding node subset in the reference node set to determine the node change data;
[0120] S2: When the current operation request is an asynchronous data monitoring operation request, the node change data is determined as the target node data.
[0121] It should be noted that in this embodiment, a global tree storage can be implemented locally, and the stored content is the children and value data of the node corresponding to the watched zk path. When a zk event is triggered, it will be updated, and when there is a zk event callback, it will be compared with the latest data on zk to generate incremental data.
[0122] In the existing zk development process, due to the large granularity of data acquisition, developers can only perceive change events through data analysis after acquiring a large amount of data, and convert the events into incremental events. However, through the above implementation of the present application, the node data included in the response data is compared with the node data of the corresponding node subset in the reference node set to determine the node change data; when the current operation request is an asynchronous data monitoring operation request, the node change data is determined as the target node data, so that in the zk event triggering process, the zk event is automatically converted into the corresponding incremental event, avoiding relying on the developer to perceive the event, thereby improving the efficiency of data acquisition operations.
[0123] In an optional implementation, upon receiving response data returned by the target distributed server, deleting the current response request from the return queue and using the response data as the target node data further includes:
[0124] S1, the operation type of the data acquisition operation for acquiring the node subset corresponding to the response data;
[0125] S2. When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset.
[0126] It can be understood that in this embodiment, when the operation type of the data acquisition operation indicates that changes in node-associated data need to be monitored, while receiving a change response event returned by the server, asynchronous data monitoring operation requests continue to be added to the request queue, thereby achieving continuous monitoring of changes in node-associated data of a set of nodes in the server.
[0127] In an optional implementation, upon receiving response data returned by the target distributed server, deleting the current response request from the return queue and using the response data as the target node data further includes:
[0128] S1, the operation type of the data acquisition operation for acquiring the node subset corresponding to the response data;
[0129] S2. When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, and the response data includes node association data, the node association data is added to the locally stored reference node set, wherein the node data monitoring sub-operation is used to obtain changes in node association data corresponding to at least one node subset, and the node association data includes node data stored in the nodes in the node subset, and / or the reference node subsets corresponding to each of the nodes in the node subset.
[0130] It can be understood that in this embodiment, when the node corresponding to the acquired node data is a data node in a monitoring state, after obtaining the response data returned by the server, the acquired data can be stored locally so that when the relevant data request is received next time, it can respond directly according to the locally stored data, thereby improving data acquisition efficiency.
[0131] In an optional implementation manner, before receiving the data acquisition request, the method further includes:
[0132] S1, receiving a first data acquisition request;
[0133] S2. When the request description information in the first data acquisition request indicates that the data acquisition operation performed on the first node subset includes a node data monitoring sub-operation, a first node tree corresponding to the first node subset is constructed locally based on the first node data obtained from the target distributed server, wherein the first node tree is used to save the first node data, and each data node in the first node tree stores a child node field, a data field, and an invalidation field, the child node field is used to indicate the child node corresponding to the current data node, the data field is used to indicate the node data stored in the current data node, and the invalidation field is used to indicate the monitoring status of the current data node.
[0134] In a specific implementation, the above implementation of the present application can implement a global tree storage locally, and the content stored is the children and value data of the node corresponding to the zk path that is watched (i.e. set to monitoring state). It will be updated when a zk event is triggered. The tree data storage structure can use but is not limited to multi-branch tree and multi-level map structures, as long as it can describe a tree data structure. The data fields that need to be saved on the node on the path include:
[0135] 1. Children: child nodes of the current path;
[0136] 2. value: the value of the current path;
[0137] 3. expire: Whether the current path has been unwatched (that is, the nodes on the path are set to be uninteresting, and when the event of this path is received again, no related processing will be performed).
[0138] Through the above implementation of the present application, based on the tree-like watch, the developer only needs to pass in the root node, and then describe how to operate each layer hierarchically (set watch or just pull data), and then refine the node subsets according to the operations corresponding to each node subset, thereby avoiding repeated acquisition operations using the same acquisition method for the entire target node set, thereby improving data acquisition efficiency.
[0139] In an optional implementation, after locally creating the first node tree corresponding to the first node subset according to the first node data obtained from the target distributed server, the method further includes:
[0140] S1, receiving a second data acquisition request;
[0141] S2. When the request description information in the second data acquisition request indicates that the data operation performed on the first node subset includes canceling the node data monitoring sub-operation, the invalidation field of each data node in the first node subset is marked as invalid.
[0142] Specifically, in this embodiment, the global tree data storage object is mainly used for the following functions:
[0143] Function 1: When there is a zk event callback, compare with the latest data on zk to generate incremental data.
[0144] Function 2: When there is a new request to pull data from ZK, first search in this storage to see if it exists. If it exists, get the data directly and return it. Otherwise, initiate an asynchronous request to ZK.
[0145] When a zk path is unwatched, the expire field of the local global data corresponding to the path is first marked as true. When this path is watched again, first check whether the expire field of the data in the global tree storage of the corresponding path is true. If it is true, directly mark the expire as false and return the data, thereby reducing zk interactions and improving data acquisition efficiency.
[0146] The following combination Figure 4 , Figure 5 The system structure of the above method of the present application is described.
[0147] like Figure 4As shown, the above implementation of the present application can be used in ZK data pulling and watch registration scenarios, which can greatly improve the efficiency of data pulling and watch registration. For example, in a virtual network controller scenario, it includes a service side and an agent side. The service side writes data to zk (i.e., zookeeper ob, zookeeper observer cluster in the figure), and the agent (client) obtains data from zk through the zk path corresponding to the watch and the event notification mechanism of zk, completes the business logic conversion, and finally sends the configuration to the virtual switch.
[0148] In an agent, you can include Figure 5 The four modules shown are a main logic module 501 , an asynchronous task queue module 502 , a zk request sending module 503 , and a zk data and event receiving module 504 .
[0149] Among them, the main logic module 501 is the main business processing module in the technical implementation architecture of this application. All event callback processing, asynchronous data pull callback processing, and local data storage processing are implemented here. Specifically, it can be used to implement: global data storage and processing, receiving external requests and synchronously returning, parsing requests and constructing asynchronous tasks, asynchronous data callback processing, and event callback processing;
[0150] In addition, the main logic module 501 is also a module that provides an interface to the outside. Although it is fully asynchronous internally, the external interfaces are all synchronous interfaces.
[0151] The asynchronous task queue module 502 is used to uniformly manage asynchronous tasks, including receiving asynchronous zk requests and receiving asynchronous data callbacks;
[0152] Specifically, the asynchronous zk request receiving module can receive the asynchronous zk request task sent from the main logic module, give each request a globally unique jobId, and make reasonable request rate limits based on the set number of concurrent requests. Then send the request to the zk sending thread. Finally, put the current jobId into the queue waiting to be returned;
[0153] The asynchronous data receiving callback can receive the asynchronous data pull return from the zk receiving thread. After receiving the asynchronous data pull return request, it obtains the jobId and removes the job previously placed in the waiting return queue from the waiting return queue. And the data is returned to the main logic module. Wait for the main logic module to complete the processing. Then check whether there is a request task waiting to be sent. If there is, take out a request and send it to the zk sending module.
[0154] The zk request sending module 503 receives the zk request from the task queue module, encapsulates the zk request data message, and sends the data message to the zk server through the network.
[0155] The zk data and event receiving module 504 is used to receive data and events from the service side of zk, and pass the events and data to the zk asynchronous queue management module through the pipeline or queue of the zk asynchronous queue management module.
[0156] The following combination Figure 5 The interaction process between the main logic module 501, the asynchronous task queue module 502, the zk request sending module 503 and the zk data and event receiving module 504 is briefly described.
[0157] As shown in S502, the main logic module 501 receives an external task request; then, as shown in S504, the main logic module 501 sends an asynchronous task request to the asynchronous task queue module 502 according to the external task request; as shown in S506, the asynchronous task queue module 502 sends an asynchronous zk original request to the zk request sending module 503, wherein the zk request sending module 503 is responsible for converting the asynchronous zk original request into a target request to be sent to the zk server; then, as shown in S508-1 or S508-2, and the zk data and event receiving module 504 performs an event callback or data callback after receiving the data returned by the server; then, as shown in S510, the asynchronous task queue module 502 initiates an asynchronous task or watch callback to the main logic module 501; finally, as shown in S512, the asynchronous task queue module 502 returns the node response data to the outside.
[0158] The implementation of specific functions in the main logic module 501 is described below.
[0159] For global data storage and processing, a global tree storage is implemented in the main logic module 501. The content stored is the children and value data of the node corresponding to the watched zk path. It will be updated when a zk event is triggered. The tree data storage structure is not limited to the use of multiple forks and multi-level maps, as long as it can describe a tree data structure. The data fields that need to be saved on the node on the path include:
[0160] 1. Children: child nodes of the current path;
[0161] 2. value: the value of the current path;
[0162] 3. expire: whether the current path has executed unwatch;
[0163] The global tree data storage object is mainly used for the following functions:
[0164] Function 1: When there is a zk event callback, compare with the latest data on zk to generate incremental data;
[0165] Function 2: When there is a new request to pull data from ZK, first search in the storage to see if it exists. If it exists, get the data directly and return it. Otherwise, initiate an asynchronous request to ZK.
[0166] Function 3: When a zk path is unwatched, the expire field of the local global data corresponding to the path is marked as true. When this path is watched again, first check whether the expire field of the data in the global tree storage of the corresponding path is true. If it is true, directly mark the expire as false and return the data, thereby reducing zk interaction.
[0167] For receiving external requests and synchronously returning operations, the main logic module 501 provides two interfaces to the outside, one is an interface for requesting to pull and register a watch, and the other is an interface for unwatching.
[0168] Among them, the unwatch interface is used to execute the unwatch logic of the specified path. It should be noted that the processing method of unwatch is: perform sub-node cascade unwatch on the passed path. That is, if the passed path is " / A / B", all sub-nodes of this path will be found in the global tree storage and cascade unwatched. If " / A / B" is the root path of a tree request, after unwatching, this tree request needs to be deleted from the global K request list.
[0169] In addition, the interface for pulling and registering watches is used to receive a zk data pull request described in a tree. After receiving the request, each request will be given a unique reqId and then saved to the global memory. The data pull request described in the tree includes the following parameters:
[0170] 1. rootPath: used to identify the initial node of the current request;
[0171] 2. watchTypes: used to describe the operations (watchType) that the zk nodes of each layer need to perform. The operation types (watchType) include:
[0172] (1) Pull and set the children change event callback;
[0173] (2) Pull and set the value change (node data change) event callback;
[0174] (3) Pull and set the callbacks for children change and value change events;
[0175] (4) Only pull the child nodes of the current node;
[0176] (5) Only pull the data of the current node;
[0177] (6) Pull the child nodes and data of the current node.
[0178] In addition, the main logic module 501 also includes the following interface for realizing related data acquisition functions. It should be noted that the following interface is used for realizing functions inside the client and is transparent to the user.
[0179] callbackFunc (callback function): the watch callback set for the current request. This method will be called when there is an event change. Different from the existing one path one watch callback. All callbacks of the present invention will uniformly use the unique callbackFunc specified in this request. In callbackFunc, the passed path is used to identify which layer of zk path callback it is.
[0180] watchTypeGetFunc (monitoring type acquisition function): a method to obtain the watchType of a node on the zk path, used to support data filtering. For example, there are data A, B, C, and D under the current path. This method can be used to return an empty watchType when the node is D, indicating that no operation is required for this node. When this method is empty, the watchType of the zk level specified in watchTypes is used uniformly. That is, this method is used first to obtain the watchType, otherwise the watchType of the specified level in the watchTypes initially passed in is used.
[0181] For parsing requests and constructing asynchronous task operations, you can pull requests based on the received data, construct asynchronous request tasks, and send the tasks to the asynchronous task queue module.
[0182] In this embodiment, when the target node data is not obtained from the locally stored reference node set, a corresponding data operation request can be added to the request queue according to the operation type of the data acquisition operation. Figure 3As shown, when the data acquisition operation for the node subsets C1, C2, and C3 is "pull and set callbacks for children change and value change events", the following data operation request can be added to the request queue:
[0183] 1. Pull the sub-node changes of C1, C2, and C3;
[0184] 2. Pull the changes of node data of C1, C2 and C3;
[0185] 3. Set the callback of children change event of C1, C2 and C3;
[0186] 4. Set the callback of the value change event of C1, C2, and C3.
[0187] Therefore, in the process of sending a request to the server, a type of data acquisition operation for the same layer node is broken down into more detailed operation requests.
[0188] For asynchronous data callback processing, specifically, you can first get the watchType of the node. If the watchType is just pure data pulling without watch registration, the data is saved to a temporary memory object bound to the current req; if the watchType includes not only data pulling but also watch registration, the data is saved to a global tree-like data structure, and a new asynchronous request is constructed to the asynchronous queue module. If the watchType of this node cannot be obtained, the current data is considered to be the last layer of data in the current request. There is no need to continue traversing the lower layers.
[0189] The process of processing asynchronous data callback is as follows Figure 6 As shown:
[0190] First, according to the returned current node data, judgment S600 is executed to determine whether it is no node (i.e., whether there is no data node corresponding to the current node data locally); if it is judged to be yes (i.e., there is no data node corresponding to the current node data locally), step S602 is executed to obtain the watch type (i.e., whether the monitoring operation needs to be performed); then judgment S604 is executed to determine whether it is with watch; if the monitoring type does not include watch, S606 is executed to obtain the watch type update return data; if the monitoring type includes watch, judgment S608 is executed to determine whether the current node is a root path (root node); if the current node is a root node, S610 is executed to set exists watcher (node creation monitoring, i.e., if a child node related to the node is created in the server, a callback is triggered); then S612 is executed to update the return data and local data to be empty; if the current node is not a root node, S612 is directly executed to update the return data and local data to be empty;
[0191] If the result is no (i.e., there is a data node corresponding to the current node data locally), judgment S614 is executed to determine whether it is a callback trigger (i.e., whether it is a data callback triggered by a monitoring type event). If it is determined to be a callback trigger, judgment S614-1 is first executed to determine whether it is get_children; if it is determined to be get_children, the following steps are executed:
[0192] Generate more / less; update local data; push increment and callback methods to the increment queue; obtain the child node watch type; determine whether it has a watch; if the node corresponding to the current node data has a watch, execute the judgment whether it is More (whether it is new data); if it is not More, execute Unwatch (i.e., do not pay attention); if it is More, query local data; and determine whether local data exists. If local data exists, check whether the expire of the node is true. If it is true, set the expire field of the node to false; if expire is false, repeat step S614. If local data does not exist, initiate an asynchronous request task; and initiate an asynchronous getw / get_childrenw request, that is, initiate a get_value watch or get_children watch request, and start monitoring the data changes of the node or the changes of child nodes;
[0193] If it is not get_children, then execute S614-2 to determine whether it is get_value; if it is get_value, execute the following steps:
[0194] Update local data; push value and callback method to the incremental queue; construct asynchronous request task; initiate asynchronous getw request, that is, initiate get_value watch, and start monitoring the data changes of the node;
[0195] If it is judged as not get_value, execute judgment S614-3 to determine whether it is the exists method; if it is judged as yes, obtain the child node watch type; construct an asynchronous request task; initiate an asynchronous getw / get_childrenw request, that is, initiate a get_value watch or get_children watch request, and start monitoring the data changes of the node or the child node changes.
[0196] If it is determined that it is not a callback trigger, in step S614-4, get_children updates the returned data; then executes the judgment to determine whether the traversal is completed; if the traversal is not completed, obtains the child node watch type; queries the local data; and determines whether the local data exists. If the local data does not exist, initiates an asynchronous request task; and initiates an asynchronous getw / get_childrenw request, that is, initiates a get_value watch or get_children watch request to start monitoring the data changes of the node or the changes of the child nodes;
[0197] If the local data exists, the Expire field of the node is obtained. If Expire is true, determine whether the monitoring status of the node includes watch. If the monitoring status includes watch, set expire to false and jump to step S614-4.
[0198] It should be noted that Figure 6 The more / less in the above sentence refers to the difference between the latest child node on the zk path and the child node last saved locally. For example, the child nodes of the path " / A" currently stored locally are [b1, b2, b3]. When children change is triggered on zk, the latest child nodes obtained are [b2, b3, b4]. Then more is [b4] and less is [b1].
[0199] Regarding asynchronous data callback processing, specifically, after obtaining the zk event notification through the asynchronous task queue module, first check whether the reqId of the path where the event is located is in the global reqId set. If not, it means that all paths of the current req have been unwatched and ignored directly. If the reqId exists, check whether this path is in the expire combination. If so, delete the expire data. Otherwise, according to the event type, construct a zk request to the asynchronous task queue. For example, if it is a children change event, construct an asynchronous request task for a children get request. If it is a value change event, construct an asynchronous request task for a value get request. Then send the task to the asynchronous request queue. The specific process is as follows. Figure 7 As shown:
[0200] S702, receiving a callback event; then executing judgment S704 to determine whether reqld exists; if reqld does not exist, executing S704-1 and returning; if reqld exists, executing judgment step S706 to determine whether the expire field is true; if the expire field is true, executing S706-1 to delete the current path data from the global data; if the expire field is false, executing judgment S708 to determine whether it is a callback of children change; if it is a callback of children change, executing S710, children change adds asynchronous pull of children and sets a watch request;
[0201] If it is not a callback of children change, then execute S708-1 to determine whether it is a callback of value change; if it is a callback of value change, execute S712 to add asynchronous value pulling and set a watch request;
[0202] If it is not a callback of value change, then execute S708-2 to determine whether it is a callback of create; if it is a callback of create, execute S714 to obtain the watchType of path; add asynchronous pull and set the watch request;
[0203] If it is not a callback of create, then execute S708-3 to determine whether it is a callback of delete; if it is a callback of delete, determine whether it is necessary to set exist watch; if it is necessary to set, execute S716 to add asynchronous setting; if not, return the deletion result;
[0204] If it is not a delete callback, execute S708-4, session processing.
[0205] Through the above implementation of the present application, a tree-like description request method for fully asynchronously pulling zk data is provided. In implementation, the developer shields the conversion logic of zk events. The developer only needs to describe how to obtain zk path data and set the watch type to obtain the correct full data and incremental data on zk. There is no need to perceive and implement the event conversion processing and watch setting logic required when zk events change. At the same time, since the internal implementation is based on fully asynchronous zk data pulling and watch setting, the efficiency is greatly improved compared to synchronous zk access.
[0206] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
[0207] According to another aspect of the embodiments of the present invention, a data acquisition device for implementing the above data acquisition method is also provided. Figure 8 As shown, the device comprises:
[0208] A receiving unit 802 is used to receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, where the target node set is a node set stored in a target distributed server;
[0209] A determining unit 804 is used to determine, when the target node data is not obtained from the reference node set stored locally, the operation type of the data acquisition operation performed on at least one node subset in the target node set according to the request description information carried in the data acquisition request, where the reference node set is a node set constructed according to the data set pre-returned by the target distributed server;
[0210] An asynchronous processing unit 806, configured to add a data operation request corresponding to at least one node subset to a request queue according to an operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to a target distributed server;
[0211] The sending unit 808 is used to send the target node data returned by the target distributed server according to the data operation request.
[0212] Optionally, the determining unit 804 includes:
[0213] A first acquisition module is used to acquire node path information in the request description information, wherein the node path information is used to indicate the node path where the target node tree is located, and the target node set is a node set composed of data nodes in the target node tree;
[0214] A second acquisition module is used to acquire at least one operation identifier in the request description information, wherein the operation identifier is used to indicate the operation type of the data acquisition operation, and the at least one node subset is a node set composed of data nodes in at least one layer of nodes;
[0215] The determination module is used to determine the operation type of the data acquisition operation corresponding to at least one layer of nodes according to at least one operation identifier.
[0216] Optionally, the asynchronous processing unit 806 includes:
[0217] A first adding module is used to add an asynchronous pull operation request in a request queue when the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data pull sub-operation, wherein the node data pull sub-operation is used to obtain node-associated data corresponding to at least one node subset, and the node-associated data includes node data stored in data nodes in the node subset, and / or reference node subsets corresponding to each of the data nodes in the node subset;
[0218] The second adding module is used to add an asynchronous data monitoring operation request to the request queue when the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset.
[0219] Optionally, the above determination module is further used for:
[0220] In the case where the operation identifier is the first identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes, and monitoring a change state of the child nodes corresponding to each node in at least one layer of nodes;
[0221] In the case where the operation identifier is the second identifier, determining that the data acquisition operation is used to acquire node data stored in each node in at least one layer of nodes, and monitoring data changes of the node data stored in each node in at least one layer of nodes;
[0222] In the case where the operation identifier is the third identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes, monitoring a change state of the corresponding child nodes of each node in at least one layer of nodes, acquiring node data stored in each node in at least one layer of nodes, and monitoring a data change of the node data stored in each node in at least one layer of nodes;
[0223] When the operation identifier is the fourth identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes;
[0224] When the operation identifier is the fifth identifier, determining that the data acquisition operation is used to acquire node data stored in each node in at least one layer of nodes;
[0225] When the operation identifier is the sixth identifier, it is determined that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in at least one layer of nodes, and acquire node data stored in each node in at least one layer of nodes.
[0226] Optionally, the data acquisition device comprises:
[0227] The sending unit 808 is further configured to send the target node data when the target node data is obtained from the reference node set stored locally;
[0228] The determination unit 804 is further used to determine the operation type of the data acquisition operation performed on at least one node subset in the target node set based on the request description information carried in the data acquisition request; when the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset, and the node-associated data includes node data stored in the data nodes in the node subset, and / or reference node subsets corresponding to each of the data nodes in the node subset.
[0229] Optionally, the asynchronous processing unit 806 is further configured to:
[0230] S1, when the request queue includes data operation requests that have not been sent, obtain a data operation request from the request queue as the current operation request, and asynchronously send the current operation request to the target distributed server;
[0231] S2, adding a current response request corresponding to the current operation request to the return queue, wherein the return queue stores response requests corresponding to multiple response data that have not yet been obtained, and the current response request is used to obtain response data returned by the target distributed server in response to the current operation request;
[0232] S3, when receiving the response data returned by the target distributed server, delete the current response request from the return queue, and determine the target node data according to the response data.
[0233] Optionally, the asynchronous processing unit 806 is further configured to:
[0234] S1, comparing the node data included in the response data with the node data of the corresponding node subset in the reference node set to determine the node change data;
[0235] S2: When the current operation request is an asynchronous data monitoring operation request, the node change data is determined as the target node data.
[0236] Optionally, the asynchronous processing unit 806 is further configured to:
[0237] S1, the operation type of the data acquisition operation for acquiring the node subset corresponding to the response data;
[0238] S2. When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset.
[0239] Optionally, the asynchronous processing unit 806 is further configured to:
[0240] S1, the operation type of the data acquisition operation for acquiring the node subset corresponding to the response data;
[0241] S2. When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, and the response data includes node association data, the node association data is added to the locally stored reference node set, wherein the node data monitoring sub-operation is used to obtain changes in node association data corresponding to at least one node subset, and the node association data includes node data stored in the nodes in the node subset, and / or the reference node subsets corresponding to each of the nodes in the node subset.
[0242] Optionally, the data acquisition device is further used for:
[0243] S1, receiving a first data acquisition request;
[0244] S2. When the request description information in the first data acquisition request indicates that the data acquisition operation performed on the first node subset includes a node data monitoring sub-operation, a first node tree corresponding to the first node subset is constructed locally based on the first node data obtained from the target distributed server, wherein the first node tree is used to save the first node data, and each data node in the first node tree stores a child node field, a data field, and an invalidation field, the child node field is used to indicate the child node corresponding to the current data node, the data field is used to indicate the node data stored in the current data node, and the invalidation field is used to indicate the monitoring status of the current data node.
[0245] Optionally, the data acquisition device is further used for:
[0246] S1, receiving a second data acquisition request;
[0247] S2. When the request description information in the second data acquisition request indicates that the data operation performed on the first node subset includes canceling the node data monitoring sub-operation, the invalidation field of each data node in the first node subset is marked as invalid.
[0248] Optionally, in this embodiment, the embodiments to be implemented by the above-mentioned various unit modules can refer to the above-mentioned various method embodiments, which will not be repeated here.
[0249] According to another aspect of the embodiments of the present invention, an electronic device for implementing the above data acquisition method is also provided. The electronic device may be Fig. 9 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a terminal device as an example. Fig. 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.
[0250] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0251] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0252] S1, receiving a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, where the target node set is a node set stored in a target distributed server;
[0253] S2, when the target node data is not obtained from the reference node set stored locally, determine the operation type of the data acquisition operation performed on at least one node subset in the target node set according to the request description information carried in the data acquisition request, where the reference node set is a node set constructed according to the data set pre-returned by the target distributed server;
[0254] S3, adding a data operation request corresponding to at least one node subset to a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server;
[0255] S4, sending the target node data returned by the target distributed server according to the data operation request.
[0256] Alternatively, a person skilled in the art may understand that: Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig. 9 The electronic device and the electronic equipment described above are not limited in structure. Fig. 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig. 9 Different configurations are shown.
[0257] Among them, the memory 902 can be used to store software programs and modules, such as program instructions / modules corresponding to the data acquisition method and device in the embodiments of the present invention. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, to implement the above-mentioned data acquisition method. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 902 can be specifically, but not limited to, used to store information such as various elements in the scene screen, data acquisition information, etc. As an example, such as Fig. 9As shown, the memory 902 may include but is not limited to the receiving unit 802, the determining unit 804, the asynchronous processing unit 806 and the sending unit 808 in the data acquisition device. In addition, other modules and units in the data acquisition device may also be included but are not limited to, which will not be described in detail in this example.
[0258] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0259] In addition, the electronic device further includes: a display 908 for displaying a virtual scene in an interface; and a connection bus 910 for connecting various module components in the electronic device.
[0260] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0261] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0262] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0263] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a 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 above-mentioned data acquisition method.
[0264] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0265] S1, receiving a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, where the target node set is a node set stored in a target distributed server;
[0266] S2, when the target node data is not obtained from the reference node set stored locally, determine the operation type of the data acquisition operation performed on at least one node subset in the target node set according to the request description information carried in the data acquisition request, where the reference node set is a node set constructed according to the data set pre-returned by the target distributed server;
[0267] S3, adding a data operation request corresponding to at least one node subset to a request queue according to the operation type of the data acquisition operation, wherein the request queue is used to asynchronously send the data operation request to the target distributed server;
[0268] S4, sending the target node data returned by the target distributed server according to the data operation request.
[0269] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.
[0270] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the above methods of various embodiments of the present invention.
[0271] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0272] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0273] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0274] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0275] The above are only preferred embodiments of the present invention. It should be pointed out that, for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A data acquisition method, characterized in that: include: Receiving a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, wherein the target node set is a node set stored in a target distributed server; In the case that the target node data is not obtained from the reference node set stored locally, determining the operation type of the data acquisition operation performed on at least one node subset in the target node set according to the request description information carried in the data acquisition request, wherein the reference node set is a node set constructed according to the data set pre-returned by the target distributed server; According to the operation type of the data acquisition operation, adding a data operation request corresponding to the at least one node subset in a request queue, wherein the request queue is used to asynchronously send the data operation request to the target distributed server; Send the target node data returned by the target distributed server according to the data operation request.
2. The method according to claim 1, characterized in that The step of determining, according to the request description information carried in the data acquisition request, the operation type of the data acquisition operation to be performed on at least one node subset in the target node set comprises: Obtaining node path information in the request description information, wherein the node path information is used to indicate a node path where a target node tree is located, and the target node set is a node set composed of data nodes in the target node tree; Acquire at least one operation identifier in the request description information, wherein the operation identifier is used to indicate an operation type of the data acquisition operation, and the at least one node subset is a node set composed of data nodes in at least one layer of nodes; An operation type of the data acquisition operation corresponding to the at least one layer of nodes is determined according to the at least one operation identifier.
3. The method according to claim 2, characterized in that The adding, according to the operation type of the data acquisition operation, a data operation request corresponding to the at least one node subset in the request queue comprises: In a case where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data pulling sub-operation, adding an asynchronous pulling operation request in the request queue, wherein the node data pulling sub-operation is used to obtain node-associated data corresponding to at least one node subset, the node-associated data including node data stored in the data nodes in the node subset, and / or reference node subsets corresponding to each of the data nodes in the node subset; In a case where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in the node-associated data corresponding to at least one node subset.
4. The method according to claim 2, characterized in that: The determining, according to the at least one operation identifier, the operation type of the data acquisition operation corresponding to the at least one layer of nodes comprises at least one of the following: In the case where the operation identifier is the first identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in the at least one layer of nodes, and monitoring a change state of the child nodes corresponding to each node in the at least one layer of nodes; In a case where the operation identifier is the second identifier, determining that the data acquisition operation is used to acquire node data stored in each node in the at least one layer of nodes, and monitoring data changes of the node data stored in each node in the at least one layer of nodes; In the case where the operation identifier is the third identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in the at least one layer of nodes, monitoring a change state of the corresponding child nodes of each node in the at least one layer of nodes, acquiring node data stored in each node in the at least one layer of nodes, and monitoring data changes of the node data stored in each node in the at least one layer of nodes; In a case where the operation identifier is the fourth identifier, determining that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in the at least one layer of nodes; In a case where the operation identifier is the fifth identifier, determining that the data acquisition operation is used to acquire node data stored in each node in the at least one layer of nodes; When the operation identifier is the sixth identifier, it is determined that the data acquisition operation is used to acquire a node set consisting of child nodes of each node in the at least one layer of nodes, and acquire node data stored in each node in the at least one layer of nodes.
5. The method according to claim 1, characterized in that After receiving the data acquisition request, the method further includes: When the target node data is acquired from the locally stored reference node set, the target node data is sent; Determine, according to the request description information carried in the data acquisition request, an operation type of the data acquisition operation performed on at least one node subset in the target node set; In a case where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in node-associated data corresponding to at least one node subset, the node-associated data including node data stored in data nodes in the node subset, and / or reference node subsets corresponding to each of the data nodes in the node subset.
6. The method according to claim 5, characterized in that After adding the data operation request corresponding to the at least one node subset to the request queue, the method further includes: In the case that the request queue includes data operation requests that have not been sent, obtaining a data operation request from the request queue as a current operation request, and asynchronously sending the current operation request to the target distributed server; Adding a current response request corresponding to the current operation request in a return queue, wherein the return queue stores response requests corresponding to a plurality of response data that have not yet been obtained, and the current response request is used to obtain the response data returned by the target distributed server in response to the current operation request; When the response data returned by the target distributed server is received, the current response request is deleted from the return queue, and the target node data is determined according to the response data.
7. The method according to claim 6, characterized in that Determining the target node data according to the response data includes: Comparing the node data included in the response data with the node data of the corresponding node subset in the reference node set to determine the node change data; In a case where the current operation request is the asynchronous data monitoring operation request, the node change data is determined as the target node data.
8. The method according to claim 6, characterized in that In the case of receiving the response data returned by the target distributed server, deleting the current response request from the return queue and using the response data as the target node data, further comprising: An operation type of a data acquisition operation for acquiring a node subset corresponding to the response data; In a case where the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, an asynchronous data monitoring operation request is added to the request queue, wherein the node data monitoring sub-operation is used to obtain changes in the node-associated data corresponding to at least one node subset.
9. The method according to claim 6, characterized in that In the case of receiving the response data returned by the target distributed server, deleting the current response request from the return queue and using the response data as the target node data, further comprising: An operation type of a data acquisition operation for acquiring a node subset corresponding to the response data; When the operation type of the data acquisition operation indicates that the data acquisition operation includes a node data monitoring sub-operation, and the response data includes node association data, the node association data is added to a locally stored reference node set, wherein the node data monitoring sub-operation is used to obtain changes in the node association data corresponding to at least one node subset, and the node association data includes node data stored in the nodes in the node subset, and / or reference node subsets corresponding to each of the nodes in the node subset.
10. The method according to any one of claims 1 to 9, characterized in that Before receiving a data acquisition request, it also includes: receiving a first data acquisition request; In a case where the request description information in the first data acquisition request indicates that the data acquisition operation performed on the first node subset includes a node data monitoring sub-operation, a first node tree corresponding to the first node subset is locally constructed based on the first node data obtained from the target distributed server, wherein the first node tree is used to save the first node data, and each data node in the first node tree stores a child node field, a data field, and an invalidation field, the child node field is used to indicate the child node corresponding to the current data node, the data field is used to indicate the node data stored in the current data node, and the invalidation field is used to indicate the monitoring status of the current data node.
11. The method according to any one of claims 1 to 9, characterized in that After locally creating a first node tree corresponding to the first node subset according to the first node data obtained from the target distributed server, the method further includes: receiving a second data acquisition request; When the request description information in the second data acquisition request indicates that the data operation performed on the first node subset includes canceling the node data monitoring sub-operation, the invalidation field of each data node in the first node subset is marked as invalid.
12. A data acquisition device, characterized in that: include: A receiving unit, configured to receive a data acquisition request, wherein the data acquisition request is used to acquire target node data corresponding to a target node set, wherein the target node set is a node set stored in a target distributed server; a determination unit, configured to determine, when the target node data is not obtained from a locally stored reference node set, an operation type of a data acquisition operation to be performed on at least one node subset in the target node set according to request description information carried in the data acquisition request, wherein the reference node set is a node set constructed according to a data set pre-returned by a target distributed server; an asynchronous processing unit, configured to add a data operation request corresponding to the at least one node subset to a request queue according to an operation type of the data acquisition operation, wherein the request queue is configured to asynchronously send the data operation request to the target distributed server; A sending unit is used to send the target node data returned by the target distributed server according to the data operation request.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 11 when executed.
14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method according to any one of claims 1 to 11 are implemented.
15. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 11 through the computer program.
Citation Information
Patent Citations
Device and method for acquiring page tree data based on buffering queue
CN103955533A
Data access request processing method, apparatus and apparatus, and storage medium
CN109375872A
Efficient data access in clustered storage system
US8554867B1
