Data query method, device and system
By receiving and integrating the boundary information of batched data, network devices achieve efficient integration of data queries in the YANG model, solving the problem of high processing overhead in YANG model data queries and improving query flexibility and accuracy.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- HUAWEI TECH CO LTD
- Filing Date
- 2021-01-30
- Publication Date
- 2026-04-28
AI Technical Summary
During the YANG model data query process, the client incurs significant processing overhead when parsing data retrieved from different batches based on the YANG model schema. Existing technical solutions lack flexibility and the data volume varies considerably between different batches, impacting performance.
By receiving batched data and boundary information, network devices integrate the data based on the boundary information, avoiding parsing based on the YANG model schema, supporting batched queries of any type of data node, with high flexibility and small differences in data volume.
It reduces the processing overhead of network devices, improves the flexibility and accuracy of data queries, reduces the difference in data volume between different batches, and simplifies the data query process.
Smart Images

Figure CN114840715B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data communication, and in particular to data query methods, apparatus and systems. Background Technology
[0002] YANG is a data modeling description language defined by the Internet Engineering Task Force (IETF) standards organization in Request for Comments (RFC) 6020. Using the YANG language, YANG models are obtained by modeling network device data (such as configuration data and state data) based on protocols such as the network configuration protocol (NETCONF) and the representations state transfer configuration protocol (RESTCONF).
[0003] The YANG model has a tree-like structure, comprising multiple data nodes. Data is typically stored within these data nodes (for ease of description, the data stored in the data nodes and the data used to describe the YANG model will be referred to as YANG model data below). The YANG model itself is usually stored on a server. When a client needs to apply the YANG model data, it can query the YANG model data from the server. When the client needs to query a large amount of data, the YANG model data can usually be queried in batches to reduce the performance impact of the data query process on both the client and the server.
[0004] NETCONF defines <get> 、 <get-config> 、 <get-data>Remote procedure calls (RPC) operations support batch queries of YANG model data using XPath filtering conditions, subtree filtering conditions, etc. For example, when a client queries YANG model data from a server, it sends query requests with XPath and / or subtree filtering conditions to the server in batches. Each time the server receives a query request, it performs a data query in the YANG model based on the filtering conditions carried in the request and sends the retrieved data to the client. The client parses the data retrieved in different batches based on the YANG model schema, and integrates the parsing results to obtain the final retrieved YANG model data. However, the processing overhead of parsing data based on the YANG model schema by the client is significant, therefore the processing overhead of the above data query scheme is also relatively high. Summary of the Invention
[0005] This application provides a data query method, apparatus, and system, which helps to reduce the processing overhead of data query. The technical solution of this application is as follows:
[0006] Firstly, a data query method is provided, executed by a network device, comprising: receiving first data and first boundary information, the first boundary information indicating information of the last responding node corresponding to the first data; receiving second data and second boundary information, the second boundary information indicating information of the next responding node of the last responding node (i.e., the last responding node corresponding to the first data), the second data including data of the next responding node (i.e., the next responding node after the last responding node corresponding to the first data), the responding node being a data node in a data model that meets the query conditions; and integrating the first data and the second data according to the first boundary information and the second boundary information. Wherein, the first data and the second data are data queried by the network device in batches (e.g., they can be called batch data), the first boundary information may be located in the first data, and the second boundary information may be located in the second data.
[0007] The technical solution provided in this application integrates the first and second data based on the batched data and boundary information received by the network device. The first boundary information indicates the last responding node corresponding to the first data, and the second boundary information indicates the next responding node after that last responding node. Furthermore, the second data includes the data of that next responding node. This allows the network device to reduce its processing overhead. For example, when this data query scheme is applied to the YANG model, the network device can integrate the first and second data without parsing the first and second data retrieved from different batches based on the YANG model schema, further reducing its processing overhead.
[0008] Optionally, the first data and the second data are integrated according to the first boundary information and the second boundary information, including: integrating the first data and the second data according to the information of the last response node indicated by the first boundary information (that is, the last response node corresponding to the first data) and the information of the next response node indicated by the second boundary information (that is, the next response node of the last response node corresponding to the first data).
[0009] Optionally, the first boundary information is further used to indicate the information of the parent node of the last response node (that is, the last response node corresponding to the first data), and the second boundary information is further used to indicate the information of the parent node of the next response node (that is, the next response node of the last response node corresponding to the first data). According to the first boundary information and the second boundary information, the first data and the second data are integrated, including: determining the data of the target node from the second data, the target node being the response node other than the target parent node among the response nodes corresponding to the second data, and the target parent node being the same parent node corresponding to the information indicated by the first boundary information and the second boundary information; and merging the data of the target node with the first data.
[0010] Optionally, before receiving the first data and the first boundary information, the method further includes: sending a first query request, the first query request carrying a first block size and query conditions, the first block size indicating the maximum number of response nodes requested by the first query request. The response nodes can be data nodes of any type. For example, response nodes can be leaf nodes, leaf-list nodes, container nodes, or list nodes, etc.
[0011] The technical solution provided in this application allows a network device to send a first query request carrying a first block size. This enables the receiving network device to query data based on the first block size to obtain first data, ensuring that the number of response nodes corresponding to the first data is less than or equal to the maximum number of response nodes represented by the first block size, thus achieving batch data querying. This data query scheme supports data querying from any type of data node, and the difference in the amount of data retrieved in different batches is small, allowing for relatively precise control over the amount of data in each batch.
[0012] Optionally, before receiving the second data and the second boundary information, the method further includes: sending a second query request, the second query request carrying a second block size, the first boundary information, and query conditions, wherein the second block size indicates the maximum number of response nodes requested by the second query request. For example, the maximum number represented by the second block size is equal to the maximum number represented by the first block size.
[0013] The technical solution provided in this application allows a network device to send a second query request carrying a second block size and first boundary information. This facilitates the network device receiving the second query request to query the second data starting from the next response node after the last response node corresponding to the first data, based on the second block size. Furthermore, the number of response nodes corresponding to the second data is less than or equal to the maximum number of response nodes represented by the second block size, thus achieving batch data querying. This data query scheme supports data querying for any type of data node and can use any type of data node in the data model as a boundary point for batch data querying. It offers high flexibility in data querying, with minimal differences in the amount of data retrieved in different batches, allowing for precise control over the amount of data in each batch. Moreover, the network device receiving the second query request starts querying the second data from the next response node after the last response node corresponding to the first data, thereby simplifying the data query process.
[0014] Optionally, the method further includes: receiving third boundary information, which indicates information about the last response node corresponding to the second data. For example, the third boundary information is located within the second data.
[0015] The technical solution provided in this application allows the network device to determine whether the entire data query process has ended (i.e., whether all data in the data model that meets the query conditions has been queried) by whether it receives third boundary information. If the entire data query process has not ended, the network device can continue to send batch query requests to query the data, thereby ensuring that the network device can query all data that meets the query conditions from the data model.
[0016] Optionally, the method further includes: sending a third query request, the third query request carrying a third block size, third boundary information and query conditions, the third block size indicating the maximum number of response nodes requested by the third query request; receiving third data and fourth boundary information, the fourth boundary information indicating the information of the next response node of the last response node corresponding to the second data, the third data including the data of the next response node of the last response node corresponding to the second data; and integrating the second data and the third data according to the third boundary information and the fourth boundary information.
[0017] The technical solution provided in this application, after receiving the third boundary information, determines that the entire data query process is not yet complete (i.e., the data model still contains data that meets the query conditions). The network device then sends a third query request carrying the third block size and the third boundary information. This facilitates the network device receiving the third query request to query the third data starting from the next response node after the last response node corresponding to the second data, based on the third block size, and ensures that the number of response nodes corresponding to the third data is less than or equal to the maximum number of response nodes represented by the third block size. Since the network device queries the third data starting from the next response node after the last response node corresponding to the second data, it helps simplify the data query process. Furthermore, after receiving the third data and the fourth boundary information, the network device integrates the second and third data based on the third and fourth boundary information, which helps reduce the processing overhead of the network device. For example, when this data query scheme is applied to the YANG model, the network device does not need to parse the second and third data queried from different batches based on the YANG model schema to integrate the second and third data, which helps reduce the processing overhead of the network device.
[0018] Secondly, a data query method is provided, which is executed by a network device, comprising: sending first data and first demarcation information, wherein the first demarcation information is used to indicate the information of the last responding node corresponding to the first data; sending second data and second demarcation information, wherein the second demarcation information is used to indicate the information of the next responding node of the last responding node (i.e., the last responding node corresponding to the first data), wherein the second data includes the data of the next responding node (i.e., the next responding node of the last responding node corresponding to the first data), and the responding node is a data node in the data model that meets the query conditions, wherein the first data and the second data are data queried by the network device in batches (e.g., they can be called batch data), the first demarcation information can be located in the first data, and the second demarcation information can be located in the second data.
[0019] The technical solution provided in this application, because the batch data and boundary information sent by the network device contain a first boundary information indicating the last responding node corresponding to the first data, and a second boundary information indicating the next responding node of that last responding node, and the second data includes the data of that next responding node, allows the network device receiving the batch data and the boundary information to integrate the first data and the second data based on the first and second boundary information, thus helping to reduce the processing overhead of the network device. For example, when this data query scheme is applied to the YANG model, the network device does not need to parse the first and second data queried from different batches based on the YANG model schema to integrate the first and second data, which helps to reduce the processing overhead of the network device.
[0020] Optionally, before sending the first data and the first boundary information, the method further includes: receiving a first query request, the first query request carrying a first block size and query conditions, the first block size indicating the maximum number of response nodes requested by the first query request; and querying the first data in the data model according to the first block size and query conditions.
[0021] The technical solution provided in this application allows a network device to receive a first query request carrying a first block size, perform data querying based on the first block size to obtain first data, and ensure that the number of response nodes corresponding to the first data is less than or equal to the maximum number of response nodes represented by the first block size, thereby achieving batch data querying. This data querying scheme supports data querying of any type of data node, and the difference in the amount of data obtained in different batches is small, enabling relatively precise control over the amount of data in each batch.
[0022] Optionally, before sending the second data and the second boundary information, the method further includes: receiving a second query request, the second query request carrying a second block size, first boundary information and query conditions, the second block size indicating the maximum number of response nodes requested by the second query request; and querying the second data in the data model according to the second block size, the first boundary information and the query conditions.
[0023] The technical solution provided in this application allows a network device to receive a second query request carrying a second block size and first boundary information. Based on the second block size, the device queries the second data starting from the next response node after the last response node corresponding to the first data, ensuring that the number of response nodes corresponding to the second data is less than or equal to the maximum number of response nodes represented by the second block size. This enables batch data querying. This data query scheme supports data querying for any type of data node and can use any type of data node in the data model as a boundary point for batch data querying. It offers high flexibility in data querying, with minimal differences in the amount of data retrieved in different batches, allowing for precise control over the amount of data in each batch. Furthermore, the network device's querying of the second data starting from the next response node after the last response node corresponding to the first data simplifies the data query process.
[0024] Optionally, querying the first data in the data model based on the first block size and query conditions includes: querying the data that meets the query conditions in the data model; obtaining a full snapshot of the data that meets the query conditions; and determining the first data in the full snapshot based on the first block size and query conditions.
[0025] The technical solution provided in this application allows the network device to obtain a full snapshot of the data to be queried (e.g., data in the data model that meets the query conditions) and determine the first data in the full snapshot of the data to be queried. This avoids the impact of changes in the data to be queried during batch queries on the query results and ensures the accuracy of the query results.
[0026] Optionally, querying the second data in the data model based on the second block size, the first boundary information, and the query conditions includes: determining the second data from a full snapshot of the data in the data model that meets the query conditions, based on the second block size, the first boundary information, and the query conditions.
[0027] The technical solution provided in this application allows network devices to obtain second data from a full snapshot of the data to be queried (e.g., data in a data model that meets the query conditions), thereby avoiding the impact of changes in the data to be queried during batch queries on the query results and ensuring the accuracy of the query results.
[0028] Optionally, the method further includes: sending third demarcation information, which indicates information about the last response node corresponding to the second data. For example, the third demarcation information is located within the second data.
[0029] The technical solution provided in this application allows the network device to send third boundary information, which can inform the network device that the entire data query process has not yet ended (that is, there is still data in the data model that meets the query conditions). This allows the network device that receives the third boundary information to continue sending batch query requests to query the data, thereby ensuring that the network device can query all data that meets the query conditions from the data model.
[0030] Optionally, the method further includes: receiving a third query request, the third query request carrying a third block size, third boundary information and query conditions, the third block size indicating the maximum number of response nodes requested by the third query request;
[0031] Based on the third block size, the third boundary information, and the query conditions, query the third data in the data model; send the fourth boundary information and the third data. The fourth boundary information is used to indicate the information of the next response node of the last response node corresponding to the second data, and the third data includes the data of the next response node of the last response node corresponding to the second data.
[0032] The technical solution provided in this application allows a network device to receive a third query request carrying a third block size and a third boundary information. Based on the third block size, the device queries the third data starting from the next response node after the last response node corresponding to the second data, ensuring that the number of response nodes corresponding to the third data is less than or equal to the maximum number of response nodes represented by the second block size. This enables batch data querying. This data query scheme supports data querying from any type of data node and can use any type of data node in the data model as a boundary point for batch data querying. It offers high flexibility in data querying, with minimal differences in the amount of data retrieved in different batches, allowing for precise control over the amount of data in each batch. Furthermore, the network device's querying of the third data starting from the next response node after the last response node corresponding to the second data simplifies the data query process.
[0033] Thirdly, a data query apparatus is provided, comprising modules for performing a data query method as provided in the first aspect or any alternative method of the first aspect.
[0034] Fourthly, a data query apparatus is provided, comprising modules for performing a data query method as provided in the second aspect or any alternative method of the second aspect.
[0035] In the third and fourth aspects described above, the modules can be implemented based on software, hardware, or a combination of both, and the modules can be arbitrarily combined or divided based on specific implementations. The data query device described in the third and fourth aspects can be different functional components within a single network device, or it can be two network devices.
[0036] Fifthly, a data query device is provided, including a memory and a processor;
[0037] Memory is used to store computer programs;
[0038] The processor is configured to execute a computer program stored in memory to cause the data querying device to perform the method provided by the first aspect or any alternative method of the first aspect, or to perform the method provided by the second aspect or any alternative method of the second aspect.
[0039] A sixth aspect provides a computer-readable storage medium storing a computer program that, when executed, implements the method provided by the first aspect or any alternative method thereof, or implements the method provided by the second aspect or any alternative method thereof.
[0040] In a seventh aspect, a computer program product is provided, the computer program product comprising a program or code that, when run on a computer, causes the computer to perform the method provided by the first aspect or any alternative method of the first aspect, or to perform the method provided by the second aspect or any alternative method of the second aspect.
[0041] Eighthly, a chip is provided, the chip including programmable logic circuitry and / or program instructions, which, when the chip is operated, are used to implement the method provided by the first aspect or any alternative method of the first aspect, or to implement the method provided by the second aspect or any alternative method of the second aspect.
[0042] Ninthly, a data query system is provided, comprising: a data query apparatus as provided in the third aspect above, and a data query apparatus as provided in the fourth aspect above; or, the system comprises: a data query apparatus as provided in the fifth aspect above. Optionally, the data query apparatus is a network device.
[0043] The beneficial effects of the technical solution provided in this application are:
[0044] The technical solution provided in this application involves a network device receiving first data and first boundary information, as well as second data and second boundary information. The first boundary information indicates the last responding node corresponding to the first data, and the second boundary information indicates the next responding node of that last responding node. The second data includes the data of the next responding node. The first data and the second data are data retrieved by the network device in batches. Therefore, the network device integrates the first data and the second data based on the first and second boundary information, which helps reduce the processing overhead of the network device, thereby reducing the processing overhead of the data query scheme. Furthermore, this data query scheme supports data querying of any type of data node, and can use any type of data node in the data model as a boundary point for batch data querying. The data query is highly flexible, and the difference in the amount of data retrieved in different batches is small, allowing for more precise control over the amount of data in each batch. Attached Figure Description
[0045] Figure 1 This is a schematic diagram of a data query system provided in an embodiment of this application;
[0046] Figure 2 This is a schematic diagram of a data model provided in an embodiment of this application;
[0047] Figure 3 This is a flowchart of a data query method provided in an embodiment of this application;
[0048] Figure 4 This is a schematic diagram illustrating a batch query of a data model provided in an embodiment of this application;
[0049] Figure 5 This is a schematic diagram illustrating the integration of first and second data according to an embodiment of this application;
[0050] Figure 6 This is a schematic diagram illustrating another integration of the first and second data provided in an embodiment of this application;
[0051] Figure 7 This is a flowchart of another data query method provided in the embodiments of this application;
[0052] Figure 8 This is a schematic diagram illustrating the integration of first data, second data, and third data according to an embodiment of this application;
[0053] Figure 9 This is a schematic diagram illustrating another integration of first data, second data, and third data provided in an embodiment of this application;
[0054] Figure 10 This is a schematic diagram of the structure of a data query device provided in an embodiment of this application;
[0055] Figure 11 This is a schematic diagram of another data query device provided in an embodiment of this application;
[0056] Figure 12 This is a schematic diagram of the hardware structure of a data query device provided in an embodiment of this application. Detailed Implementation
[0057] The embodiments of this application will now be described in further detail with reference to the accompanying drawings.
[0058] Please refer to Figure 1 This diagram illustrates an implementation environment according to an embodiment of this application. The implementation environment provides a data query system 100, which includes a query request device 110 and a query response device 120, connected together. Data to be queried is stored in the query response device 120. The query request device 110 can send a query request to the query response device 120, which then performs a data query based on the query request and sends the retrieved data back to the query request device 110.
[0059] The query request device 110 and the query response device 120 can be located in the same device. For example, the query request device 110 and the query response device 120 can be different functional modules within the same device, and in this case, the query request device 110 and the query response device 120 can be connected through the internal logic interface or signal line of the device. Alternatively, the query request device 110 and the query response device 120 can be located in different devices. For example, the query request device 110 can be located in a network management device, and the query response device 120 can be located in a server. Or, the query request device 110 and the query response device 120 can be different devices. For example, the query request device 110 can be a network management device, and the query response device 120 can be a server. In this case, the query request device 110 and the query response device 120 can be connected through a wired network or a wireless network (e.g., Figure 1 (As shown). In one possible implementation, the query request device 110 is a client installed in the network management device, and the query response device 120 is a server. The network management device can be, for example, a controller. The server can be a single server, a server cluster consisting of several servers, or a cloud computing service center; this application embodiment does not limit this. This application embodiment uses the query request device 110 being a network management device as an example for illustration, then... Figure 1 As shown, the data query system 100 also includes multiple network elements managed by the query request device 110. After the query request device 110 retrieves data from the query response device 120, it can configure the network elements based on the retrieved data. Both the query request device 110 and the query response device 120 can be network devices.
[0060] In this embodiment, the query response device 120 stores a data model, which includes multiple data nodes. The data in the data model and the data used to describe the data model are the data to be queried. The query response device 120 can perform data queries in the data model according to the query request sent by the query request device 110. As an optional implementation, the data model has a tree structure. The data model is a hierarchical collection composed of multiple data nodes. Each data node in the data model has a finite number of child nodes or no child nodes. A data node without a parent node is called a root node. Each non-root node has one and only one parent node. If a data node contains child nodes, then this data node is called the parent node of that child node. If a data node contains a parent node, then this data node is called the child node of that parent node. Data nodes with the same parent node are sibling nodes. In this embodiment, for ease of description, for a certain data node, both the direct parent node and the indirect parent node of the data node (e.g., the grandparent node and the great-grandparent node of the data node) are referred to as the parent node of the data node. In this context, the direct parent node of a data node refers to the parent node directly connected to the data node, and the indirect parent node of a data node refers to the parent node indirectly connected to the data node. The indirect parent node of a data node includes the direct parent node of the data node's direct parent node, as well as the indirect parent node of the data node's direct parent node. The indirect parent node of a data node and the data node are related as descendant, great-grandchild, etc.
[0061] For example, please refer to Figure 2 This diagram illustrates a data model provided in an embodiment of this application. The data model has a tree structure and includes data nodes 1 to 7, with data node 1 being the root node. Data node 2's parent node is data node 1, and data node 1 is the direct parent node of data node 2. Data node 4's parent nodes include data node 2 and data node 1, with data node 2 being the direct parent node of data node 4 and data node 1 being the indirect parent node of data node 4 (i.e., data node 1 is the grandparent node of data node 4). Data node 6's parent nodes include data node 4, data node 2, and data node 1, with data node 4 being the direct parent node of data node 6, and both data node 2 and data node 1 being indirect parents of data node 6. Furthermore, data node 2 is the grandparent node of data node 6, and data node 1 is the great-grandparent node of data node 6. Data node 6 and data node 4 are parent-child relationships, data node 6 and data node 2 are child-grandchild relationships, and data node 6 and data node 1 are great-grandchild relationships. The same applies to data nodes 3, 5, and 7, which will not be elaborated further here.
[0062] In this embodiment, the data model can be a YANG model. A YANG model is a data model built using the YANG language, based on NETCONF, RESTCONF, etc. YANG models are typically encoded in Extensible Markup Language (XML) or JavaScript Object Notation (JSON) format. Based on node type, data nodes in a YANG model can include leaf nodes, leaf-list nodes, container nodes, list nodes, etc. A leaf node has only one value and is a leaf node; a leaf-list node consists of a group of leaf nodes of the same type, resembling an array; a container node is an internal node of the schema tree, typically meaningless, existing only as the parent of a series of leaf nodes; a list node is a collection of data nodes, and the data nodes in a list node can be at least one of leaf nodes, leaf-list nodes, container nodes, and list nodes.
[0063] The following example uses the client as the query request device, the server as the query response device, and the YANG model as the data model within the query response device. The data in this data model, as well as the data used to describe it, is the YANG model data. When the client needs to query a large amount of data, the server's response time is long, and the entire data query process (including the client sending a query request to the server, the server querying data in the YANG model, and the client receiving the YANG model data) incurs significant memory overhead for both the client and the server. Therefore, in many scenarios, data is queried in batches. For example, when the client needs to display query results in pages on a user interface, or when the client and / or server have limited memory, data is queried in batches.
[0064] The batch query scheme is based on NETCONF. <get> 、 <get-config> 、 <get-data>Query schemes for RPC operations, etc. <get> 、 <get-config> 、 <get-data>RPC operations support batch queries of YANG model data using XPath filtering conditions and subtree filtering conditions. However, this batch query scheme requires the client to be very familiar with the YANG model and able to pre-set reasonable batch filtering strategies. Furthermore, the client needs to parse the YANG model data retrieved from different batches based on the YANG model schema for data integration. The processing overhead of parsing YANG model data based on the YANG model schema is significant, therefore, this data query scheme also has a high processing cost.
[0065] Except for those defined based on NETCONF <get> 、 <get-config> 、 <get-data>In addition to batch query solutions for RPC operations, the RFC draft is currently discussing the development of... <get-bulk>RPC operation <get-bulk>RPC operations support batch queries on list nodes. That is, <get-bulk>RPC operations support batch queries of YANG model data at the list node granularity. However, this data query scheme only supports batch queries of list nodes, resulting in poor flexibility. Furthermore, the client needs to parse the YANG model data retrieved from different batches based on the YANG model schema for data integration, leading to significant processing overhead. In addition, in actual YANG models, some list nodes may not contain nested list nodes, while others may contain nested list nodes, and the sizes of the nested list nodes may differ, resulting in significant variations in the amount of YANG model data retrieved from different batches.
[0066] In view of this, embodiments of this application provide a data query scheme applicable to data queries within a YANG model. A query response device (e.g., a server) can send boundary information of batches of data (e.g., YANG model data) to a query request device (e.g., a client). The query request device integrates the batches of data retrieved from different batches based on the boundary information, without needing to parse the batches of data based on the YANG model schema. Therefore, the processing overhead of the query request device is low. Furthermore, this data query scheme supports data queries for any type of data node, offering high flexibility. The difference in the amount of data retrieved from different batches is small, allowing for relatively precise control over the amount of data in each batch.
[0067] The data query scheme of this application is described below with reference to the accompanying drawings. In the following description, the query request device may be... Figure 1 The query request device 110 in the data query system 100 shown can be a query response device. Figure 1 The data query system 100 shown includes a query response device 120. The query request device and the query response device can be different functional components of a single network device, or two network devices. Furthermore, in this application, the information of a node (e.g., a data node, a response node, the last response node described below, a parent node, etc.) can be the node's name or its identifier, etc.
[0068] Please refer to Figure 3 The diagram illustrates a flowchart of a data query method provided in an embodiment of this application. This data query method can be applied to a data query system. The data query method may include:
[0069] S301. The query request device sends a first query request to the query response device. The first query request carries a first block size and query conditions. The first block size indicates the maximum number of response nodes requested by the first query request.
[0070] When determining to perform a batch data query, the query request device determines the first bulk size and query conditions, generates a first query request based on the first bulk size and query conditions, and sends the first query request to the query response device. The first query request carries the first bulk size and query conditions. The first bulk size indicates the maximum number of response nodes requested by the first query request; for example, the query conditions can be XPath filtering conditions, subtree filtering conditions, etc. The query response device stores a data model, which may include multiple data nodes. The first query request can be used to request the query response device to perform a data query within the data model. In this embodiment, the response node can refer to a data node in the data model that meets the query conditions.
[0071] Optionally, the first block size may also indicate the size of the amount of data requested by the first query request, or characterize the size of the response message to the first query request. This application embodiment does not limit this.
[0072] Optionally, if the query request device and the query response device are located in the same device, the first query request may be a query instruction between different functional components or different functional modules in the device, and this application embodiment does not limit this.
[0073] S302, The query response device queries the first data in the data model of the query response device according to the first block size and query conditions carried in the first query request.
[0074] The query request device sends a first query request to the query response device, and the query response device receives the first query request. After receiving the first query request, the query response device parses the first query request to obtain a first block size and query conditions. Based on the first block size and the query conditions, the query response device queries first data in its data model. The first data refers to the data in the data model that meets the query conditions. The first data includes data in the response node and data used to describe the response node. The number of response nodes corresponding to the first data is less than or equal to the maximum number represented by the first block size. In this embodiment, for a given response node, both the data in the response node and the data used to describe the response node are referred to as the data of that response node.
[0075] Optionally, the query response device may query the first data in its data model based on the first block size and query conditions carried in the first query request, which may include two possible implementations.
[0076] The first possible implementation is as follows: The query response device, based on the query conditions and the first block size, sequentially traverses the data nodes in the data model, starting from a specified node (e.g., the root node), to determine the data nodes (i.e., response nodes) that meet the query conditions, until a traversal stopping condition is reached. The query response device then determines the data (including the data within the at least one response node and the data describing the at least one response node) of the at least one response node determined when the traversal stopping condition is reached as the first data. The traversal stopping condition may include: the number of response nodes determined by the query response device equals the maximum number represented by the first block size, or the query response device has traversed all data nodes in the data model. If the traversal stopping condition is that the number of response nodes determined by the query response device equals the maximum number represented by the first block size, the number of response nodes corresponding to the first data is equal to the maximum number represented by the first block size. If the traversal stopping condition is that the query response device has traversed all data nodes in the data model, the number of response nodes corresponding to the first data may be less than or equal to the maximum number represented by the first block size.
[0077] For example, the query response device for such Figure 2 The traversal order of data nodes 1 to 7 in the data model shown can be: Data node 1 -> Data node 2 -> Data node 4 -> Data node 6 -> Data node 7 -> Data node 5 -> Data node 3. Please refer to... Figure 4 This illustration shows a schematic diagram of batch querying a data model according to an example of this application. Assuming the maximum quantity represented by the first block size is 4, the query response device, based on the query conditions and the first block size, sequentially traverses the data nodes in the data model, starting from data node 1. Assuming that data nodes 1, 2, 4, and 6 all meet the query conditions, when the query response device has traversed all data nodes 6, it determines that the number of response nodes equals the maximum quantity represented by the first block size. The query response device then stops traversing and identifies the data of data nodes 1, 2, 4, and 6 (including the data within data nodes 1, 2, 4, and 6, as well as the data used to describe them) as the first data. Here, data nodes 1, 2, and 4 are all parent nodes of data node 6; data node 4 is the direct parent node of data node 6; data node 2 is the grandparent node of data node 6; and data node 1 is the great-grandparent node of data node 6.
[0078] The second possible implementation: The query response device starts from a specified node (such as the root node) of the data model according to the query condition, and traverses the data nodes in the data model in sequence to determine the data nodes (i.e., response nodes) that meet the query condition from the data model until all the data nodes in the data model are traversed. The query response device can determine n response nodes, and the n response nodes can be arranged in the traversal order. Then, according to the first block size, the query response device determines the data of the first n1 response nodes arranged at the forefront among the n response nodes (including the data in the n1 response nodes and the data used to describe the n1 response nodes) as the first data, where n1 ≤ n. When n1 < n, n1 is the maximum quantity characterized by the first block size; when n1 = n, n1 is the total quantity of the response nodes in the data model.
[0079] Exemplarily, the traversal order of the data nodes 1 to 7 in the data model shown as Figure 2 can be: data node 1 -> data node 2 -> data node 4 -> data node 6 -> data node 7 -> data node 5 -> data node 3. Assuming that data nodes 1 to 7 all meet the query condition, the arrangement order of the n response nodes determined by the query response device is: data node 1 -> data node 2 -> data node 4 -> data node 6 -> data node 7 -> data node 5 -> data node 3. Assuming that the maximum quantity characterized by the first block size is 4, the query response device determines the data of the data nodes 1, data node 2, data node 4, and data node 6 arranged at the forefront among the n response nodes (including the data in the data nodes 1, data node 2, data node 4, and data node 6 and the data used to describe the data nodes 1, data node 2, data node 4, and data node 6) as the first data according to the first block size.
[0080] As an optional implementation of this application embodiment, the query response device obtains a full snapshot of the data corresponding to the data model, and determines the first data in the full snapshot according to the first block size and the query condition. The specific implementation process can refer to the first possible implementation in S302. Or, as another optional implementation of this application embodiment, the query response device queries the data that meets the query condition in the data model, obtains a full snapshot of the data that meets the query condition, and determines the first data in the full snapshot according to the first block size. The specific implementation process can refer to the second possible implementation in S302. By obtaining a full snapshot of the data to be queried (such as the data corresponding to the data model or the data that meets the query condition) and determining the first data in the full snapshot of the data to be queried, this application embodiment can avoid the influence of the change of the data to be queried on the query result during the batch query process and ensure the accuracy of the query result.
[0081] S303, the query response device sends first data and first boundary information to the query request device, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data.
[0082] The first data corresponds to at least one response node, which is arranged in traversal order. The first delimitation information is used to indicate the information of the last-node among the at least one response nodes, thereby indicating the last-node. The information of the last-node may include its identifier and / or name. For example, the first delimitation information indicates the identifier of the last-node corresponding to the first data, thereby indicating the last-node corresponding to the first data. For example, the response nodes corresponding to the first data are data node 1, data node 2, data node 4, and data node 6. The traversal order of the query response device for data node 1, data node 2, data node 4, and data node 6 is: data node 1 -> data node 2 -> data node 4 -> data node 6. Therefore, the first delimitation information is used to indicate the information of data node 6 (e.g., the identifier of data node 6), thereby indicating data node 6.
[0083] In one optional implementation, the first demarcation information is used not only to indicate the information of the last response node corresponding to the first data, but also to indicate the information of the parent node (including direct and indirect parent nodes) of the last response node corresponding to the first data, so as to indicate the last response node and its parent node. For example, the first demarcation information is used to indicate the identifier of the last response node corresponding to the first data, and also to indicate the identifier of the parent node of the last response node. For example, the response nodes corresponding to the first data are data node 1, data node 2, data node 4, and data node 6. Data node 1, data node 2, and data node 4 are all parent nodes of data node 6, and data node 6 is the last response node corresponding to the first data. Therefore, the first demarcation information is used to indicate the information of data node 6 (e.g., indicating the identifier of data node 6), and the first demarcation information is also used to indicate the information of each of data node 1, data node 2, and data node 4 (e.g., the identifiers of each of data node 1, data node 2, and data node 4), so that the first demarcation information can indicate data node 1, data node 2, data node 4, and data node 6. In this system, data node 4 is the direct parent node of data node 6, while data node 1 and data node 2 are both indirect parents of data node 6. For example, if data node 1 is identified as sec-policy, data node 2 as vsys[id=1], data node 4 as static-policy[id=1], and data node 6 as source-ip, then the first demarcation information can indicate: / sec-policy / vsys[id=1] / static-policy[id=1] / source-ip. The information indicated by the first demarcation information corresponds to a data path, which includes each response node corresponding to the information indicated by the first demarcation information.
[0084] In this embodiment, the query response device can send the first data and the first demarcation information to the query request device in the same message or packet, or send the first data and the first demarcation information to the query request device in different messages or packets. Optionally, the first demarcation information is located in the first data. This embodiment illustrates the example of the query response device sending the first data and the first demarcation information to the query request device in the same packet. The query response device can generate a first response packet carrying the first data and the first demarcation information, and send the first response packet to the query request device, thereby achieving the sending of the first data and the first demarcation information to the query request device. Optionally, if the query request device and the query response device are located in the same device, the first response packet can be a response instruction between different functional modules or components in the device, which is not limited in this embodiment.
[0085] S304. The query request device receives first data and first boundary information from the query response device.
[0086] Corresponding to the query response device sending first data and first demarcation information to the query request device, the query request device receives the first data and first demarcation information from the query response device. For example, the query request device receives a first response message from the query response device and parses the first response message to obtain the first data and first demarcation information.
[0087] S305. The query request device sends a second query request to the query response device. The second query request carries a second block size, a first boundary information and query conditions. The second block size indicates the maximum number of response nodes requested by the second query request.
[0088] After receiving the first data and the first boundary information, the query request device determines the second block size, generates a second query request based on the second block size, the first boundary information, and the aforementioned query conditions, and sends the second query request to the query response device. The second query request carries the second block size, the first boundary information, and the query conditions. The second block size indicates the maximum number of response nodes requested by the second query request. The maximum number represented by the second block size may be equal to or different from the maximum number represented by the first block size; this embodiment does not limit this. Similar to the first block size, the second block size can also indicate the size of the data requested by the second query request, or the size of the response message for the second query request.
[0089] In this embodiment, the query request device can determine whether to send the second query request based on whether it receives the first demarcation information (e.g., whether the first response message carries the first demarcation information). If the query request device receives the first demarcation information, it determines that there may still be data matching the query conditions in the data model of the query response device, and the entire data query process is not yet complete. The query request device then sends the second query request to the query response device. If the query request device does not receive the first demarcation information, it determines that there is no longer any data matching the query conditions in the data model of the query response device, and the entire data query process is complete. The query request device does not send the second query request to the query response device. Optionally, the query request device may also use other methods to determine whether the entire data query process is complete, which will not be elaborated here.
[0090] S306. The query response device queries the second data in the data model of the query response device based on the second block size, the first boundary information and the query conditions carried in the second query request.
[0091] The query request device sends a second query request to the query response device, and the query response device receives the second query request. After receiving the second query request, the query response device parses the second query request to obtain the second block size, the first boundary information, and the query conditions. Based on the second block size, the first boundary information, and the query conditions, the query response device queries the second data in its data model. The second data refers to the data in the data model that meets the query conditions. The second data may include data from response nodes and data describing the response nodes. The number of response nodes corresponding to the second data is less than or equal to the maximum number represented by the second block size.
[0092] Optionally, the query response device may query the second data in its data model based on the second block size, first boundary information, and query conditions carried in the second query request, which may include two possible implementation methods.
[0093] The first possible implementation is as follows: The query response device determines the last response node corresponding to the first data based on the first boundary information. In the data model of the query response device, it determines the next data node of the last response node. Based on the query conditions and the second block size, it sequentially traverses the data nodes in the data model, starting from the next data node of the last response node, to determine the data nodes (i.e., response nodes) that meet the query conditions, until the traversal stopping condition is reached. The query response device then determines the data of at least one response node (including the data in the at least one response node and the data used to describe the at least one response node) as the second data. The traversal stopping condition may include: the number of response nodes determined by the query response device is equal to the maximum number represented by the second block size, or the query response device has traversed all data nodes in the data model. If the traversal stopping condition is that the number of response nodes determined by the query response device is equal to the maximum number represented by the second block size, then the number of response nodes corresponding to the second data is equal to the maximum number represented by the second block size. If the traversal stopping condition is that the query response device has traversed all data nodes in the data model, the number of response nodes corresponding to the second data can be less than or equal to the maximum number represented by the second block size.
[0094] For example, the query response device for such Figure 2 The traversal order of data nodes 1 to 7 in the data model shown can be: Data node 1 -> Data node 2 -> Data node 4 -> Data node 6 -> Data node 7 -> Data node 5 -> Data node 3. Please refer to the following: Figure 4 , assume that the maximum quantity represented by the second block size is 4, and the first demarcation information is used to indicate the information of data node 6. The query response device determines that the last response node corresponding to the first data is data node 6 according to the information of the last response node corresponding to the first data indicated by the first demarcation information. The query response device determines the next data node of data node 6 in the data model as data node 7. The query response device traverses the data nodes in the data model in sequence starting from data node 7 according to the query condition and the second block size. Assume that data node 7 meets the query condition. When the query response device finishes traversing data node 7, it determines that the number of response nodes is equal to the maximum quantity represented by the second block size, and the query response device stops traversing. The query response device determines the data of data node 1, data node 2, data node 4, and data node 7 (including the data in data node 1, data node 2, data node 4, and data node 7 and the data used to describe data node 1, data node 2, data node 4, and data node 7) as the second data. Among them, data node 1, data node 2, and data node 4 are all parent nodes of data node 7, data node 4 is the direct parent node of data node 7, data node 2 is the grandparent node of data node 7, and data node 1 is the great-grandparent node of data node 7.
[0095] The second possible implementation method: The query response device determines the last response node corresponding to the first data according to the first demarcation information, and determines the data of n2 response nodes (the determination method of these n2 response nodes can refer to the second possible implementation method in S302) arranged in the traversal order as the second data according to the second block size. Among them, these n2 response nodes include n21 response nodes located after the last response node corresponding to the first data and arranged in the traversal order, and the parent nodes of these n21 response nodes, where n1 + n21 ≤ n. Among them, when n1 + n21 < n, n1 is the maximum quantity represented by the first block size, and n2 is the maximum quantity represented by the second block size; when n1 + n21 = n, n1 + n21 is the total number of response nodes in the data model.
[0096] For example, continuing with the second possible implementation in S302, the order of the n response nodes determined by the query response device is: data node 1 -> data node 2 -> data node 4 -> data node 6 -> data node 7 -> data node 5 -> data node 3. The response nodes corresponding to the first data are: data node 1, data node 2, data node 4, and data node 6. Based on the information of the last response node corresponding to the first data indicated by the first boundary information, the query response device determines that the last response node corresponding to the first data is data node 6. Assuming that the maximum quantity represented by the second block size is 4, the query response device determines the data of data node 1, data node 2, data node 4, and data node 7 (including the data in data node 1, data node 2, data node 4, and data node 7, as well as the data used to describe data node 1, data node 2, data node 4, and data node 7) as the second data based on the second block size. Among them, data node 7 is the response node located after the last response node corresponding to the first data, and data node 1, data node 2, and data node 4 are the parent nodes of data node 7.
[0097] As an optional implementation of this application embodiment, the query response device determines the second data from a full snapshot of the data corresponding to the data model based on the second block size, the first boundary information, and the query conditions. The specific implementation process can refer to the first possible implementation in S306. Alternatively, as another optional implementation of this application embodiment, the query response device determines the second data from a full snapshot of the data that meets the query conditions based on the second block size, the first boundary information, and the query conditions. The specific implementation process can refer to the second possible implementation in S306. This application embodiment, by obtaining the second data from a full snapshot of the data to be queried (e.g., the data corresponding to the data model, or the data that meets the query conditions), can avoid the impact of changes in the data to be queried during batch queries on the query results, thus ensuring the accuracy of the query results.
[0098] S307. The query response device sends second data and second boundary information to the query request device. The second boundary information is used to indicate the information of the next response node corresponding to the last response node of the first data. The second data includes the data of the next response node corresponding to the last response node of the first data.
[0099] The second data corresponds to at least one response node, which is arranged in traversal order. The at least one response node corresponding to the second data is arranged in traversal order as the at least one response node corresponding to the first data. The second boundary information is used to indicate the information of the next response node after the last response node corresponding to the first data. The second data includes the data of the next response node after the last response node corresponding to the first data. For example, the second boundary information indicates the identifier of the next response node after the last response node corresponding to the first data, thus indicating the next response node after the last response node corresponding to the first data. For instance, the last response node corresponding to the first data is data node 6, and the response nodes corresponding to the second data are data node 1, data node 2, data node 4, and data node 7. Data node 7 is the next response node after data node 6; therefore, the second boundary information is used to indicate the information of data node 7, thus indicating data node 7.
[0100] In one optional implementation of this application, the second boundary information is used not only to indicate the information of the next response node of the last response node corresponding to the first data, but also to indicate the information of the parent node of the next response node of the last response node corresponding to the first data, so as to indicate the next response node and the parent node of the next response node corresponding to the first data. For example, the second boundary information is used to indicate the identifier of the next response node of the last response node corresponding to the first data, and also to indicate the identifier of the parent node of the next response node of the last response node corresponding to the first data. For example, the response nodes corresponding to the second data are data node 1, data node 2, data node 4, and data node 7. Data node 1, data node 2, and data node 4 are all parent nodes of data node 7. Data node 7 is the next response node after the last response node corresponding to the first data. Therefore, the second boundary information is used to indicate the information of data node 7 (e.g., indicating the identifier of data node 7). Furthermore, the second boundary information is also used to indicate the information of each of data node 1, data node 2, and data node 4 (e.g., the identifiers of each of data node 1, data node 2, and data node 4). Thus, the second boundary information can indicate data node 1, data node 2, data node 4, and data node 7. Here, data node 4 is the direct parent node of data node 7, and data node 1 and data node 2 are both indirect parent nodes of data node 7. For example, data node 1 is identified as sec-policy, data node 2 is identified as vsys[id=1], data node 4 is identified as static-policy[id=1], and data node 7 is identified as destination-ip. This second demarcation information can indicate / sec-policy / vsys[id=1] / static-policy[id=1] / destination-ip. The information indicated by this second demarcation information corresponds to a data path, which includes each response node corresponding to the information indicated by the second demarcation information.
[0101] In this embodiment, the query response device can send the second data and the second boundary information to the query request device in the same message or packet, or send the second data and the second boundary information to the query request device in different messages or packets. Optionally, the second boundary information is located in the second data. This embodiment illustrates the example of the query response device sending the second data and the second boundary information to the query request device in the same packet. The query response device can generate a second response packet carrying the second data and the second boundary information, and send the second response packet to the query request device, thereby achieving the sending of the second data and the second boundary information to the query request device.
[0102] In this embodiment, the method by which the query response device obtains data (e.g., the second data) from a full snapshot of the data to be queried is called a stateful query method, and the method by which the query response device obtains data (e.g., the second data) from the data model according to the query conditions is called a stateless query method. S306 and S307 of this embodiment are illustrated using the example of a last response node corresponding to the first data existing in the data model. In one possible implementation, for the stateless query method, if a third party modifies the data model, the last response node corresponding to the first data may no longer exist in the data model when the query response device queries the second data. In this case, the query response device can return a query failure message to the query request device, or the query response device can reselect the starting node for traversal based on a certain processing strategy. For example, the query response device can use the parent node (e.g., the direct parent node) of the last response node corresponding to the first data as the starting node for data querying. This embodiment does not limit this approach.
[0103] S308, The query request device receives second data and second boundary information from the query response device.
[0104] Corresponding to the query response device sending second data and second boundary information to the query request device, the query request device receives the second data and second boundary information from the query response device. For example, the query request device receives a second response message from the query response device and parses the second response message to obtain the second data and second boundary information.
[0105] S309. The query request device integrates the first data and the second data based on the first boundary information and the second boundary information.
[0106] The first boundary information is used to indicate the information of the last response node corresponding to the first data, and the second boundary information is used to indicate the information of the next response node corresponding to the last response node of the first data. Alternatively, the first boundary information is used to indicate the information of the last response node corresponding to the first data and the information of its parent node, and the second boundary information is used to indicate the information of the next response node corresponding to the last response node and the information of its parent node. Depending on the different contents indicated by the first and second boundary information, S309 includes two possible implementations.
[0107] One possible implementation: First boundary information is used to indicate the information of the last response node corresponding to the first data, and second boundary information is used to indicate the information of the next response node corresponding to the last response node corresponding to the first data. The query request device integrates the first data and the second data based on the information of the last response node corresponding to the first data indicated by the first boundary information and the information of the next response node corresponding to the last response node corresponding to the first data indicated by the second boundary information. The second data includes the data of the next response node corresponding to the last response node of the first data.
[0108] Optionally, the query request device determines the information of the last response node corresponding to the first data based on the first boundary information, determines the last response node based on the information of the last response node, and then determines the information of the parent node of the last response node by traversing the first data, and determines the parent node of the last response node based on the information of the parent node of the last response node. Additionally, the query request device determines the information of the next response node corresponding to the last response node of the first data based on the second boundary information, determines the next response node based on the information of the next response node, and then determines the information of the parent node of the next response node by traversing the second data, and determines the parent node of the next response node based on the information of the parent node of the next response node. Subsequently, the query request device identifies the common parent node among the parent node of the last response node corresponding to the first data and the parent node of the next response node (that is, the target parent node is the parent node of the last response node and the parent node of the next response node). It then identifies the response nodes corresponding to the second data, excluding the target parent node, as target nodes. The device then extracts the data of the target nodes from the second data and merges the target node data with the first data to integrate the first and second data. For example, the query request device merges the target node data into the first data according to the encoding format of the first and second data.
[0109] As an optional implementation, the first boundary information is located in the first data, and the first boundary information corresponds to the information of the last response node corresponding to the first data (for example, the first boundary information and the information of the last response node corresponding to the first data are located in the same row of data). The query request device traverses the first data in order from the last row of the first data to the first row of the first data to determine the first boundary information from the first data, determine the information of the last response node corresponding to the first data based on the first boundary information, determine the information of the parent node of the last response node, determine the last response node based on the information of the last response node, and determine the parent node of the last response node based on the information of the parent node of the last response node. The second boundary information is located in the second data. The second boundary information corresponds to the information of the next response node of the last response node corresponding to the first data (for example, the second boundary information and the information of the next response node are located in the same row of data). The query request device traverses the second data in order from the first row to the last row of the second data to determine the second boundary information from the second data. Based on the second boundary information, it determines the information of the next response node of the last response node corresponding to the first data, and determines the information of the parent node of the next response node. Based on the information of the next response node, it determines the next response node, and based on the information of the parent node of the next response node, it determines the parent node of the next response node.
[0110] It should be noted that during the process of the query request device traversing the first data, when the query request device determines the information of the last response node corresponding to the first data and the information of the parent node of the last response node, the query request device stops traversing (that is, the query request device does not need to traverse the first data completely), which can reduce the processing overhead of the query request device. Similarly, during the process of the query request device traversing the second data, when the query request device determines the information of the next response node corresponding to the last response node of the first data and the information of the parent node of the next response node, the query request device stops traversing (that is, the query request device does not need to traverse the second data completely), which can reduce the processing overhead of the query request device.
[0111] As an example of an embodiment of this application, please refer to Figure 5 This illustration shows a schematic diagram of integrating first data and second data according to an embodiment of this application. See also... Figure 5 and combined Figure 4 In the first data, "xx:border="backward" is the first demarcation information, used to indicate the information of the last response node corresponding to the first data (e.g., the information "source-ip" for data node 6). In the second data, "xx:border="forward" is the second demarcation information, used to indicate the information of the next response node corresponding to the last response node of the first data (e.g., the information "destination-ip" for data node 7). The query request device proceeds from the last line of the first data to the first line of the first data.<sec-policy xmlns="xx”> The query request device iterates through the first data in the order of "xx:border=", to determine the first boundary information "xx:border="="backward"". Based on the first boundary information "xx:border="backward", it determines the information of the last response node corresponding to the first data (e.g., the information of data node 6, "source-ip"). Then, it determines the information of the parent node of the last response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The query request device determines that the last response node is data node 6 based on the information of the last response node, and determines that the parent nodes of the last response node include data node 4, data node 2, and data node 1 based on the information of the parent node of the last response node. Additionally, the query request device proceeds according to the first row of the second data...<sec-policy xmlns="xx”> The system iterates through the second data in the order of "to the last row of the second data" to determine the second boundary information "xx:border" = "forward" from the second data. Based on the second boundary information "xx:border" = "forward", it determines the information of the next response node corresponding to the last response node of the first data (e.g., the information of data node 7, "destination-ip"). It also determines the information of the parent node of the next response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The query request device determines that the next response node is data node 7 based on the information of the next response node, and determines that the parent nodes of the next response node include data node 4, data node 2, and data node 1 based on the information of the parent node of the next response node.Since the parent nodes of the last response node (e.g., data node 6) and the next response node (e.g., data node 7) of the first data share the same parent nodes as data node 4, data node 2, and data node 1, the query request device identifies data node 4, data node 2, and data node 1 as the target parent nodes. Among the response nodes (data node 1, data node 2, data node 4, and data node 7) of the second data, the response node other than the target parent node is data node 7; therefore, the query request device identifies data node 7 as the target node. The query request device determines (e.g., extracts) the data "destination-ip" of data node 7 from the second data, and merges the data "destination-ip" of the target node into the first data according to the encoding formats of the first and second data, obtaining the integrated data as shown. Figure 5 As shown. The response nodes corresponding to the integrated data include data node 1, data node 2, data node 4, data node 6, and data node 7. Data node 6 and data node 7 are sibling nodes, and data node 4, data node 2, and data node 1 are all parent nodes of data node 6 and data node 7.
[0112] A second possible implementation: The first boundary information is used to indicate the information of the last response node corresponding to the first data, and also to indicate the information of the parent node of the last response node. The second boundary information is used to indicate the information of the next response node corresponding to the last response node of the first data, and also to indicate the information of the parent node of the next response node. The query request device determines the information of the last response node corresponding to the first data and the information of the parent node of the last response node based on the first boundary information, determines the last response node based on the information of the last response node, and determines the parent node of the last response node based on the information of the parent node of the last response node. Furthermore, the query request device determines the information of the next response node corresponding to the last response node of the first data and the information of the parent node of the next response node based on the second boundary information, determines the next response node based on the information of the next response node, and determines the parent node of the next response node based on the information of the parent node of the next response node. Subsequently, the query request device identifies the same parent node among the parent node of the last response node corresponding to the first data and the parent node of the next response node of the last response node as the target parent node (that is, the target parent node is the parent node of the last response node and the parent node of the next response node). It identifies the response nodes other than the target parent node among the response nodes corresponding to the second data as target nodes, determines (for example, extracts) the data of the target nodes from the second data, and merges the data of the target nodes with the first data to integrate the first data and the second data.
[0113] As an example of an embodiment of this application, please refer to Figure 6 This illustrates another schematic diagram of integrating first and second data according to an embodiment of this application. See also... Figure 6 and combined Figure 4 In the first data, "xx:border" = "backward" is the first demarcation information. The first demarcation information indicates the information of the last response node corresponding to the first data (e.g., the information of data node 6, "source-ip") and the information of the parent node of the last response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The query request device determines that the parent node of the last response node includes data node 4, data node 2, and data node 1 based on the parent node information of the last response node. The "xx:border"="forward"" in the second data is the second demarcation information. This second demarcation information indicates the information of the next response node corresponding to the last response node of the first data (e.g., the information of data node 7, "destination-ip") and the information of the parent node of that next response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The query request device determines the parent nodes of the next response node based on this information, including data node 4, data node 2, and data node 1. Based on the first and second demarcation information, the query request device determines that among the parent nodes of the last response node corresponding to the first data and the parent nodes of the next response node of that last response node, the common parent nodes are data node 4, data node 2, and data node 1. Therefore, the query request device identifies data node 4, data node 2, and data node 1 as the target parent nodes. Of the response nodes (data node 1, data node 2, data node 4, and data node 7) corresponding to the second data, the response node other than the target parent node is data node 7. Therefore, the query request device identifies data node 7 as the target node. The query request device extracts the data "destination-ip" of data node 7 from the second data, and merges the target node's data "destination-ip" into the first data according to the encoding format of the first and second data, obtaining the integrated data as follows: Figure 6 As shown. The response nodes corresponding to the integrated data include data node 1, data node 2, data node 4, data node 6, and data node 7. Data node 6 and data node 7 are sibling nodes, and data node 4, data node 2, and data node 1 are all parent nodes of data node 6 and data node 7.
[0114] In this embodiment, the first boundary information may be located in the first data, and the second boundary information may be located in the second data. When the query request device integrates the first data and the second data, it may delete the first boundary information from the first data and the second boundary information from the second data. This embodiment does not limit this. For example Figure 5 and Figure 6 As shown, when the query request device integrates the first data and the second data, it deletes the first boundary information from the first data and the second boundary information from the second data. Furthermore, the encoding format of the first data and the encoding format of the second data can be XML or JSON format. Figure 5 and Figure 6 Taking the example where both the first and second data are encoded in XML format, the process of integrating the first and second data can be described as follows: Figure 5 and Figure 6 The embodiments of this application will not be described in detail here.
[0115] In summary, the data query method provided in this application embodiment involves a query response device sending first data and first boundary information, as well as second data and second boundary information, to a query request device based on a batch query request sent by the query request device. The first boundary information indicates the last response node corresponding to the first data, and the second boundary information indicates the next response node after that last response node. The second data includes the data of the next response node. The query request device integrates the first data and the second data based on the first and second boundary information, which helps reduce the processing overhead of the data query scheme. Furthermore, this data query scheme supports data querying of any type of data node, enabling batch data querying using any type of data node in the data model as a boundary point. This provides high flexibility in data querying, with minimal differences in the amount of data retrieved in different batches, allowing for more precise control over the amount of data in each batch.
[0116] In this embodiment, the number of response nodes corresponding to the first data can be equal to the maximum number represented by the first block size, and the number of response nodes corresponding to the second data can be less than or equal to the maximum number represented by the second block size. If the number of response nodes corresponding to the second data is less than the maximum number represented by the second block size, the query response device determines that all data in the data model that meets the query conditions has been found when it finds the second data. If the number of response nodes corresponding to the second data is equal to the maximum number represented by the second block size, the query response device determines that there may still be data in the data model that meets the query conditions when it finds the second data. In one possible implementation, if the number of response nodes corresponding to the second data is equal to the maximum number represented by the second block size, the query response device can also send boundary information to the query request device to indicate the information of the last response node corresponding to the second data, so that the query request device continues to send batch query requests to the query response device to perform data query. Therefore, as an optional implementation of this embodiment, in... Figure 3 Based on this, the data query method may also include the following: Figure 7 The content shown.
[0117] For example, please refer to Figure 7 It illustrates a flowchart of another data query method provided in an embodiment of this application. Figure 3 Based on this, the data query method also includes:
[0118] S310, The query response device sends third boundary information to the query request device, which is used to indicate the information of the last response node corresponding to the second data.
[0119] The second data corresponds to at least one response node, which can be arranged in traversal order. The third demarcation information is used to indicate the information of the last response node among the at least one response node, thereby indicating the last response node. The information of the last response node may include its identifier and / or name. For example, the third demarcation information indicates the identifier of the last response node corresponding to the second data. For instance, the response nodes corresponding to the second data are data node 1, data node 2, data node 4, and data node 7. The traversal order of the query response device for data node 1, data node 2, data node 4, and data node 7 is: data node 1 -> data node 2 -> data node 4 -> data node 7. Therefore, the third demarcation information is used to indicate the information of data node 7, thereby indicating data node 7.
[0120] In one optional implementation of this application, the third boundary information is used not only to indicate the information of the last response node corresponding to the second data, but also to indicate the information of the parent node (including direct parent node and indirect parent node) of the last response node corresponding to the second data. For example, the third boundary information is used to indicate the identifier of the last response node corresponding to the second data, and also to indicate the identifier of the parent node of the last response node, so as to indicate the last response node and the parent node of the last response node. For example, the response nodes corresponding to the second data are data node 1, data node 2, data node 4 and data node 7. Data node 1, data node 2 and data node 4 are all parent nodes of data node 7, and data node 7 is the last response node corresponding to the second data. Therefore, the third boundary information is used to indicate the information of data node 7 (e.g., indicating the identifier of data node 7), and the third boundary information is also used to indicate each of data node 1, data node 2 and data node 4 (e.g., the identifiers of each of data node 1, data node 2 and data node 4), so that the third boundary information can indicate data node 1, data node 2, data node 4 and data node 7. For example, if data node 1 is identified as sec-policy, data node 2 as vsys[id=1], data node 4 as static-policy[id=1], and data node 7 as destination-ip, then the third demarcation information can indicate: / sec-policy / vsys[id=1] / static-policy[id=1] / destination-ip. The information indicated by the third demarcation information corresponds to a data path, which includes each response node corresponding to the information indicated by the third demarcation information. Based on the description in S307 and combined with S310, it can be understood that data node 7 is the next response node after the last response node corresponding to the first data, and data node 7 is also the last response node corresponding to the second data. The third demarcation information is the same as the aforementioned second demarcation information.
[0121] In this embodiment, the query response device can send the third demarcation information and the second data to the query request device in the same message or packet, or send the third demarcation information and the second data to the query request device in different messages or packets. This embodiment does not limit this. Optionally, the third demarcation information is located in the second data. This embodiment illustrates the example of the query response device sending the third demarcation information and the second data to the query request device in the same packet. The query response device can send the third demarcation information to the query request device in the second response packet described in S307. That is, the query response device can send a second response packet to the query request device, which carries the second data, the second demarcation information, and the third demarcation information. S310 and S307 can be implemented through the same step.
[0122] S311, The query request device receives the third boundary information from the query response device.
[0123] Corresponding to the query response device sending third demarcation information to the query request device, the query request device receives the third demarcation information from the query response device. For example, the query request device receives a second response message from the query response device and parses the second response message to obtain the third demarcation information. Here, S311 and the aforementioned S308 can be implemented through the same step.
[0124] S312. The query request device sends a third query request to the query response device. The third query request carries a third block size, a third boundary information and query conditions. The third block size indicates the maximum number of response nodes requested by the third query request.
[0125] After receiving the third boundary information, the query request device determines the third block size, generates a third query request based on the third block size, the third boundary information, and the aforementioned query conditions, and sends the third query request to the query response device. The third query request carries the third block size, the third boundary information, and the query conditions. The third block size indicates the maximum number of response nodes requested by the third query request. The maximum number represented by the third block size may be equal to or different from the maximum number represented by the first block size and the maximum number represented by the second block size; this embodiment does not limit this. Similar to the first block size, the third block size can also indicate the size of the data requested by the third query request, or the size of the response message for the third query request.
[0126] In this embodiment, the query request device can determine whether to send the third query request based on whether it receives the third demarcation information (e.g., whether the third demarcation information is carried in the second response message). If the query request device receives the third demarcation information, it determines that there may still be data matching the query conditions in the data model of the query response device, and the entire data query process is not yet complete. The query request device then sends the third query request to the query response device. If the query request device does not receive the third demarcation information, it determines that there is no longer any data matching the query conditions in the data model of the query response device, and the entire data query process is complete. The query request device then does not send the third query request to the query response device.
[0127] S313. The query response device queries the third data in the data model of the query response device based on the third block size, third boundary information and query conditions carried in the third query request.
[0128] The query request device sends a third query request to the query response device, and the query response device receives the third query request. After receiving the third query request, the query response device parses the third query request to obtain the third block size, third boundary information, and query conditions. Based on the third block size and the query conditions, the query response device queries third data in its data model. The third data refers to the data in the data model that meets the query conditions. The third data may include data from response nodes and data describing the response nodes. The number of response nodes corresponding to the third data is less than or equal to the maximum number represented by the third block size.
[0129] Optionally, the query response device may query the third data in its data model based on the third block size, third boundary information, and query conditions carried in the third query request. This may include two possible implementation methods:
[0130] The first possible implementation is as follows: The query response device determines the last response node corresponding to the second data based on the third boundary information. In the data model of the query response device, it determines the next data node of the last response node. Based on the query conditions and the third block size, it sequentially traverses the data nodes in the data model, starting from the next data node of the last response node, to determine the data nodes (i.e., response nodes) that meet the query conditions, until the traversal stopping condition is reached. The query response device then determines the data of at least one response node (including the data in the at least one response node and the data used to describe the at least one response node) as the third data. The traversal stopping condition may include: the number of response nodes determined by the query response device is equal to the maximum number represented by the third block size, or the query response device has traversed all data nodes in the data model. If the traversal stopping condition is that the number of response nodes determined by the query response device is equal to the maximum number represented by the third block size, then the number of response nodes corresponding to the third data is equal to the maximum number represented by the third block size. If the traversal stopping condition is that the query response device has traversed all data nodes in the data model, the number of response nodes corresponding to the third data can be less than or equal to the maximum number represented by the third block size.
[0131] For example, the query response device for such Figure 2 The traversal order of data nodes 1 to 7 in the data model shown can be: Data node 1 -> Data node 2 -> Data node 4 -> Data node 6 -> Data node 7 -> Data node 5 -> Data node 3. Please refer to the following: Figure 4 Assuming the maximum quantity represented by the third block size is 4, and the third boundary information is used to indicate the information of data node 7, the query response device determines the last response node corresponding to the second data as data node 7 based on the information of the last response node indicated by the third boundary information. In the data model, the next data node is determined to be data node 5. Based on the query conditions and the third block size, the query response device traverses the data nodes in the data model sequentially, starting from data node 5. Assuming both data node 5 and data node 3 meet the query conditions, when the query response device finishes traversing data node 3, it determines that the number of response nodes equals the maximum quantity represented by the third block size. The query response device then stops traversing and determines the data of data node 1, data node 2, data node 5, and data node 3 (including the data in data node 1, data node 2, data node 5, and data node 3, as well as the data used to describe data node 1, data node 2, data node 5, and data node 3) as the third data. Here, data node 1 and data node 2 are the parent nodes of data node 5, and data node 1 is the parent node of data node 3.
[0132] The second possible implementation: The query response device determines the last response node corresponding to the second data based on the second boundary information. Based on the third block size, it determines the data (including the data within the n3 response nodes and the data used to describe the n3 response nodes) from the n response nodes arranged in traversal order (the method for determining these n response nodes can refer to the second possible implementation in S302) as the third data. These n3 response nodes include n31 response nodes located after the last response node corresponding to the second data and arranged in traversal order, and the parent nodes of these n31 response nodes, where n1+n2+n31≤n. When n1+n2+n31≤n, n1 is the maximum number represented by the first block size, n2 is the maximum number represented by the third block size, and n3 is the maximum number represented by the third block size; when n1+n2+n31=n, n1+n2+n31 is the total number of response nodes in the data model.
[0133] For example, continuing with the second possible implementation in S302, the order of the n response nodes determined by the query response device is: data node 1 -> data node 2 -> data node 4 -> data node 6 -> data node 7 -> data node 5 -> data node 3. The response nodes corresponding to the second data are: data node 1, data node 2, data node 4, and data node 7. Based on the information of the last response node corresponding to the second data indicated by the third boundary information, the query response device determines that the last response node corresponding to the second data is data node 7. Assuming that the maximum quantity represented by the third block size is 4, the query response device determines the data of data node 1, data node 2, data node 5, and data node 3 (including the data in data node 1, data node 2, data node 5, and data node 3, as well as the data used to describe data node 1, data node 2, data node 5, and data node 3) as the third data based on the third block size. Among them, data node 5 and data node 3 are two response nodes located after the last response node corresponding to the second data and arranged in traversal order. Data node 1 and data node 2 are the parent nodes of data node 5, and data node 1 is the parent node of data node 3.
[0134] Similarly to S306, the query response device can determine the third data from a full snapshot of the data corresponding to the data model based on the third block size, third boundary information, and query conditions; or, based on the third block size, third boundary information, and query conditions, determine the third data from a full snapshot of the data that meets the query conditions. This embodiment of the application, by obtaining the third data from a full snapshot of the data to be queried, can avoid the impact of changes in the data to be queried during batch queries on the query results, thus ensuring the accuracy of the query results.
[0135] S314. The query response device sends third data and fourth boundary information to the query request device. The fourth boundary information is used to indicate the information of the next response node corresponding to the last response node of the second data. The third data includes the data of the next response node corresponding to the last response node of the second data.
[0136] The third data corresponds to at least one response node, which is arranged in traversal order. The at least one response node corresponding to the third data is arranged in traversal order as the at least one response node corresponding to the second data. The fourth boundary information is used to indicate the information of the next response node after the last response node corresponding to the second data. The third data includes the data of the next response node after the last response node corresponding to the second data. For example, the fourth boundary information indicates the identifier of the next response node corresponding to the second data, thus indicating the next response node. For instance, the last response node corresponding to the second data is data node 7, and the response nodes corresponding to the third data are data node 1, data node 2, data node 5, and data node 3. Data node 5 is the next response node after data node 7. Therefore, the fourth boundary information can be used to indicate the information of data node 5, thus indicating data node 5.
[0137] In one optional implementation of this application, the fourth boundary information is used not only to indicate the information of the next response node of the last response node corresponding to the second data, but also to indicate the information of the parent node of the next response node. For example, the fourth boundary information is used to indicate the identifier of the next response node of the last response node corresponding to the second data, and also to indicate the identifier of the parent node of the next response node, so as to indicate the next response node and the parent node of the last response node corresponding to the second data. For example, the response nodes corresponding to the third data are data node 1, data node 2, data node 5 and data node 3. Data node 1 and data node 2 are both the parent nodes of data node 5, and data node 1 is the parent node of data node 3. Data node 5 is the next response node of the last response node (i.e., data node 7) corresponding to the second data. Therefore, the fourth boundary information is used to indicate the information of data node 5 (e.g., indicating the identifier of data node 5), and the fourth boundary information also indicates the information of data node 1 and data node 2 respectively (the identifiers of data node 1 and data node 2 respectively), so that the fourth boundary information can indicate data node 1, data node 2 and data node 5. For example, data node 1 is identified as sec-policy, data node 2 is identified as vsys[id=1], and data node 5 is identified as static-policy[id=2]. The fourth demarcation information can indicate: / sec-policy / vsys[id=1] / static-policy[id=2]. The information indicated by the fourth demarcation information corresponds to a data path, which includes each response node corresponding to the information indicated by the fourth demarcation information.
[0138] In this embodiment, the query response device can send the third data and the fourth boundary information to the query request device in the same message or packet, or send them in different messages or packets. Optionally, the fourth boundary information is located in the third data. This embodiment illustrates the example of the query response device sending the third data and the fourth boundary information to the query request device in the same packet. The query response device can generate a third response packet carrying the third data and the fourth boundary information, and send the third response packet to the query request device, thereby achieving the sending of the third data and the fourth boundary information to the query request device.
[0139] S315, The query request device receives the third data and the fourth boundary information.
[0140] Corresponding to the query response device sending third data and fourth boundary information to the query request device, the query request device receives the third data and fourth boundary information from the query response device. For example, the query request device receives a third response message from the query response device and parses the third response message to obtain the third data and fourth boundary information.
[0141] S316. The query request device integrates the second data with the third data based on the third boundary information and the fourth boundary information.
[0142] The implementation process of S316 can be referred to S309, and will not be repeated here in the embodiments of this application. Here, we mainly take the integration of the first data, the second data and the third data as an example to introduce the process of integrating data queried from multiple batches.
[0143] In this embodiment, if the number of batch queries is greater than two, the query request device can integrate the data from multiple batches for data fusion. For example, the query request device can perform rolling integration of data from multiple batches according to the query batches. This can be done by rolling integration of the data from multiple batches in the order of the query batches from front to back, or by rolling integration of the data from multiple batches in the order of the query batches from back to front, or by integrating the data from adjacent batches in other orders. For example, assuming that k batch queries are performed in a complete query process, and the query batches are 1, 2, 3...k, then rolling integration of data from multiple batches in the order of the query batches from front to back can be as follows: first, integrate the data from the second batch into the data from the first batch to obtain integrated data D11; then integrate the data from the third batch into integrated data D11 to obtain integrated data D12; then integrate the data from the fourth batch into integrated data D12 to obtain integrated data D13, and so on. The rolling integration of data from multiple batches of queries, in reverse order from the last to the first, can be done as follows: First, integrate the data from the kth batch into the data from the (k-1)th batch to obtain integrated data D21. Then, integrate the data from the (k-2)th batch into integrated data D21 to obtain integrated data D22. After that, integrate the data from the (k-3)th batch into integrated data D22 to obtain integrated data D23, and so on.
[0144] Taking the example of a query request device integrating first, second, and third data in the order of query batches from front to back, the query request device first integrates the second data into the first data to obtain the first integrated data, and then integrates the third data into the first integrated data to obtain the second integrated data. The second complete data is the final data after integrating the first, second, and third data. The process of integrating the first, second, and third data is described below with an example.
[0145] As an example of an embodiment of this application, please refer to Figure 8 It illustrates a schematic diagram of integrating first data, second data, and third data according to an embodiment of this application. Figure 8 Taking the following example: the first boundary information is used to indicate the information of the last response node corresponding to the first data; the second boundary information is used to indicate the information of the next response node corresponding to the last response node of the first data; the third boundary information is used to indicate the information of the last response node corresponding to the second data; and the fourth boundary information is used to indicate the information of the next response node corresponding to the last response node of the second data (that is...) Figure 8 The example shown corresponds to the first possible implementation in S309. (See also...) Figure 8 and combined Figure 4 In the first data, "xx:border="backward" is the first delimiter, used to indicate the information of the last responding node corresponding to the first data (e.g., the information "source-ip" for data node 6). In the second data, "both" represents backward and forward, and "xx:border="both" is the second and third delimiter. The second delimiter indicates the information of the next responding node corresponding to the last responding node of the first data (e.g., the information "destination-ip" for data node 7), and the third delimiter also indicates the information of the last responding node corresponding to the second data (e.g., the information "destination-ip" for data node 7). In the third data, "xx:border="forward" is the fourth delimiter, used to indicate the information of the next responding node corresponding to the last responding node of the second data (e.g., the information "static-policy[id=2]" for data node 5). The query request device proceeds from the last line of the first data to the first line of the first data.<sec-policy xmlns="xx”> The system iterates through the first data in the order of "xx:border" to determine the first boundary information "xx:border" = "backward". Based on the first boundary information "xx:border" = "backward", it determines the information of the last response node corresponding to the first data (e.g., the information of data node 6, "source-ip"). Then, it determines the information of the parent node of the last response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The query request device determines that the last response node corresponding to the first data is data node 6 based on the information of the last response node corresponding to the first data. Based on the information of the parent node of the last response node, it determines that the parent nodes of the last response node include data node 4, data node 2, and data node 1.And, the query request device follows the first row of the second data.<sec-policy xmlns="xx”> The process iterates through the second data in the order of "towards the last line of the second data" to determine the second boundary information "xx:border" = "both". Based on the second boundary information "xx:border" = "both", it determines the information of the next response node corresponding to the last response node of the first data (e.g., the information of data node 7, "destination-ip"). It then determines the information of the parent node of this next response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The query request device determines that the next response node of the last response node corresponding to the first data is data node 7 based on the information of the next response node of the last response node corresponding to the first data. Based on the information of the parent node of this next response node, it determines that the parent nodes of this next response node include data node 4, data node 2, and data node 1. Since the parent nodes of the last response node (e.g., data node 6) and the next response node (e.g., data node 7) of the first data share the same parent nodes, data node 4, data node 2, and data node 1, the query request device confirms that data node 4, data node 2, and data node 1... The target parent node is defined as Data Node 1. Among the response nodes (Data Node 1, Data Node 2, Data Node 4, and Data Node 7) corresponding to the second data, Data Node 7 is the only response node other than the target parent node. Therefore, the query request device identifies Data Node 7 as the target node. Similarly, the query request device determines that among the parent nodes of the last response node (e.g., Data Node 7) and the next response node (e.g., Data Node 5) corresponding to the second data, Data Node 2 and Data Node 1 share the same parent node. Therefore, the query request device identifies Data Node 2 and Data Node 1 as the target parent nodes. The response nodes (Data Node 1, Data Node 2, Data Node 4, and Data Node 7) corresponding to the third data are also defined as Data Node 7. In the data nodes (nodes 2, 5, and 3), the response nodes other than the target parent node are data nodes 5 and 3. Therefore, the query request device identifies data nodes 5 and 3 as the target nodes. The query request device extracts data from data node 7 from the second data and integrates the data corresponding to data node 7 into the first data according to the encoding formats of the first and second data to obtain the first integrated data. Then, the query request device extracts data from data nodes 5 and 3 from the third data and integrates the data from data nodes 5 and 3 into the first integrated data according to the encoding format to obtain the final integrated data (e.g., the second integrated data). Figure 8 As shown.
[0146] As another example of an embodiment of this application, please refer to Figure 9 This illustration shows another schematic diagram of integrating first data, second data, and third data according to an embodiment of this application. Figure 9 The following example illustrates how first boundary information is used to indicate the information of the last response node corresponding to the first data and the information of its parent node; second boundary information is used to indicate the information of the next response node corresponding to the last response node of the first data and the information of its parent node; third boundary information is used to indicate the information of the last response node corresponding to the second data and the information of its parent node; and fourth boundary information is used to indicate the information of the next response node corresponding to the last response node of the second data and the information of its parent node. Figure 8 The example shown corresponds to the second possible implementation in S309. (See also...) Figure 9 and combined Figure 4 In the first data, "xx:border" = "backward" is the first demarcation information. The first demarcation information indicates the information of the last response node corresponding to the first data (e.g., the information of data node 6, "source-ip") and the information of the parent node of the last response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). In the second data, "both" represents backward and forward. "xx:border" = "both" represents the second and third boundary information. The second boundary information indicates the information of the next response node corresponding to the last response node of the first data (e.g., the information of data node 7, "destination-ip") and the information of the parent node of the next response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The third boundary information indicates the information of the last response node corresponding to the second data (e.g., the information of data node 7, "destination-ip") and the information of the parent node of the last response node (e.g., the information of data node 4, "static-policy[id=1]", the information of data node 2, "vsys[id=1]", and the information of data node 1, "sec-policy"). The "xx:border"="forward"" in the third data is the fourth demarcation information. This fourth demarcation information indicates the information of the next response node after the last response node corresponding to the second data (e.g., the information for data node 5, "destination-ip") and the information of the parent node of that next response node (e.g., the information for data node 2, "vsys[id=1]", and the information for data node 1, "sec-policy"). Based on the first and second demarcation information, the query request device determines that among the parent nodes of the last response node corresponding to the first data and the parent nodes of the next response node, the common parent nodes are data nodes 4, 2, and 1. Therefore, the query request device identifies data nodes 4, 2, and 1 as the target parent nodes. Among the response nodes (data nodes 1, 2, 4, and 7) corresponding to the second data, the response node other than the target parent node (i.e., data nodes 4, 2, and 1) is data node 7. Therefore, the query request device identifies data node 7 as the target node.Similarly, the query request device determines the parent node of the last response node corresponding to the second data and the parent node of the next response node of the last response node based on the third and fourth boundary information. The common parent nodes are data node 2 and data node 1. Therefore, the query request device determines data node 2 and data node 1 as the target parent nodes. Among the response nodes (data node 1, data node 2, data node 5, and data node 3) corresponding to the third data, the response nodes other than the target parent nodes (i.e., data node 2 and data node 1) are data node 5 and data node 3. The query request device determines data node 5 and data node 3 as the target nodes. The query request device extracts the data of data node 7 from the second data and integrates the data corresponding to data node 7 into the first data according to the encoding format of the first and second data to obtain the first integrated data. Then, the query request device extracts the data of data node 5 and data node 3 from the third data and integrates the data of data node 5 and data node 3 into the first integrated data according to the encoding format to obtain the final integrated data (e.g., the second integrated data). Figure 9 As shown.
[0147] In this embodiment, the first boundary information can be located in the first data, the second and third boundary information can be located in the second data, and the fourth boundary information can be located in the third data. When the query request device integrates the first, second, and third data, it can delete the first boundary information from the first data, delete the second and third boundary information from the second data, and delete the fourth boundary information from the third data. This embodiment does not limit this. Figure 8 and Figure 9 As shown, when integrating the first data, second data, and third data, the query request device also removes the demarcation information from each of the three data sets. Furthermore, the encoding formats of the first data, second data, and third data can be XML or JSON formats. Figure 8 and Figure 9 Taking the encoding formats of the first, second, and third data as XML as an example, the integration process can be further explained when all three data formats are JSON. Figure 8 and Figure 9 The embodiments of this application will not be described in detail here.
[0148] In this embodiment, the data model can be a YANG model, and each data node in the data model can be one of a leaf node, a leaf-list node, a container node, or a list node, for example... Figure 2 Each data node in the data nodes 1-7 can be a leaf node, leaf-list node, container node, or list node. When performing data queries in the data model, the query response device can treat each data node as a single node, regardless of its type. For example, a list node can actually be a collection of data nodes. The query response device treats the list node as a single data node during data queries, thus avoiding the data from the same list node being divided into different batches and ensuring the relative integrity of the batched data.
[0149] The data query method provided in this application embodiment can be implemented by... <get> 、 <get-config> 、 <get-data>This is achieved by extending parameter fields in RPC operations, that is, by extending parameter fields in the query request. For example, taking the YANG data model as an example, the following parameter fields can be extended in the RPC interface:
[0150]
[0151]
[0152] The bulk-size parameter represents the block size, such as the first block size, the second block size, and the third block size mentioned above; the last-node parameter represents the parameter used to indicate the last response node corresponding to the previous batch of data, such as the first boundary information and the third boundary information mentioned above.
[0153] In summary, the data query method provided in this application embodiment involves a query response device sending first data and first boundary information, as well as second data and second boundary information, to a query request device based on a batch query request sent by the query request device. The first boundary information indicates the last response node corresponding to the first data, and the second boundary information indicates the next response node after the last response node. The second data includes the data of the next response node. Thus, the query request device integrates the first data and the second data based on the first and second boundary information, which helps reduce the processing overhead of the query request device and consequently reduces the processing overhead of the data query scheme. Furthermore, this data query scheme supports data querying of any type of data node, enabling batch data querying using any type of data node in the data model as a boundary point. This provides high flexibility in data querying, with minimal differences in the amount of data retrieved in different batches, allowing for precise control over the amount of data in each batch.
[0154] The following are apparatus embodiments of this application, which can be used to execute the method embodiments of this application, such as performing or possessing Figure 3 and / or Figure 7 The steps and functions of the query request device are described below. For details not disclosed in the device embodiments of this application, please refer to the method embodiments of this application.
[0155] Please refer to Figure 10 This diagram illustrates the logical structure of a data query device 1000 provided in an embodiment of this application. The data query device 1000 can be the query request device described in the foregoing embodiments, and can be a network device or a functional component within a network device. See also... Figure 10 The data query device 1000 includes, but is not limited to:
[0156] The receiving module 1010 is used to receive first data and first boundary information, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data. The functional implementation of the receiving module 1010 can be referred to the relevant description in S304 above.
[0157] The receiving module 1010 is also used to receive second data and second boundary information. The second boundary information is used to indicate the information of the next response node of the last response node (that is, the last response node corresponding to the first data). The second data includes the data of the next response node, and the response node is a data node in the data model that meets the query conditions. The functional implementation of the receiving module 1010 can also refer to the relevant description of S308 above.
[0158] The integration module 1020 is used to integrate the first data and the second data based on the first boundary information and the second boundary information. The functionality of the integration module 1020 can also be found in the relevant description of S309 above.
[0159] Optionally, the integration module 1020 is specifically used to integrate the first data and the second data based on the information of the last response node indicated by the first boundary information (that is, the last response node corresponding to the first data) and the information of the next response node indicated by the second boundary information (that is, the next response node following the last response node corresponding to the first data).
[0160] Optionally, the first boundary information is further used to indicate the information of the parent node of the last response node (that is, the last response node corresponding to the first data), and the second boundary information is further used to indicate the information of the parent node of the next response node (that is, the next response node after the last response node corresponding to the first data). The integration module 1020 is specifically used to: determine the data of the target node from the second data, wherein the target node is the response node other than the target parent node among the response nodes corresponding to the second data, and the target parent node is the same parent node corresponding to the information indicated by the first boundary information and the second boundary information; and merge the data of the target node with the first data.
[0161] Alternatively, please continue to refer to Figure 10 The data query device 1000 further includes a sending module 1030, configured to send a first query request before the receiving module 1010 receives the first data and the first boundary information. The first query request carries a first block size and query conditions, and the first block size indicates the maximum number of response nodes requested in the first query request. The functionality of the sending module 1030 can also be found in the description of S301 above.
[0162] Optionally, the data query device 1000 further includes a sending module 1030, configured to send a second query request before the receiving module 1010 receives the second data and the second boundary information. The second query request carries a second block size, first boundary information, and query conditions. The second block size indicates the maximum number of response nodes requested in the second query request. The functionality of the sending module 1030 can also be found in the description of S305 above.
[0163] Optionally, the receiving module 1010 is also configured to receive third boundary information, which is used to indicate the information of the last response node corresponding to the second data. The functional implementation of the receiving module 1010 can also be found in the relevant description of S311 above.
[0164] Optionally, the data query device 1000 further includes:
[0165] The sending module 1030 is used to send a third query request. The third query request carries a third block size, third boundary information, and query conditions. The third block size indicates the maximum number of response nodes requested in the third query request. The functional implementation of the sending module 1030 can also be found in the relevant description of S312 above.
[0166] The receiving module 1010 is also used to receive third data and fourth boundary information. The fourth boundary information is used to indicate the information of the next response node of the last response node corresponding to the second data. The third data includes the data of the next response node of the last response node corresponding to the second data. The functional implementation of the receiving module 1010 can also refer to the relevant description of S315 above.
[0167] The integration module 1030 is also used to integrate the second data with the third data based on the third boundary information and the fourth boundary information. The functionality of the integration module 1030 can also be found in the description of S316 above.
[0168] In summary, the data query device (e.g., query request device) provided in this application embodiment receives first data and first boundary information, as well as second data and second boundary information. The first boundary information indicates the last response node corresponding to the first data, and the second boundary information indicates the next response node after the last response node. The second data includes the data of the next response node. Thus, the query request device integrates the first data and the second data based on the first and second boundary information, which helps reduce the processing overhead of the query request device, thereby reducing the processing overhead of the data query scheme. Furthermore, this data query scheme supports data querying of any type of data node, and can use any type of data node in the data model as a boundary point for batch data querying. The data query is highly flexible, and the difference in the amount of data retrieved in different batches is small, allowing for more precise control over the amount of data in each batch.
[0169] Please refer to Figure 11 This illustrates a logical structure diagram of another data query device 1100 provided in an embodiment of this application. The data query device 1100 can be the query response device described in the foregoing method embodiments, for example, possessing or executing... Figure 3 and / or Figure 7 The query response device 1100 can be a network device or a functional component within a network device. (See also...) Figure 11 The data query device 1100 includes, but is not limited to:
[0170] The sending module 1110 is used to send first data and first boundary information, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data;
[0171] The sending module 1110 is also used to send second data and second boundary information. The second boundary information is used to indicate the information of the next response node of the last response node (that is, the last response node corresponding to the first data). The second data includes the data of the next response node (that is, the next response node of the last response node corresponding to the first data). The response node is a data node in the data model that meets the query conditions.
[0172] The first and second boundary information are used to integrate the first and second data. The functionality of the sending module 1110 can also be referenced in the descriptions of S303 and S307 above.
[0173] Alternatively, please continue to refer to Figure 11 The data query device 000 also includes:
[0174] The receiving module 1120 is used to receive a first query request before the sending module 1110 sends the first data and the first boundary information. The first query request carries a first block size and query conditions. The first block size indicates the maximum number of response nodes requested by the first query request.
[0175] The query module 1130 is used to query the first data in the data model based on the first block size and query conditions.
[0176] The functional implementation of the receiving module 1120 and the query module 1130 can be referred to the relevant description of S302 above.
[0177] Alternatively, please continue to refer to Figure 11 The data query device 000 also includes:
[0178] The receiving module 1120 is used to receive a second query request before the sending module 1110 sends the second data and the second boundary information. The second query request carries a second block size, first boundary information and query conditions. The second block size indicates the maximum number of response nodes requested by the second query request.
[0179] The query module 1130 is used to query the second data in the data model based on the second block size, the first boundary information, and the query conditions.
[0180] The functional implementation of the receiving module 1120 and the query module 1130 can also refer to the relevant description of S306 above.
[0181] Optionally, the query module 1130 is specifically used for: querying data that meets the query conditions in the data model; obtaining a full snapshot of the data that meets the query conditions; and determining the first data in the full snapshot based on the first block size and the query conditions.
[0182] Optionally, the query module 1130 is specifically used to determine the second data from a full snapshot of the data that meets the query conditions in the data model, based on the second block size, the first boundary information, and the query conditions.
[0183] Optionally, the sending module 1110 is also used to send third boundary information, which is used to indicate the information of the last response node corresponding to the second data. The functional implementation of the sending module 1110 can also be found in the relevant description of S310 above.
[0184] Optionally, the receiving module 1120 is also configured to receive a third query request, which carries a third block size, third boundary information, and query conditions. The third block size indicates the maximum number of response nodes requested in the third query request. The functional implementation of the receiving module 1120 can also be found in the relevant description of S312 above.
[0185] The query module 1130 is also used to query third data in the data model based on the third block size, third boundary information, and query conditions. The functionality of the receiving module 1120 can also be found in the relevant description of S313 above.
[0186] The sending module 1110 is also used to send fourth boundary information and third data. The fourth boundary information is used to indicate the information of the next response node of the last response node corresponding to the second data, and the third data includes the data of the next response node of the last response node corresponding to the second data. The functional implementation of the sending module 1110 can also refer to the relevant description of S314 above.
[0187] In summary, the data query device (e.g., query response device) provided in this application embodiment sends first data and first boundary information, as well as second data and second boundary information, to the query request device based on the batch query request sent by the query request device. The first boundary information indicates the last response node corresponding to the first data, and the second boundary information indicates the next response node after the last response node. The second data includes the data of the next response node. Thus, the query request device integrates the first data and the second data based on the first and second boundary information, which helps reduce the processing overhead of the query request device and consequently reduces the processing overhead of the data query scheme. Furthermore, this data query scheme supports data querying of any type of data node, enabling batch data querying using any type of data node in the data model as a boundary point. This provides high flexibility in data querying, with minimal difference in the amount of data retrieved in different batches, allowing for more precise control over the amount of data in each batch.
[0188] It should be understood that the data query device provided in this application embodiment can also be implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD can be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof. The data query method provided in the above method embodiment can also be implemented in software. When the data query method provided in the above method embodiment is implemented in software, each module in the data query device can also be a software module.
[0189] Please refer to Figure 12 This diagram illustrates the hardware structure of a data query device 1200 provided in an embodiment of this application. The data query device 1200 can be a query request device or a query response device as described in any of the above embodiments, and the data query device 1200 can be a network device. See also... Figure 12 The data query device 1200 includes a processor 1202, a memory 1204, a communication interface 1206, and an internal connection 1208 (bus). The processor 1202, memory 1204, and communication interface 1206 are communicatively connected to each other through the internal connection 1208. The internal connection 1208 can be of any type, used to implement the interconnection structure of the processor 1202, memory 1204, and communication interface 1206. For example, the internal connection 1208 can be a system bus and a system backplane.
[0190] The memory 1204 can be used to store a computer program 12042, which may include instructions and data. In this embodiment, the memory 1204 can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile random access memory (NVRAM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), compact disc read-only memory (CD-ROM), flash memory, registers, optical disc storage, optical disc storage (including compressed optical discs, laser discs, optical discs, digital universal optical discs, Blu-ray discs, etc.), magnetic disks, or other magnetic storage devices. In this embodiment, the memory 1204 can be used to store the data model described in the foregoing embodiments and the data in that data model.
[0191] The processor 1202 can be a general-purpose processor, which can be a processor that performs specific steps and / or operations by reading and executing a computer program (e.g., computer program 12042) stored in a memory (e.g., memory 1204). The general-purpose processor may use data stored in the memory (e.g., memory 1204) during the execution of the aforementioned steps and / or operations. The stored computer program can be executed, for example, to implement the relevant functions of the aforementioned integration module 1020 and query module 1130. The general-purpose processor can be, for example, but not limited to, a central processing unit (CPU). Alternatively, the processor 1202 can also be a dedicated processor, which can be a processor specifically designed to perform specific steps and / or operations. This dedicated processor can be, for example, but not limited to, a network processor (NP), a digital signal processor (DSP), an ASIC, and an FPGA. Optionally, the processor 1202 can be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor 1202 includes at least one circuit to execute all or part of the steps of the data query method provided in the above embodiments, such as executing... Figure 3 and / or Figure 7 Methods or steps related to the query request device and / or query response device.
[0192] The communication interface 1206 may include input / output (I / O) interfaces, physical interfaces, and logical interfaces for interconnecting internal devices of the data query device 1200, as well as interfaces for interconnecting the data query device 1200 with other devices (e.g., network devices). The physical interface may be a network interface, such as a gigabit Ethernet (GE) interface, which can be used to interconnect the data query device 1200 with other devices (e.g., network devices). The logical interface is an internal interface of the data query device 1200, which can be used to interconnect internal devices of the data query device 1200. It is easy to understand that the communication interface 1206 can be used for communication between internal devices of the data query device 1200, and for communication between the data query device 1200 and other devices. For example, the communication interface 1206 is used for sending and receiving data between the data query device 1200 and other devices, as well as sending and receiving query requests. The communication interface 1206 can implement the functions of the aforementioned receiving module 1010, sending module 1030, receiving module 1120, and sending module 1110. Furthermore, the communication interface 1206 may also include a transceiver for sending and receiving messages, which can also implement the functions of the aforementioned receiving module 1010, sending module 1030, receiving module 1120, and sending module 1110.
[0193] Optionally, the aforementioned devices can be disposed on separate chips, or at least partially or entirely on the same chip. Whether to dispose of the devices independently on different chips or integrate them on one or more chips often depends on the needs of the product design. This application does not limit the specific implementation of the aforementioned devices.
[0194] Figure 12 The data query device 1200 shown is merely exemplary. In its implementation, the data query device 1200 may also include other components, which will not be listed here. Figure 12 The data query device 1200 shown can perform data queries by executing all or part of the steps of the data query method provided in the above embodiments.
[0195] This application provides a data query system, which includes, as follows: Figure 10 The data query device 1000 shown, and, as Figure 11 The data query device 1100 shown. Alternatively, the data query system includes, as shown in the figure. Figure 12 The data query device 1200 shown.
[0196] This application provides a computer-readable storage medium storing a computer program that, when executed, implements all or part of the steps of the data query method provided in the above method embodiments.
[0197] This application provides a computer program product, which includes a program or code that, when run on a computer, causes the computer to perform all or part of the steps of the data query method provided in the above method embodiments.
[0198] This application provides a chip that includes programmable logic circuits and / or program instructions, which, when running, are used to implement all or part of the steps of the data query method provided in the above method embodiments.
[0199] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented entirely or partially as a computer program product, which includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium (e.g., solid-state drive), etc.
[0200] It should be understood that "at least one" in this document refers to one or more, and "multiple" refers to two or more. "At least two" means two or more. In this application, unless otherwise stated, " / " means "or," for example, A / B can mean A or B. "And / or" in this document is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, and B alone. Furthermore, for clarity, this application uses terms such as "first," "second," and "third" to distinguish identical or similar items with substantially the same function and effect. Those skilled in the art will understand that the terms "first," "second," and "third" do not limit the quantity or order of execution.
[0201] The method embodiments and device embodiments provided in this application can be referenced interchangeably, and this application does not limit them. The order of operations in the method embodiments provided in this application can be appropriately adjusted, and operations can be added or removed as needed. Any variations that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the protection scope of this application, and therefore will not be elaborated further.
[0202] In the corresponding embodiments provided in this application, it should be understood that the disclosed devices, etc., can be implemented through other configurations. For example, the device embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some interfaces; indirect couplings or communication connections between devices or units may be electrical or other forms.
[0203] The units described as separate components may or may not be physically separate. The components described as units may or may not be physical units; they may be located in one place or distributed across multiple network devices (e.g., terminal devices). Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0204] The above description is merely an exemplary embodiment of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and such modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims. < / get-config> < / get> < / get-config> < / get> < / get-config> < / get> < / get-config> < / get> < / get-config> < / get>
Claims
1. A data query method, characterized in that, The method is executed by a network device and includes: Receive first data and first boundary information, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data and the information of the parent node of the last response node; Receive second data and second boundary information. The second boundary information is used to indicate the information of the next response node after the last response node and the information of the parent node of the next response node. The second data includes the data of the next response node. The response node is a data node in the data model that meets the query conditions. The data of the target node is determined from the second data. The target node is the response node other than the target parent node in the response nodes corresponding to the second data. The target parent node is the same parent node corresponding to the information indicated by the first boundary information and the second boundary information. The data of the target node is merged with the first data to integrate the first data and the second data.
2. The method according to claim 1, characterized in that, Before receiving the first data and the first boundary information, the method further includes: Send a first query request, which carries a first block size and the query conditions. The first block size indicates the maximum number of response nodes requested by the first query request.
3. The method according to claim 1, characterized in that, Before receiving the second data and the second boundary information, the method further includes: Send a second query request, which carries a second block size, the first boundary information and the query conditions. The second block size indicates the maximum number of response nodes requested by the second query request.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: Receive third boundary information, which is used to indicate the information of the last response node corresponding to the second data.
5. The method according to claim 4, characterized in that, The method further includes: Send a third query request, which carries a third block size, the third boundary information and the query conditions, wherein the third block size indicates the maximum number of response nodes requested by the third query request; Receive third data and fourth boundary information, wherein the fourth boundary information is used to indicate the information of the next response node of the last response node corresponding to the second data, and the third data includes the data of the next response node of the last response node corresponding to the second data; Based on the third boundary information and the fourth boundary information, the second data is integrated with the third data.
6. A data query method, characterized in that, The method is executed by a network device and includes: Send first data and first boundary information, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data and the information of the parent node of the last response node; Send second data and second boundary information. The second boundary information is used to indicate the information of the next response node after the last response node and the information of the parent node of the next response node. The second data includes the data of the next response node. The response node is a data node in the data model that meets the query conditions. Wherein, the first boundary information and the second boundary information are used to: determine the data of the target node from the second data, wherein the target node is the response node other than the target parent node in the response nodes corresponding to the second data, and the target parent node is the same parent node corresponding to the information indicated by the first boundary information and the second boundary information; and merge the data of the target node with the first data to integrate the first data with the second data.
7. The method according to claim 6, characterized in that, Before sending the first data and the first boundary information, the method further includes: Receive a first query request, the first query request carrying a first block size and the query conditions, the first block size indicating the maximum number of response nodes requested by the first query request; Based on the first block size and the query conditions, query the first data in the data model.
8. The method according to claim 6, characterized in that, Before sending the second data and the second demarcation information, the method further includes: Receive a second query request, which carries a second block size, the first boundary information and the query conditions. The second block size indicates the maximum number of response nodes requested by the second query request. Based on the second block size, the first boundary information, and the query conditions, query the second data in the data model.
9. The method according to claim 7, characterized in that, The step of querying the first data in the data model based on the first block size and the query conditions includes: Query data that meets the query conditions in the data model; Obtain a full snapshot of the data that meets the query conditions; The first data is determined in the full snapshot based on the first block size and the query conditions.
10. The method according to claim 8, characterized in that, The step of querying the second data in the data model based on the second block size, the first boundary information, and the query conditions includes: Based on the second block size, the first boundary information, and the query conditions, the second data is determined from a full snapshot of the data that meets the query conditions in the data model.
11. A data query device, characterized in that, include: A receiving module is used to receive first data and first boundary information, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data and the information of the parent node of the last response node. The receiving module is further configured to receive second data and second boundary information. The second boundary information is used to indicate the information of the next response node of the last response node and the information of the parent node of the next response node. The second data includes the data of the next response node, and the response node is a data node in the data model that meets the query conditions. An integration module is used to determine the data of a target node from the second data. The target node is a response node other than the target parent node among the response nodes corresponding to the second data. The target parent node is the same parent node corresponding to the information indicated by the first boundary information and the second boundary information. The data of the target node is merged with the first data to integrate the first data with the second data.
12. The apparatus of claim 11, further comprising: The sending module is configured to send a first query request before the receiving module receives the first data and the first boundary information. The first query request carries a first block size and the query conditions. The first block size indicates the maximum number of response nodes requested by the first query request.
13. The apparatus according to claim 11, characterized in that, The device further includes: The sending module is configured to send a second query request before the receiving module receives the second data and the second boundary information. The second query request carries a second block size, the first boundary information and the query conditions. The second block size indicates the maximum number of response nodes requested by the second query request.
14. The apparatus according to any one of claims 11 to 13, characterized in that, The receiving module is further configured to receive third boundary information, which is used to indicate the information of the last response node corresponding to the second data.
15. The apparatus according to claim 14, characterized in that, The device further includes: a sending module, configured to send a third query request, the third query request carrying a third block size, the third boundary information and the query conditions, wherein the third block size indicates the maximum number of response nodes requested by the third query request; The receiving module is further configured to receive third data and fourth boundary information, wherein the fourth boundary information is used to indicate the information of the next response node of the last response node corresponding to the second data, and the third data includes the data of the next response node of the last response node corresponding to the second data. The integration module is further configured to integrate the second data with the third data based on the third boundary information and the fourth boundary information.
16. A data query device, characterized in that, include: The sending module is used to send first data and first boundary information, wherein the first boundary information is used to indicate the information of the last response node corresponding to the first data and the information of the parent node of the last response node. The sending module is also used to send second data and second boundary information. The second boundary information is used to indicate the information of the next response node of the last response node and the information of the parent node of the next response node. The second data includes the data of the next response node. The response node is a data node in the data model that meets the query conditions. Wherein, the first boundary information and the second boundary information are used to: determine the data of the target node from the second data, wherein the target node is the response node other than the target parent node in the response nodes corresponding to the second data, and the target parent node is the same parent node corresponding to the information indicated by the first boundary information and the second boundary information; In addition, the data of the target node is merged with the first data to integrate the first data with the second data.
17. The apparatus according to claim 16, characterized in that, The device further includes: The receiving module is configured to receive a first query request before the sending module sends the first data and the first boundary information. The first query request carries a first block size and the query conditions. The first block size indicates the maximum number of response nodes requested by the first query request. The query module is used to query the first data in the data model based on the first block size and the query conditions.
18. The apparatus according to claim 16, characterized in that, The device further includes: The receiving module is configured to receive a second query request before the sending module sends the second data and the second boundary information. The second query request carries a second block size, the first boundary information and the query conditions. The second block size indicates the maximum number of response nodes requested by the second query request. The query module is used to query the second data in the data model based on the second block size, the first boundary information, and the query conditions.
19. The apparatus according to claim 17, characterized in that, The query module is specifically used for: Query data that meets the query conditions in the data model; Obtain a full snapshot of the data that meets the query conditions; The first data is determined in the full snapshot based on the first block size and the query conditions.
20. The apparatus according to claim 18, characterized in that, The query module is specifically used to determine the second data from a full snapshot of the data that meets the query conditions in the data model, based on the second block size, the first boundary information, and the query conditions.
21. A data query device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is configured to execute a computer program stored in the memory to cause the data query device to perform the method as described in any one of claims 1 to 10.
22. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed, implements the method as described in any one of claims 1 to 10.
23. A data query system, characterized in that, The system includes: a data query device as described in any one of claims 11 to 15, and a data query device as described in any one of claims 16 to 20; or, The system includes: the data query device as described in claim 21.
24. A computer program product, characterized in that, The computer program product includes a program or code that, when run on a computer, causes the computer to perform the method as described in any one of claims 1 to 10.
Citation Information
Patent Citations
Network request and response handling method and device
CN106993016A
Method and devices used for database traversal
CN107193857A
Split and merge graphs
US20180260190A1