CN114840715A - Data query method, device and system - Google Patents

Data query method, device and system Download PDF

Info

Publication number
CN114840715A
CN114840715A CN202110131787.5A CN202110131787A CN114840715A CN 114840715 A CN114840715 A CN 114840715A CN 202110131787 A CN202110131787 A CN 202110131787A CN 114840715 A CN114840715 A CN 114840715A
Authority
CN
China
Prior art keywords
data
node
query
information
response
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110131787.5A
Other languages
Chinese (zh)
Inventor
徐流胜
戴新宁
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN202110131787.5A priority Critical patent/CN114840715A/en
Publication of CN114840715A publication Critical patent/CN114840715A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/903Querying

Abstract

A data query method, device and system belong to the field of data communication. The method comprises the following steps: the network equipment receives first data and first boundary information, and receives second data and second boundary information, wherein the first boundary information is used for indicating information of a last response node corresponding to the first data, the second boundary information is used for indicating information of a next response node of the last response node, the second data comprises data of the next response node, and the network equipment integrates the first data and the second data according to the first boundary information and the second boundary information. The first data and the second data are different batches of data queried from the data model. The data query method is beneficial to reducing the processing overhead of the network equipment, so that the processing overhead of the data query scheme is reduced.

Description

Data query method, device and system
Technical Field
The present application relates to the field of data communications, and in particular, to a data query method, apparatus, and system.
Background
YANG is a data modeling description language defined in request for comments (RFC) 6020 by the Internet Engineering Task Force (IETF) standard organization, and a YANG model is obtained by modeling data (for example, configuration data and status data) of a network device based on a network configuration protocol (network configuration protocol, network configuration), a presentation layer state transition configuration protocol (representation state transition configuration protocol, restcon f), and the like through the YANG language.
The YANG model is in a tree structure, which includes a plurality of data nodes, and data is usually stored in the data nodes (for convenience of description, the data stored in the data nodes and the data for describing the YANG model are both referred to as YANG model data). Where the YANG model is typically stored on the server, the client can query the YANG model data from the server's YANG model when it needs to apply the YANG model data. When the data volume required to be queried by the client is large, the YANG model data can be queried in batches, so as to reduce the performance influence of the data query process on the client and the server.
NETCONF defines Remote Procedure Call (RPC) operations such as < get >, < get-config >, < get-data >, etc., which support batch queries of YANG model data with xpath filter conditions, sub-tree filter conditions, etc. For example, when the client queries the YANG model data from the server, the client sends query requests carrying xpath filtering conditions and/or subtree filtering conditions to the server in batches; when receiving a query request, the server queries data in the YANG model according to the filter conditions carried in the query request and sends the queried data to the client; the client analyzes the data inquired in different batches based on a YANG model schema (schema), and integrates the data inquired in different batches according to the analysis result to obtain the finally inquired YANG model data. However, the processing overhead of the client for analyzing the data based on the YANG model schema is large, and therefore the processing overhead of the data query scheme is also large.
Disclosure of Invention
The application provides a data query method, a data query device and a data query system, which are beneficial to reducing the processing overhead of data query. The technical scheme of the application is as follows:
in a first aspect, a data query method is provided, where the method is performed by a network device, and includes: receiving first data and first boundary information, wherein the first boundary information is used for indicating information of a last response node corresponding to the first data; receiving second data and second boundary information, where the second boundary information is used to indicate information of a next response node of the last response node (i.e., a last response node corresponding to the first data), the second data includes data of the next response node (i.e., a next response node of the last response node corresponding to the first data), and the response node is a data node in the data model that meets the query condition; and integrating the first data with the second data according to the first demarcation information and the second demarcation information. The first data and the second data are data queried in batches by the network device (for example, may be referred to as batch data), the first demarcation information may be located in the first data, and the second demarcation information may be located in the second data.
According to the technical scheme provided by the application, in the batch data and the boundary information received by the network equipment, the first boundary information indicates the last response node corresponding to the first data, the second boundary information indicates the next response node of the last response node, and the second data comprises the data of the next response node, so that the network equipment can integrate the first data and the second data according to the first boundary information and the second boundary information, and the processing overhead of the network equipment is reduced. For example, when the data query scheme is applied to the YANG model, the network device can integrate the first data and the second data without analyzing the first data and the second data queried in different batches based on the YANG model schema, which is beneficial to reducing the processing overhead of the network device.
Optionally, integrating the first data with the second data according to the first and second demarcation information, including: and integrating the first data with the second data according to the information of the last response node (namely, the last response node corresponding to the first data) indicated by the first boundary information and the information of the next response node (namely, the next response node of the last response node corresponding to the first data) indicated by the second boundary information.
Optionally, the first demarcation information is further used for indicating information of a parent node of the last responding node (i.e. the last responding node corresponding to the first data), and the second demarcation information is further used for indicating information of a parent node of the next responding node (i.e. the next responding node of the last responding node corresponding to the first data), and the first data and the second data are integrated according to the first demarcation information and the second demarcation information, including: determining data of a target node from the second data, wherein the target node is a response node except a target father node in response nodes corresponding to the second data, and the target father node is the same father node corresponding to the information indicated by the first demarcation information and the second demarcation information; and merging the data of the target node with the first data.
Optionally, before receiving the first data and the first demarcation information, the method further comprises: and sending a first query request, wherein the first query request carries a first block size and a query condition, and the first block size indicates the maximum number of response nodes requested to be queried by the first query request. Wherein the responding node may be any type of data node. For example, the response node may be a leaf (leaf) node, a leaf-list (leaf-list) node, a container (container) node, a list (list) node, or the like.
According to the technical scheme, the network equipment sends the first query request carrying the first block size, so that the network equipment receiving the first query request can conveniently perform data query according to the first block size to obtain the first data, the number of response nodes corresponding to the first data is smaller than or equal to the maximum number of response nodes represented by the first block size, and batch query of the data is achieved. The data query scheme supports data query of data nodes of any type, the difference of data volume of batch data queried in different batches is small, and the data volume of the batch data can be controlled more accurately.
Optionally, before receiving the second data and the second demarcation information, the method further comprises: and sending a second query request, wherein the second query request carries a second block size, first boundary information and query conditions, and the second block size indicates the maximum number of response nodes requested to be queried by the second query request. Illustratively, the maximum number of second block size representations is equal to the maximum number of first block size representations.
According to the technical scheme provided by the application, the network equipment sends the second query request carrying the second block size and the first boundary information, so that the network equipment receiving the second query request can conveniently query the second data from the next response node of the last response node corresponding to the first data according to the second block size, the number of the response nodes corresponding to the second data is smaller than or equal to the maximum number of the response nodes represented by the second block size, and batch query of the data is realized. The data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of the data volume of batch data queried in different batches is small, and the data volume of the batch data can be controlled accurately. And the network device receiving the second query request queries the second data from a response node next to the last response node corresponding to the first data, thereby facilitating simplification of the data query process.
Optionally, the method further comprises: and receiving third demarcation information, wherein the third demarcation information is used for indicating information of a last response node corresponding to the second data. Illustratively, the third demarcation information is located in the second data.
According to the technical scheme provided by the application, the network device can determine whether the whole data query process is finished (that is, whether all data meeting query conditions in the data model are queried or not) by whether the third boundary information is received or not, and if the whole data query process is not finished, the network device can continue to send batch query requests to perform data query, so that the network device can be ensured to query all data meeting query conditions from the data model.
Optionally, the method further comprises: sending a third query request, wherein the third query request carries a third block size, third boundary information and query conditions, and the third block size indicates the maximum number of response nodes requested to be queried by the third query request; receiving third data and fourth boundary information, wherein the fourth boundary information is used for indicating information of a next response node of a last bit response node corresponding to the second data, and the third data comprises data of the next response node of the last bit response node corresponding to the second data; and integrating the second data with the third data according to the third boundary information and the fourth boundary information.
According to the technical scheme provided by the application, after the network device receives the third boundary information, it is determined that the whole data query process is not finished (that is, the data model also has data meeting the query condition), the network device sends a third query request carrying a third block size and the third boundary information, so that the network device receiving the third query request can conveniently query the third data from a next response node of a last response node corresponding to the second data according to the third block size, and the number of response nodes corresponding to the third data is smaller than or equal to the maximum number of response nodes represented by the third block size. The network device queries the third data from a response node next to the last response node corresponding to the second data, thereby facilitating simplification of the data query process. In addition, after the network device receives the third data and the fourth boundary information, the second data and the third data are integrated according to the third boundary information and the fourth boundary information, which is beneficial to reducing the processing overhead of the network device. For example, when the data query scheme is applied to the YANG model, the network device can integrate the second data and the third data without analyzing the second data and the third data queried in different batches based on the YANG model schema, which is beneficial to reducing the processing overhead of the network device.
In a second aspect, a data query method is provided, where the method is performed by a network device, and includes: sending first data and first boundary information, wherein the first boundary information is used for indicating information of a last response node corresponding to the first data; and sending second data and second demarcation information, wherein the second demarcation information is used for indicating information of a next response node of the last response node (namely, a last response node corresponding to the first data), the second data comprises data of the next response node (namely, a next response node of the last response node corresponding to the first data), and the response node is a data node meeting the query condition in the data model, wherein the first data and the second data are data (for example, batch data) which are queried in batches by the network equipment, the first demarcation information can be located in the first data, and the second demarcation information can be located in the second data.
According to the technical scheme provided by the application, in the batch data and the boundary information sent by the network equipment, the first boundary information indicates the last response node corresponding to the first data, the second boundary information indicates the next response node of the last response node, and the second data comprises the data of the next response node, so that the network equipment receiving the batch data and the boundary information can integrate the first data and the second data according to the first boundary information and the second boundary information, and the processing overhead of the network equipment is reduced. For example, when the data query scheme is applied to the YANG model, the network device can integrate the first data and the second data without analyzing the first data and the second data queried in different batches based on the YANG model schema, which is beneficial to reducing the processing overhead of the network device.
Optionally, before sending the first data and the first demarcation information, the method further comprises: receiving a first query request, wherein 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 to be queried by the first query request; first data is queried in the data model based on the first block size and a query condition.
According to the technical scheme, the network equipment receives a first query request carrying a first block size, and performs data query according to the first block size to obtain first data, so that the number of response nodes corresponding to the first data is smaller than or equal to the maximum number of response nodes represented by the first block size, and batch query of the data is achieved. The data query scheme supports data query of data nodes of any type, the difference of data quantity of batch data queried in different batches is small, and the data quantity of the batch data can be controlled more accurately.
Optionally, before sending the second data and the second demarcation information, the method further comprises: receiving a second query request, wherein the second query request carries a second block size, first boundary information and query conditions, and the second block size indicates the maximum number of response nodes requested to be queried by the second query request; and querying second data in the data model according to the second block size, the first boundary information and the query condition.
According to the technical scheme provided by the application, the network equipment queries the second data from the next response node of the last response node corresponding to the first data according to the second block size by receiving the second query request carrying the second block size and the first boundary information, and the number of the response nodes corresponding to the second data is smaller than or equal to the maximum number of the response nodes represented by the second block size, so that the batch query of the data is realized. The data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of the data volume of batch data queried in different batches is small, and the data volume of the batch data can be controlled accurately. And the network device queries the second data starting from a response node next to the last response node corresponding to the first data, thus facilitating a simplified data query process.
Optionally, querying the first data in the data model according to the first block size and the query condition, comprising: querying data meeting query conditions in a data model; acquiring a full snapshot of data meeting the query condition; first data is determined in the full-scale snapshot according to the first block size and the query condition.
According to the technical scheme, the network equipment determines the first data in the full snapshot of the data to be queried by acquiring the full snapshot of the data to be queried (such as the data meeting the query conditions in the data model), so that the influence of the change of the data to be queried on the query result in the batch query process can be avoided, and the accuracy of the query result is ensured.
Optionally, querying the second data in the data model according to the second block size, the first boundary information and the query condition, including: and determining second data in the full snapshot of the data meeting the query condition in the data model according to the second block size, the first boundary information and the query condition.
According to the technical scheme provided by the application, the network equipment can avoid the influence of the change of the data to be inquired on the inquiry result in the batch inquiry process by acquiring the second data from the full snapshot of the data to be inquired (such as the data meeting the inquiry condition in the data model), and the accuracy of the inquiry result is ensured.
Optionally, the method further comprises: and sending third boundary information, wherein the third boundary information is used for indicating information of a last response node corresponding to the second data. Exemplarily, the third demarcation information is located in the second data.
According to the technical scheme, the network equipment sends the third boundary information, so that the network equipment receiving the third boundary information can be conveniently informed that the whole data query process is not finished (namely, data meeting query conditions still exist in the data model), and the network equipment receiving the third boundary information can continuously send batch query requests to perform data query, and therefore the network equipment can be ensured to be capable of querying all data meeting the query conditions from the data model.
Optionally, the method further comprises: receiving a third query request, wherein the third query request carries a third block size, third boundary information and query conditions, and the third block size indicates the maximum number of response nodes requested to be queried by the third query request;
querying third data in the data model according to the third block size, the third boundary information and the query condition; and sending fourth boundary information and third data, wherein the fourth boundary information is used for indicating information of a response node next to the last response node corresponding to the second data, and the third data comprises data of a response node next to the last response node corresponding to the second data.
According to the technical scheme provided by the application, the network equipment receives a third query request carrying a third block size and third boundary information, queries third data from a next response node of a last response node corresponding to the second data according to the third block size, and enables the number of the response nodes corresponding to the third data to be smaller than or equal to the maximum number of the response nodes represented by the second block size, so that batch query of the data is realized. The data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of the data volume of batch data queried in different batches is small, and the data volume of the batch data can be controlled accurately. And the network device queries the third data from a response node next to the last response node to which the second data corresponds, thus facilitating a simplified data query process.
In a third aspect, there is provided a data query apparatus comprising modules for performing the data query method as provided in the first aspect or any alternative form of the first aspect.
In a fourth aspect, there is provided a data query apparatus comprising means for performing the data query method as provided in the second aspect or any alternative form of the second aspect.
In the third and fourth aspects, the modules may be implemented based on software, hardware or a combination of software and hardware, and the modules may be arbitrarily combined or divided based on specific implementations. The data query apparatus in the third and fourth aspects may be different functional components in one network device, or two network devices.
In a fifth aspect, a data query device is provided, which includes a memory and a processor;
the memory is used for storing a computer program;
the processor is adapted to execute the computer program stored in the memory to cause the data querying device to perform the method as provided in the first aspect or any alternative of the first aspect above, or to perform the method as provided in the second aspect or any alternative of the second aspect above.
A sixth aspect provides a computer readable storage medium having stored thereon a computer program which, when executed, implements a method as provided in the first aspect or any alternative of the first aspect above, or as provided in the second aspect or any alternative of the second aspect above.
A seventh aspect provides a computer program product comprising a program or code which, when run on a computer, causes the computer to perform a method as provided in the first aspect or any alternative of the first aspect above, or alternatively as provided in the second aspect or any alternative of the second aspect above.
In an eighth aspect, there is provided a chip comprising programmable logic circuitry and/or program instructions which, when run, is arranged to implement a method as provided in the first aspect or any alternative form of the first aspect above, or as provided in the second aspect or any alternative form of the second aspect above.
In a ninth aspect, there is provided a data query system, comprising: a data query apparatus as provided in the third aspect above, and a data query apparatus as provided in the fourth aspect above; alternatively, the system comprises: the data query device as provided in the fifth aspect above. Optionally, the data querying device is a network device.
The beneficial effect that technical scheme that this application provided brought is:
according to the technical scheme, the network device receives first data and first demarcation information, and receives second data and second demarcation information, the first demarcation information indicates a last response node corresponding to the first data, the second demarcation information indicates a next response node of the last response node, the second data comprises data of the next response node, and the first data and the second data are data which are inquired in batches by the network device. In addition, the data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of batch data queried in different batches is small, and the data quantity of the batch data can be controlled more accurately.
Drawings
FIG. 1 is a schematic diagram of a data query system provided by an embodiment of the present application;
FIG. 2 is a schematic diagram of a data model provided by an embodiment of the present application;
FIG. 3 is a flowchart of a data query method provided by an embodiment of the present application;
FIG. 4 is a schematic diagram of a batch query of a data model according to an embodiment of the present application;
FIG. 5 is a schematic diagram of integration of first data and second data provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of another integration of first data and second data provided by an embodiment of the present application;
FIG. 7 is a flow chart of another data query method provided by an embodiment of the present application;
FIG. 8 is a schematic diagram of integration of first data, second data, and third data provided by an embodiment of the present application;
FIG. 9 is a schematic diagram of another integration of first data, second data and third data provided by an embodiment of the present application;
FIG. 10 is a schematic structural diagram of a data query device according to an embodiment of the present application;
FIG. 11 is a schematic structural diagram of another data query device provided in an embodiment of the present application;
fig. 12 is a schematic hardware structure diagram of a data query device according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
Referring to fig. 1, a schematic diagram of an implementation environment according to an embodiment of the present application is shown. The implementation environment provides a data query system 100, the data query system 100 includes a query request device 110 and a query response device 120, and the query request device 110 is connected with the query response device 120. The data to be queried is stored in the query response device 120, the query request device 110 may send a query request to the query response device 120, the query response device 120 performs data query in the query response device 120 according to the query request, and sends the queried data to the query request device 110.
The query requesting device 110 and the query responding device 120 may be located in the same device, for example, the query requesting device 110 and the query responding device 120 are different functional modules in the same device, and in this case, the query requesting device 110 and the query responding device 120 may be connected through a logic interface or a signal line inside the device. Alternatively, the query requesting device 110 and the query responding device 120 are located in different devices, for example, the query requesting device 110 is located in a network management device, and the query responding device 120 is located in a server. Alternatively, the query requesting device 110 and the query responding device 120 may be different devices, for example, the query requesting device 110 is a network management device, and the query responding device 120 is a server, in which case the query requesting device 110 and the query responding device 120 may be connected through a wired network or a wireless network (for example, as shown in fig. 1). In one possible implementation manner, the query requesting device 110 is a client (client) installed in the network management equipment, and the query responding device 120 is a server (server). The network management device is, for example, a controller. The server may be a server, a server cluster formed by a plurality of servers, or a cloud computing service center, which is not limited in this embodiment of the present application. In the embodiment of the present application, it is described that the query requesting device 110 is a network management device, as shown in fig. 1, the data query system 100 further includes a plurality of network elements managed by the query requesting device 110, and after the query requesting device 110 queries data from the query responding device 120, the network elements may be configured according to the queried data. The query requesting device 110 and the query responding device 120 may be network devices.
In this embodiment, the query response device 120 stores a data model, the data model includes a plurality of data nodes, data in the data model and data describing the data model are to-be-queried data, and the query response device 120 may query data in the data model according to a query request sent by the query request device 110. As an optional implementation manner, the data model is in a tree structure, the data model is a set with a hierarchical relationship, each data node in the data model has limited or no child nodes, the data node without a parent node is called a root node, each non-root node has one and only one parent node, if a certain data node contains a child node, the data node is called a parent node of the child node, if a certain data node contains a parent node, the data node is called a child node of the parent node, and the data nodes with the same parent node are sibling nodes. In the embodiment of the present application, for convenience of description, for a certain data node, a direct parent node of the data node and an indirect parent node of the data node (for example, a grandparent node of the data node, a great grandparent node of the data node) are both referred to as parent nodes of the data node. The indirect father node of the data node comprises a direct father node of the data node and an indirect father node of the direct father node of the data node, and the indirect father node of the data node and the indirect father node of the direct father node of the data node are in a descendant relationship, a great descendant relationship and the like.
For example, please refer to fig. 2, which illustrates a schematic diagram of a data model provided in an embodiment of the present application. The data model is of a tree structure, the data model comprises data nodes 1-7, and the data node 1 is a root node of the data model. The father node of the data node 2 is the data node 1, and the data node 1 is the direct father node of the data node 2. Father nodes of the data nodes 4 comprise data nodes 2 and data nodes 1, wherein the data nodes 2 are direct father nodes of the data nodes 4, and the data nodes 1 are indirect father nodes of the data nodes 4 (namely, the data nodes 1 are grandfather nodes of the data nodes 4). The father node of the data node 6 comprises a data node 4, a data node 2 and a data node 1, the data node 4 is a direct father node of the data node 6, the data node 2 and the data node 1 are indirect father nodes of the data node 6, the data node 2 is a grandfather node of the data node 6, the data node 1 is a great grandfather node of the data node 6, the data node 6 and the data node 4 are in a father-son relationship, the data node 6 and the data node 2 are in a descendant relationship, and the data node 6 and the data node 1 are in a great grand relation. The data nodes 3, 5 and 7 are similar to each other and will not be described in detail here.
In this embodiment of the present application, the data model may be a YANG model, the YANG model is a data model established based on NETCONF, RESTCONF, and the like through a YANG language, and the YANG model is usually encoded in an extensible markup language (XML) format or a JavaScript object notation (JSON) format. The data nodes in the YANG model may include leaf nodes, leaf-list nodes, container nodes, list nodes, etc., according to node type. Wherein, the leaf node has only one value, and the leaf node is a leaf node; the leaf-list node comprises a group of leaf nodes of the same type, and the leaf-list node is similar to an array; a container node is an internal node of a schema tree that is usually meaningless, but exists as a parent to a series of leaf nodes; the list node is a collection of a group of data nodes, and the data nodes in the list node may be at least one of a leaf node, a leaf-list node, a container node and a list node.
In the following, it is exemplified that the query requesting apparatus is a client, the query responding apparatus is a server, the data model in the query responding apparatus is a YANG model, and the data in the data model and the data for describing the data model are YANG model data. When the data volume required to be queried by the client is large, the response time of the server to the client is long, and the memory overhead of the client and the memory overhead of the server are large in the whole data query process (including the process of sending a query request to the server by the client, the process of querying data in the YANG model by the server and the process of receiving the YANG model data by the client), so that the data can be queried in batches in many scenes. For example, when the client needs to page and display the query result on the human-computer interaction interface, or when the memory of the client and/or the server is small, and the like, batch query is performed on the data.
The batch query scheme is a query scheme based on RPC operations such as < get >, < get-config >, < get-data > and the like defined by NETCONF. RPC operations such as < get >, < get-config >, < get-data > support batch queries of YANG model data with xpath filter terms, subtree filter terms, and the like. However, the batch query scheme requires that the client is very familiar with the YANG model, a reasonable batch filtering strategy can be preset, and the client needs to analyze the YANG model data queried in different batches based on the YANG model schema to perform data integration. The processing overhead of the client for analyzing the YANG model data based on the YANG model schema is large, so the processing overhead of the data query scheme is also large.
In addition to batch query schemes based on NETCONF-defined < get >, < get-config >, < get-data > and other RPC operations, the RFC draft is discussing formulating < get-bulk > RPC operations that support batch queries by list nodes. That is, < get-bulk > RPC operations support batch queries of YANG model data at the granularity of list nodes. However, the data query scheme can only operate batch queries supporting list nodes, the flexibility is poor, the client needs to analyze YANG model data queried in different batches based on the YANG model schema to perform data integration, and the processing overhead is also large. In addition, in an actual YANG model, some list nodes may not have nested list nodes, another list node may have nested list nodes, and the size of the list nodes nested in different list nodes may be different, which results in a large difference in the data volume of the YANG model data queried in different batches.
In view of the above, embodiments of the present application provide a data query scheme, where the data query scheme is suitable for data query in a YANG model, a query response device (e.g., a server) may send boundary information of batch data (e.g., YANG model data) to a query request device (e.g., a client), and the query request device integrates batch data queried in different batches according to the boundary information of the batch data queried in different batches, without parsing the batch data based on a YANG model schema, so that the processing overhead of the query request device is small. In addition, the data query scheme supports data query of data nodes of any type, is high in flexibility, has small difference of data quantity of batch data queried in different batches, and can accurately control the data quantity of the batch data.
The data query scheme of the present application is described below with reference to the accompanying drawings. In the following description, the query requesting device may be the query requesting device 110 in the data query system 100 shown in fig. 1, and the query responding device may be the query responding device 120 in the data query system 100 shown in fig. 1. The query requesting means and the query responding means may be different functional components in one network device, or two network devices. Further, in the present application, the information of a certain node (e.g., a data node, a response node, a last response node described below, a parent node, etc.) may be the name of the node or the identification of the node, etc.
Referring to fig. 3, a flowchart of a data query method provided by an embodiment of the present application is shown. The data query method can be applied to a data query system. The data query method can comprise the following steps:
s301, the query request device sends a first query request to the query response device, wherein the first query request carries a first block size and a query condition, and the first block size indicates the maximum number of response nodes requested to be queried by the first query request.
When determining to perform batch query of data, the query request device determines a first block size (bulk-size) and a query condition, generates a first query request according to the first block size and the query condition, and sends the first query request to the query response device. The first block size and the query condition are carried in the first query request, where the first block size indicates a maximum number of response nodes requested to be queried by the first query request, and the query condition may be an xpath filter condition, a subtree (subtree) filter condition, or the like, for example. The query response device stores a data model, the data model may include a plurality of data nodes, the first query request may be used to request the query response device to perform data query in the data model, and the response node according to the embodiment of the present application may refer to a data node in the data model that meets a query condition.
Optionally, the first block size may also indicate a size of a data amount requested by the first query request, or characterize a size of a response packet for the first query request, which is not limited in this embodiment of the application.
Optionally, if the query requesting device and the query responding device are located in the same device, the first query request may be a query instruction for interaction between different functional components or different functional modules in the device, which is not limited in this embodiment of the present application.
S302, the query response device queries first data in a data model of the query response device according to the first block size and the query condition carried in the first query request.
The query response device receives the first query request corresponding to the first query request sent by the query request device to the query response device. After receiving the first query request, the query response device analyzes the first query request to obtain a first block size and a query condition, and queries first data in a data model of the query response device according to the first block size and the query condition. The first data are data meeting the query condition in the data model, the first data comprise data in response nodes and data for describing the response nodes, and the number of the response nodes corresponding to the first data is smaller than or equal to the maximum number represented by the first block size. In the embodiment of the present application, for a certain responding node, data in the responding node and data for describing the responding node are both referred to as data of the responding node.
Optionally, the query response device may include two possible implementations according to the first block size and the query condition carried in the first query request, and querying the first data in the data model of the query response device.
A first possible implementation: the query response device traverses the data nodes in the data model in sequence from a specified node (such as a root node) of the data model according to the query condition and the first block size to determine the data nodes (namely, response nodes) meeting the query condition from the data model until the traversal stop condition is reached, and determines the data of at least one response node (including the data in the at least one response node and the data for describing the at least one response node) determined when the traversal stop condition is reached as the first data. Wherein the traversal stop condition may include: the query response means determines that the number of response nodes is equal to the maximum number characterized by the first block size, or the query response means completes traversing all data nodes in the data model. If the traversal stop condition is that the number of response nodes determined by the query response device is equal to 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 stop condition is that the query response device has traversed all the 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.
For example, the traversal order of the query response device for the data nodes 1-7 in the data model shown in fig. 2 may 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 fig. 4, which illustrates a schematic diagram of batch query on a data model according to an example of the present application. Assuming that the maximum number represented by the first block size is 4, the query response device sequentially traverses the data nodes in the data model starting from the data node 1 of the data model according to the query condition and the first block size, assuming that the data node 1, the data node 2, the data node 4 and the data node 6 all meet the query condition, when the query response device finishes traversing the data node 6, the number of the response nodes is determined to be equal to the maximum number represented by the first block size, the query response device stops traversing, and the query response device determines the data of the data node 1, the data node 2, the data node 4 and the data node 6 (including the data in the data node 1, the data node 2, the data node 4 and the data node 6 and the data for describing the data node 1, the data node 2, the data node 4 and the data node 6) as the first data. The data node 1, the data node 2 and the data node 4 are father nodes of the data node 6, the data node 4 is a direct father node of the data node 6, the data node 2 is a grandfather node of the data node 6, and the data node 1 is a great grandfather node of the data node 6.
A second possible implementation: the query response device traverses data nodes in the data model in sequence from a designated node (e.g., a root node) of the data model according to the query condition to determine data nodes (i.e., response nodes) meeting the query condition from the data model until all data nodes in the data model are traversed, and the query response device may determine n response nodes, which may be arranged in a traversal order. Then, the query response device determines, as first data, data of the first n1 response nodes (including data of the n1 response nodes and data describing the n1 response nodes) of the n response nodes, where n1 is not more than n, according to the first block size. Wherein n1 is the maximum number characterized by the first chunk size when n1< n; when n1 is n, n1 is the total number of responding nodes in the data model.
For example, the traversal order of the query response device for the data nodes 1-7 in the data model shown in fig. 2 may be: data node 1- > data node 2- > data node 4- > data node 6- > data node 7- > data node 5- > data node 3. Assuming that the data nodes 1-7 all meet the query condition, the query response device determines that the arrangement sequence of n response nodes is as follows: 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 number of the first block size representations is 4, the query response device determines, as the first data, data (including data in the data node 1, the data node 2, the data node 4, and the data node 6 and data describing the data node 1, the data node 2, the data node 4, and the data node 6) arranged at the forefront among the n response nodes, according to the first block size.
As an optional implementation manner of the embodiment of the present application, the query response device obtains a full snapshot of 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, where a specific implementation process may refer to the first possible implementation manner in S302. Or, as another optional implementation manner of the embodiment of the present application, the query response apparatus queries data meeting the query condition in the data model, obtains a full snapshot of the data meeting the query condition, and determines the first data in the full snapshot according to the first block size, where a specific implementation process may refer to the second possible implementation manner in S302. According to the method and the device, the first data are determined in the full snapshot of the data to be queried (such as the data corresponding to the data model or the data meeting the query conditions) by acquiring the full snapshot of the data to be queried, so that the influence of the change of the data to be queried on the query result in the batch query process can be avoided, and the accuracy of the query result is ensured.
S303, the query response device sends the first data and first boundary information to the query request device, wherein the first boundary information is used for indicating information of a last response node corresponding to the first data.
The first data corresponds to at least one response node, the at least one response node is arranged according to a traversal order, and the first boundary information is used for indicating information of a last-node (last-node) in the at least one response node, so as to indicate the last-node. The information of the last responding node may include an identification and/or name of the last responding node, etc. For example, the first demarcation information indicates an identification of a last response node to which the first data corresponds, thereby indicating a last response node to which the first data corresponds. Illustratively, the response nodes corresponding to the first data are data node 1, data node 2, data node 4, and data node 6, and 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, and thus the first demarcation information is used to indicate information of data node 6 (e.g., identification of data node 6), and thus data node 6.
In an optional implementation manner, the first demarcation information is used not only to indicate information of a last responding node corresponding to the first data, but also to indicate information of a parent node (including a direct parent node and an indirect parent node) of the last responding node corresponding to the first data, so as to indicate the last responding node and a parent node of the last responding node. For example, the first demarcation information is used to indicate an identification of a last response node to which the first data corresponds and is also used to indicate an identification of a parent node of the last response node. Illustratively, the response node corresponding to the first data is the data node 1, the data node 2, the data node 4 and the data node 6, the data node 1, the data node 2 and the data node 4 are all parent nodes of the data node 6, and the data node 6 is a last response node corresponding to the first data, so that the first demarcation information is used for indicating information of the data node 6 (for example, indicating an identifier of the data node 6), and the first demarcation information is also used for indicating information of the data node 1, the data node 2 and the data node 4 (for example, indicating identifiers of the data node 1, the data node 2 and the data node 4), so that the first demarcation information can indicate the data node 1, the data node 2, the data node 4 and the data node 6. The data node 4 is a direct father node of the data node 6, and the data node 1 and the data node 2 are indirect father nodes of the data node 6. For example, if the identity of data node 1 is sec-policy, the identity of data node 2 is vsys [ id ═ 1], the identity of data node 4 is static-policy [ id ═ 1], the identity of data node 6 is source-ip, then the first boundary information may indicate: and the information indicated by the first boundary information corresponds to a data path, and the data path comprises each response node corresponding to the information indicated by the first boundary information.
In this embodiment of the application, the query response device may carry the first data and the first boundary information in the same message or message and send the same message or message to the query request device, or carry the first data and the first boundary information in different messages or messages and send the same message or message to the query request device. Optionally, the first boundary information is located in the first data, and this embodiment of the application takes as an example that the query response device carries the first data and the first boundary information in the same message and sends the same message to the query request device. The query response device may generate a first response packet carrying the first data and the first boundary information, and send the first response packet to the query request device, thereby implementing sending the first data and the first boundary 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 may be a response instruction for interaction between different functional modules or functional components in the device, which is not limited in this embodiment of the present application.
S304, the query request device receives the first data and the first demarcation information from the query response device.
The query requesting device receives the first data and the first demarcation information from the query responding device corresponding to the query responding device sending the first data and the first demarcation information to the query requesting device. Illustratively, the query request device receives a first response packet from the query response device, and parses the first response packet to obtain the first data and the first boundary information.
S305, the query request device sends a second query request to the query response device, wherein the second query request carries a second block size, first boundary information and query conditions, and the second block size indicates the maximum number of response nodes requested to be queried by the second query request.
The query request device receives the first data and the first boundary information, determines the second block size, generates a second query request according to the second block size, the first boundary information and the query condition, 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 condition, and the second block size indicates the maximum number of response nodes requested to be queried 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, which is not limited in this embodiment of the application. The second block size may also indicate the size of the data amount requested to be queried by the second query request, or the size of a response packet to the second query request, similarly to the first block size.
In this embodiment, the query requesting device may determine whether to send the second query request according to whether the first boundary information is received (for example, whether the first response message carries the first boundary information). If the query request device receives the first boundary information, the query request device determines that data which meet the query condition possibly exist in a data model of the query response device, the whole data query process is not finished, and the query request device sends the second query request to the query response device. If the query request device does not receive the first boundary information, the query request device determines that the data meeting the query condition does not exist in the data model of the query response device, the whole data query process is finished, and the query request device does not send the second query request to the query response device. Optionally, the query requesting apparatus may also determine whether the whole data query process is finished in other manners, which is not described herein again in this embodiment of the present application.
S306, the query response device queries second data in the data model of the query response device according to the second block size, the first boundary information and the query condition carried in the second query request.
And the query response device receives the second query request corresponding to the query request device sending the second query request to the query response device. And after receiving the second query request, the query response device analyzes the second query request to obtain a second block size, first boundary information and a query condition, and queries second data in a data model of the query response device according to the second block size, the first boundary information and the query condition. And the second data is data meeting the query condition in the data model, the second data can comprise data in response nodes and data for describing the response nodes, and the number of the response nodes corresponding to the second data is less than or equal to the maximum number represented by the second block size.
Optionally, the querying the second data in the data model of the query response apparatus according to the second block size, the first boundary information, and the query condition carried in the second query request may include two possible implementation manners.
A first possible implementation: the query response device determines a last response node corresponding to the first data according to the first boundary information, determines a next data node of the last response node in a data model of the query response device, traverses the data nodes in the data model in sequence from the next data node of the last response node according to the query condition and the second block size to determine data nodes (namely response nodes) meeting the query condition from the data model until a traversal stop condition is reached, and determines data (including data in the at least one response node and data for describing the at least one response node) of at least one response node determined when the traversal stop condition is reached as second data. Wherein the traversal stop condition may include: the query response means determines that the number of response nodes is equal to the maximum number characterized by the second block size, or the query response means completes traversing all data nodes in the data model. If the traversal stop 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, 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 stop condition is that the query response device has traversed through all the data nodes in the data model, the number of response nodes corresponding to the second data may be less than or equal to the maximum number represented by the second block size.
For example, the traversal order of the query response device for the data nodes 1-7 in the data model shown in fig. 2 may be: data node 1- > data node 2- > data node 4- > data node 6- > data node 7- > data node 5- > data node 3. With reference to fig. 4, it is assumed that the maximum number represented by the second block size is 4, the first boundary information is used to indicate information of the data node 6, the query response device determines, according to information of a last response node corresponding to the first data indicated by the first boundary information, that the last response node corresponding to the first data is the data node 6, the query response device determines, in the data model, that a next data node of the data node 6 is the data node 7, and the query response device traverses the data nodes in the data model in sequence from the data node 7 according to the query condition and the second block size. Assuming that the data node 7 meets the query condition, when the query response device finishes traversing the data node 7, determining that the number of the response nodes is equal to the maximum number represented by the second block size, stopping the traversal by the query response device, and determining the data of the data node 1, the data node 2, the data node 4 and the data node 7 (including the data in the data node 1, the data node 2, the data node 4 and the data node 7 and the data for describing the data node 1, the data node 2, the data node 4 and the data node 7) as the second data by the query response device. The data node 1, the data node 2 and the data node 4 are father nodes of the data node 7, the data node 4 is a direct father node of the data node 7, the data node 2 is a grandfather node of the data node 7, and the data node 1 is a great grandfather node of the data node 7.
A second possible implementation: the query response device determines a last response node corresponding to the first data according to the first boundary information, and determines data of n2 response nodes (including data of the n2 response nodes and data describing the n2 response nodes) in the n response nodes (the determination manner of the n response nodes may refer to the second possible implementation manner in S302) arranged in the traversal order as second data according to the second block size. The n2 response nodes comprise n21 response nodes which are located behind the last response node corresponding to the first data and arranged according to the traversal order, and parent nodes of the n21 response nodes, wherein n1+ n21 is not more than n. Where n1 is the maximum number characterized by the first block size and n2 is the maximum number characterized by the second block size when n1+ n21< n; when n1+ n21 is n, n1+ n21 is the total number of responding nodes in the data model.
Illustratively, continuing to take the second possible implementation manner in S302 as an example, the query response device determines that the arrangement order of the n response nodes is: data node 1- > data node 2- > data node 4- > data node 6- > data node 7- > data node 5- > data node 3. The response node corresponding to the first data is: the query response device determines the last response node corresponding to the first data as the data node 6 according to the information of the last response node corresponding to the first data indicated by the first boundary information, and assuming that the maximum number represented by the second block size is 4, the query response device determines the data of the data nodes 1, 2, 4 and 7 (including the data in the data nodes 1, 2, 4 and 7 and the data for describing the data nodes 1, 2, 4 and 7) as the second data according to the second block size. The data node 7 is a response node located after a last response node corresponding to the first data, and the data node 1, the data node 2, and the data node 4 are parents of the data node 7.
As an optional implementation manner of the embodiment of the present application, the query response apparatus determines the second data in the full snapshot of the data corresponding to the data model according to the second block size, the first boundary information, and the query condition, and a specific implementation process may refer to the first possible implementation manner in S306. Or, as another optional implementation manner of the embodiment of the present application, the query response apparatus determines the second data in the full-size snapshot of the data that meets the query condition according to the second block size, the first boundary information, and the query condition, and a specific implementation process may refer to the second possible implementation manner in S306. According to the embodiment of the application, the second data is acquired from the full snapshot of the data to be queried (such as the data corresponding to the data model or the data conforming to the query condition), so that the influence of the change of the data to be queried on the query result in the batch query process can be avoided, and the accuracy of the query result is ensured.
S307, the query response device sends second data and second boundary information to the query request device, where the second boundary information is used to indicate information of a next response node of the last response node corresponding to the first data, and the second data includes data of the next response node of the last response node corresponding to the first data.
The second data corresponds to at least one response node, the at least one response node is arranged according to a traversal order, the at least one response node corresponding to the second data is arranged according to the traversal order with the at least one response node corresponding to the first data, the second boundary information is used for indicating information of a next response node of a last response node corresponding to the first data, and the second data comprises data of a next response node of a last response node corresponding to the first data. For example, the second demarcation information indicates an identification of a next to last response node to which the first data corresponds, thereby indicating a next to last response node to which the first data corresponds. Illustratively, the last response node corresponding to the first data is data node 6, the response nodes corresponding to the second data are data node 1, data node 2, data node 4 and data node 7, and data node 7 is the next response node of data node 6, so the second demarcation information is used to indicate the information of data node 7, and thus data node 7.
In an optional implementation manner of the embodiment of the present application, the second boundary information is used not only to indicate information of a next response node of the last response node corresponding to the first data, but also to indicate information of a 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 of the last response node corresponding to the first data and the parent node of the next response node. For example, the second demarcation information is used to indicate an identification of a next responding node to the last responding node to which the first data corresponds and is also used to indicate an identification of a parent node to the next responding node to the last responding node to which the first data corresponds. Illustratively, the response node corresponding to the second data is the data node 1, the data node 2, the data node 4, and the data node 7, the data node 1, the data node 2, and the data node 4 are all parent nodes of the data node 7, and the data node 7 is a next response node of the last response node corresponding to the first data, so that the second boundary information is used to indicate information of the data node 7 (for example, to indicate an identifier of the data node 7), and the second boundary information is also used to indicate information of each of the data node 1, the data node 2, and the data node 4 (for example, to indicate an identifier of each of the data node 1, the data node 2, and the data node 4), so that the second boundary information may indicate the data node 1, the data node 2, the data node 4, and the data node 7. The data node 4 is a direct father node of the data node 7, and the data node 1 and the data node 2 are indirect father nodes of the data node 7. Illustratively, the identifier of the data node 1 is sec-policy, the identifier of the data node 2 is vsys [ id ═ 1], the identifier of the data node 4 is static-policy [ id ═ 1], the identifier of the data node 7 is destination-ip, the second boundary information may indicate/sec-policy/vsys [ id ═ 1]/static-policy [ id ═ 1]/destination-ip, the information indicated by the second boundary information corresponds to a data path including the respective response nodes corresponding to the information indicated by the second boundary information.
In this embodiment of the application, the query response device may carry the second data and the second boundary information in the same message or message and send the same message or message to the query request device, or carry the second data and the second boundary information in different messages or messages and send the same message or message to the query request device. Optionally, the second boundary information is located in the second data, and this embodiment of the application takes as an example that the query response device carries the second data and the second boundary information in the same message and sends the same message to the query request device. The query response device may 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 implementing sending the second data and the second boundary information to the query request device.
In this embodiment of the present application, a mode in which the query response device obtains data (for example, the second data) in the full snapshot of the data to be queried is referred to as a stateful query mode, and a mode in which the query response device obtains data (for example, the second data) in the data model according to the query condition is referred to as a stateless query mode. S306 and S307 in this embodiment of the application take the last response node corresponding to the first data in the data model as an example for illustration, and in a possible implementation manner, for a stateless query manner, the data model may be modified by a third party, so that when the query response device queries the second data, the last response node corresponding to the first data already does not exist in the data model, and for this case, the query response device may return a query failure message to the query request device, or the query response device reselects the traversal start node based on a certain processing policy, for example, the query response device queries the data by using the parent node (e.g., direct parent node) on the last level of the last response node corresponding to the first data as the traversal start node, which is not limited in this embodiment of the application.
S308, the query request device receives the second data and the second demarcation information from the query response device.
The query requesting device receives the second data and the second demarcation information from the query responding device corresponding to the query responding device sending the second data and the second demarcation information to the query requesting device. Illustratively, the query request device receives a second response packet from the query response device, and parses the second response packet to obtain second data and second boundary information.
S309, the query request device integrates the first data and the second data according to the first boundary information and the second boundary information.
The first boundary information is used for indicating information of a last bit response node corresponding to the first data, and the second boundary information is used for indicating information of a next response node of the last bit response node corresponding to the first data. Or, the first boundary information is used to indicate information of a last response node corresponding to the first data and information of a parent node of the last response node, and the second boundary information is used to indicate information of a next response node of the last response node corresponding to the first data and information of a parent node of the next response node. S309 includes two possible implementations according to the difference in the contents indicated by the first and second demarcation information.
A first possible implementation: the first boundary information is used for indicating information of a last bit response node corresponding to the first data, and the second boundary information is used for indicating information of a next response node of the last bit response node corresponding to the first data. The query request device integrates the first data and the second data according to 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 of the last response node corresponding to the first data indicated by the second boundary information. The second data comprises data of a response node next to the last bit response node corresponding to the first data.
Optionally, the query request device determines, according to the first demarcation information, information of a last response node corresponding to the first data, determines, according to the information of the last response node, further determines, by traversing the first data, information of a parent node of the last response node, and determines, according to the information of the parent node of the last response node, the parent node of the last response node. And the query request device determines the information of the next response node of the last response node corresponding to the first data according to the second boundary information, determines the next response node according to the information of the next response node, further determines the information of the father node of the next response node by traversing the second data, and determines the father node of the next response node according to the information of the father node of the next response node. Then, the query requesting apparatus determines, as a target parent node, a parent node of a last response node corresponding to the first data and a parent node of a next response node of the last response node, the same parent node among the parent nodes of the last response node and the next response node (that is, the target parent node is the parent node of the last response node and is the parent node of the next response node), determines, as the target node, a response node other than the target parent node among the response nodes corresponding to the second data, determines data of the target node from the second data, and merges the data of the target node with the first data to integrate the first data with the second data. For example, the query requesting device merges the data of the target node into the first data according to the encoding format of the first data and the encoding format of the second data.
As an optional implementation manner, the first boundary information is located in the first data, the first boundary information corresponds to information of a last response node corresponding to the first data (for example, the first boundary information is located in the same row of data as information of the last response node corresponding to the first data), the query request device traverses the first data in an order from a last row of the first data to a first row of the first data to determine the first boundary information from the first data, determines information of the last response node corresponding to the first data according to the first boundary information, and determines information of a parent node of the last response node, determines the last response node according to the information of the last response node, and determines the parent node of the last response node according to the information of the parent node of the last response node. The second demarcation information is located in the second data, the second demarcation information corresponds to information of a next response node of a last response node corresponding to the first data (for example, the second demarcation 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 according to the sequence from a first row of the second data to a last row of the second data so as to determine the second demarcation information from the second data, determines the information of the next response node of the last response node corresponding to the first data according to the second demarcation information, determines the information of a parent node of the next response node, determines the next response node according to the information of the next response node, and determines the parent node of the next response node according to the information of the parent node of the next response node.
It should be noted that, in the process of traversing the first data by the query request device, 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), so that the processing overhead of the query request device can be reduced. Similarly, in the process that the query request device traverses the second data, when the query request device determines the information of the next response node of the last response node corresponding to 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), so that the processing overhead of the query request device can be reduced.
As an example of the embodiment of the present application, please refer to fig. 5, which shows a schematic diagram of integrating first data and second data provided in the embodiment of the present application. Referring to fig. 5 in conjunction with fig. 4, the "xxx" in the first data is first boundary information indicating information of a last response node corresponding to the first data (e.g., information "source-ip" of the data node 6). "xx" in the second data is "forward", and "second boundary information, which is used to indicate information of a response node next to a last response node corresponding to the first data (for example, information" destination-ip "of the data node 7). The query requesting device traverses the first data in an order from the last line "</sec-policy >" of the first data to the first line "< sec-policy xmlns" = xx ">" of the first data, determines first boundary information "× that is, a border" ═ backward "" from the first data, determines information of a last response node (for example, information "source-ip" of the data node 6) corresponding to the first data from the first boundary information "× that is, a border" ═ backward "" and further determines information of a parent node of the last response node (for example, information "static-policy [ id ═ 1] of the data node 4, information" vsys [ id ═ 1] of the data node 2, information "sec-policy" of the data node 1); the inquiry request device determines that the last response node is a data node 6 according to the information of the last response node, and determines that the father node of the last response node comprises a data node 4, a data node 2 and a data node 1 according to the information of the father node of the last response node. And the inquiry requesting means traverses the second data in the order from the first row of the second data "< sec-polarity xmlns" > "to the last row of the second data" </sec-polarity > "to determine second boundary information"/: border "-" "forward" "from the second data, determines information of a next responding node to the last responding node corresponding to the first data (for example," destination-ip "of the data node 7) from the second boundary information"/: border "-", and determines information of a parent node of the next responding node (for example, "static-polarity [ id ] 1] of the data node 4, information" vsys [ id ] 1] of the data node 2, and "sec-polarity" of the data node 1), the inquiry requesting means determines that the next responding node is the data node 7 based on the information of the next responding node, and determining that the parent nodes of the next response node comprise the data node 4, the data node 2 and the data node 1 according to the information of the parent node of the next response node. Since the same parent node among the parent node of the last responding node (e.g., the data node 6) corresponding to the first data and the parent node of the next responding node (e.g., the data node 7) of the last responding node is the data node 4, the data node 2 and the data node 1, the query request device determines the data node 4, the data node 2 and the data node 1 as the target parent node, and the responding node other than the target parent node among the responding nodes (the data node 1, the data node 2, the data node 4 and the data node 7) corresponding to the second data is the data node 7, so that the query request device determines the data node 7 as the target node. The query request device determines (for example, extracts) the data "destination-ip" of the data node 7 from the second data, and merges the data "destination-ip" of the destination node into the first data according to the encoding format of the first data and the encoding format of the second data, so as to obtain the integrated data as shown in fig. 5. The response nodes corresponding to the integrated data comprise data node 1, data node 2, data node 4, data node 6 and data node 7, the data node 6 and the data node 7 are brother nodes, and the data node 4, the data node 2 and the data node 1 are father nodes of the data node 6 and the data node 7.
A second possible implementation: the first boundary information is used for indicating information of a last response node corresponding to the first data and also used for indicating information of a father node of the last response node, and the second boundary information is used for indicating information of a next response node of the last response node corresponding to the first data and also used for indicating information of the father node of the next response node. The inquiry request device determines information of a last response node corresponding to the first data and information of a father node of the last response node according to the first boundary information, determines the last response node according to the information of the last response node, and determines the father node of the last response node according to the information of the father node of the last response node. And the query request device determines the information of the next response node of the last response node and the information of the father node of the next response node corresponding to the first data according to the second boundary information, determines the next response node according to the information of the next response node, and determines the father node of the next response node according to the information of the father node of the next response node. Then, the query requesting apparatus determines, as a target parent node, a parent node of a last responding node corresponding to the first data and a parent node of a next responding node of the last responding node, the same parent node among the parent nodes of the last responding node and the next responding node (that is, the target parent node is the parent node of the last responding node and is the parent node of the next responding node), determines, as the target node, a responding node other than the target parent node among the responding nodes corresponding to the second data, determines (for example, extracts) data of the target node from the second data, and merges the data of the target node with the first data to integrate the first data with the second data.
As an example of the embodiment of the present application, please refer to fig. 6, which shows another schematic diagram of integrating the first data and the second data provided in the embodiment of the present application. Referring to fig. 6 in conjunction with fig. 4, in the first data, "xx" ("backward" ") is first boundary information indicating information of a last responding node corresponding to the first data (for example," source-ip "of the data node 6) and information of a parent node of the last responding node (for example," static-policy [ id ] "of the data node 4, information" vsys [ id ] (1) of the data node 2, and information "sec-policy" of the data node 1), and the query request device determines that the parent node of the last responding node includes the data node 4, the data node 2, and the data node 1 according to the parent node information of the last responding node. "xx" in the second data is second boundary information indicating information of a next response node of a last response node corresponding to the first data (for example, information "destination-ip" of the data node 7) and information of a parent node of the next response node (for example, information "static-policy [ id ] 1" of the data node 4, information "vsys [ id ] 1" of the data node 2, and information "sec-policy" of the data node 1), and the query requesting device determines that the parent node of the next response node includes the data node 4, the data node 2, and the data node 1, based on the information of the parent node of the next response node. The query request device determines that, in a parent node of a last response node corresponding to the first data and a parent node of a next response node of the last response node, the same parent node is the data node 4, the data node 2 and the data node 1 according to the first boundary information and the second boundary information, so that the query request device determines the data node 4, the data node 2 and the data node 1 as a target parent node. Among the response nodes (the data node 1, the data node 2, the data node 4, and the data node 7) corresponding to the second data, the response node other than the target parent node is the data node 7, and therefore the query requesting device determines the data node 7 as the target node. The query request device extracts the data "destination-ip" of the data node 7 from the second data, and merges the data "destination-ip" of the destination node into the first data according to the encoding format of the first data and the encoding format of the second data, so as to obtain the integrated data as shown in fig. 6. The response nodes corresponding to the integrated data comprise data node 1, data node 2, data node 4, data node 6 and data node 7, the data node 6 and the data node 7 are brother nodes, and the data node 4, the data node 2 and the data node 1 are father nodes of the data node 6 and the data node 7.
In this embodiment of the present application, the first demarcation information may be located in the first data, the second demarcation information may be located in the second data, and the query requesting device may delete the first demarcation information from the first data and delete the second demarcation information from the second data when integrating the first data and the second data, which is not limited in this embodiment of the present application. For example, as shown in fig. 5 and 6, when integrating the first data and the second data, the query requesting device deletes the first classification information from the first data and deletes the second classification information from the second data. In addition, the encoding format of the first data and the encoding format of the second data may be an XML format or a JSON format, fig. 5 and fig. 6 illustrate that the encoding format of the first data and the encoding format of the second data are both XML formats, and when the encoding format of the first data and the encoding format of the second data are both JSON formats, the process of integrating the first data and the second data may refer to fig. 5 and fig. 6, which is not described herein again in this embodiment of the present application.
In summary, in the data query method provided in the embodiment of the present application, the query response device sends, according to the batch query request sent by the query request device, first data and first boundary information to the query request device, and sends second data and second boundary information, where the first boundary information indicates a last response node corresponding to the first data, the second boundary information indicates a next response node of the last response node, and the second data includes data of the next response node, and the query request device integrates the first data and the second data according to the first boundary information and the second boundary information, which is beneficial to reducing processing overhead of the data query scheme. In addition, the data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of batch data queried in different batches is small, and the data quantity of the batch data can be controlled more accurately.
In this embodiment, the number of response nodes corresponding to the first data may be equal to the maximum number represented by the first block size, and the number of response nodes corresponding to the second data may be less than or equal to the maximum number represented by the second block size. If the number of the 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 meeting the query condition in the data model are queried when the second data is queried, and if the number of the 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 the data meeting the query condition possibly exist in the data model when the second data is queried. 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 may further send boundary information indicating information of a last response node corresponding to the second data to the query request device, so that the query request device continues to send batch query requests to the query response device for data query. As an alternative implementation manner of the embodiment of the present application, on the basis of fig. 3, the data query method may further include the following content shown in fig. 7.
For example, please refer to fig. 7, which shows a flowchart of another data query method provided in an embodiment of the present application, and on the basis of fig. 3, the data query method further includes:
and S310, the query response device sends third boundary information to the query request device, wherein the third boundary information is used for indicating information of a last response node corresponding to the second data.
The second data corresponds to at least one response node, the at least one response node may be arranged according to a traversal order, and the third demarcation information is used to indicate information of a last response node in the at least one response node, so as to indicate the last response node. The information of the last responding node may include an identifier and/or a name of the last responding node. For example, the third demarcation information indicates an identification of a last response node to which the second data corresponds. Illustratively, the response nodes corresponding to the second data are data node 1, data node 2, data node 4, and data node 7, and 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, and therefore the third demarcation information is used to indicate data node 7 information, and thus data node 7.
In an optional implementation manner of the embodiment of the present application, the third bounding information is used not only to indicate information of a last responding node corresponding to the second data, but also to indicate information of a parent node (including a direct parent node and an indirect parent node) of the last responding node corresponding to the second data. For example, the third demarcation information is used to indicate an identification of a last responding node corresponding to the second data and is also used to indicate an identification of a parent node of the last responding node to indicate the last responding node and the parent node of the last responding node. Illustratively, the response node corresponding to the second data is the data node 1, the data node 2, the data node 4, and the data node 7, the data node 1, the data node 2, and the data node 4 are all parent nodes of the data node 7, and the data node 7 is a last response node corresponding to the second data, so that the third demarcation information is used to indicate information of the data node 7 (for example, to indicate an identifier of the data node 7), and the third demarcation information is also used to indicate respective of the data node 1, the data node 2, and the data node 4 (for example, respective identifiers of the data node 1, the data node 2, and the data node 4), so that the third demarcation information may indicate the data node 1, the data node 2, the data node 4, and the data node 7. For example, if the identity of data node 1 is sec-policy, the identity of data node 2 is vsys [ id ═ 1], the identity of data node 4 is static-policy [ id ═ 1], the identity of data node 7 is destination-ip, then the third delimiting information may indicate: and the third boundary information corresponds to a data path, and the data path comprises each response node corresponding to the information indicated by the third boundary information. As can be understood from the description of S307 in conjunction with S310, the data node 7 is the next response node of the last response node corresponding to the first data, and the data node 7 is the last response node corresponding to the second data, and the third demarcation information is the same as the aforementioned second demarcation information.
In this embodiment of the present application, the query response device may carry the third boundary information and the second data in the same message or message and send the same message or message to the query request device, or carry the third boundary information and the second data in different messages or messages and send the same message or message to the query request device, which is not limited in this embodiment of the present application. Optionally, the third boundary information is located in the second data, and this embodiment of the application takes as an example that the query response device carries the third boundary information and the second data in the same message and sends the third boundary information and the second data to the query request device. The query response device may carry the third boundary information in the second response message described in the foregoing S307, and send the third boundary information to the query request device. That is, the query response device may send a second response packet to the query request device, where the second response packet carries the second data, the second boundary information, and the third boundary information. S310 and the aforementioned S307 may be implemented by the same step.
S311, the query requesting device receives the third boundary information from the query responding device.
The query requesting device receives the third demarcation information from the query responding device corresponding to the query responding device sending the third demarcation information to the query requesting device. In an example, the query request device receives a second response packet from the query response device, and analyzes the second response packet to obtain third boundary information. S311 and S308 may be implemented by the same step.
S312, the query request device sends a third query request to the query response device, where the third query request carries a third block size, third boundary information, and a query condition, and the third block size indicates a maximum number of response nodes requested to be queried by the third query request.
And after receiving the third boundary information, the query request device determines a third block size, generates a third query request according to the third block size, the third boundary information and the query condition, and sends the third query request to the query response device. Wherein the third query request carries the third block size, the third boundary information, and the query condition, and the third block size indicates a maximum number of response nodes requested for query 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, which is not limited in this embodiment of the present application. The third block size may also indicate the size of the data amount of the query requested by the third query request, or the size of the response message to the third query request, as with the first block size.
In this embodiment, the query requesting device may determine whether to send the third query request according to whether the third demarcation information is received (for example, whether the third demarcation information is carried in the second response message). If the query request device receives the third boundary information, the query request device determines that data which meets the query condition possibly exists in the data model of the query response device, the whole data query process is not finished, and the query request device sends the third query request to the query response device. If the query request device does not receive the third boundary information, the query request device determines that no data meeting the query condition exists in the data model of the query response device, the whole data query process is finished, and the query request device does not send the third query request to the query response device.
And S313, the query response device queries third data in the data model of the query response device according to the third block size, the third boundary information and the query condition carried in the third query request.
The query response device receives the third query request corresponding to the query request device transmitting the third query request to the query response device. And after receiving the third query request, the query response device analyzes the third query request to obtain a third block size, third boundary information and a query condition, and queries third data in a data model of the query response device according to the third block size and the query condition. The third data is data meeting the query condition in the data model, the third data may include data in response nodes and data for describing the response nodes, and the number of the response nodes corresponding to the third data is less than or equal to the maximum number represented by the third block size.
Optionally, the querying, by the query response device, the third data in the data model of the query response device according to the third block size, the third boundary information, and the query condition carried in the third query request may include two possible implementations:
a first possible implementation: the query response device determines a last response node corresponding to the second data according to the third boundary information, determines a next data node of the last response node in a data model of the query response device, traverses the data nodes in the data model in sequence from the next data node of the last response node according to the query condition and a third block size to determine a data node (namely, a response node) meeting the query condition from the data model until a traversal stop condition is reached, and determines data (including data in the at least one response node and data describing the at least one response node) of at least one response node determined when the traversal stop condition is reached as third data. Wherein the traversal stop condition may include: the query response means determines that the number of response nodes is equal to the maximum number characterized by the third block size or that the query response means has traversed through all data nodes in the data model. If the traversal stop 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, 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 stop 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 may be less than or equal to the maximum number represented by the third block size.
For example, the traversal order of the query response device for the data nodes 1-7 in the data model shown in fig. 2 may be: data node 1- > data node 2- > data node 4- > data node 6- > data node 7- > data node 5- > data node 3. With continued reference to fig. 4, assuming that the maximum number represented by the third block size is 4, the third boundary information is used to indicate information of the data node 7, the query response apparatus determines, according to the information of the last response node corresponding to the second data indicated by the third boundary information, that the last response node corresponding to the second data is the data node 7, determines, in the data model, the next data node of the data node 7 as the data node 5, and the query response apparatus traverses the data nodes in the data model in order from the data node 5 according to the query condition and the third block size. Assuming that the data node 5 and the data node 3 both meet the query condition, when the query response device finishes traversing the data node 3, it determines that the number of the response nodes is equal to the maximum number represented by the third block size, the query response device stops traversing, and the query response device determines the data of the data node 1, the data node 2, the data node 5, and the data node 3 (including the data in the data node 1, the data node 2, the data node 5, and the data node 3 and the data for describing the data node 1, the data node 2, the data node 5, and the data node 3) as the third data. The data node 1 and the data node 2 are father nodes of the data node 5, and the data node 1 is a father node of the data node 3.
A second possible implementation: the query response device determines a last response node corresponding to the second data according to the second demarcation information, and determines data (including data in the n3 response nodes and data describing the n3 response nodes) of n3 response nodes (the determination manner of the n response nodes may refer to the second possible implementation manner in S302) arranged in the traversal order as third data according to the third block size. The n3 response nodes comprise n31 response nodes which are located behind the last response node corresponding to the second data and arranged according to the traversal order, and parent nodes of the n31 response nodes, wherein n1+ n2+ n31 is less than or equal to n. Wherein when n1+ n2+ n31 is not greater than n, n1 is the maximum number characterized by the first block size, n2 is the maximum number characterized by the third block size, and n3 is the maximum number characterized by the third block size; when n1+ n2+ n31 equals n, n1+ n2+ n31 is the total number of responding nodes in the data model.
Illustratively, continuing to take the second possible implementation manner in S302 as an example, the query response device determines that the arrangement order of the n response nodes is: data node 1- > data node 2- > data node 4- > data node 6- > data node 7- > data node 5- > data node 3. The response node corresponding to the second data is: the query response device determines that the last response node corresponding to the second data is the data node 7 according to the information of the last response node corresponding to the second data indicated by the third boundary information. Assuming that the maximum number represented by the third block size is 4, the query response device determines data of the data node 1, the data node 2, the data node 5, and the data node 3 (including data in the data node 1, the data node 2, the data node 5, and the data node 3 and data for describing the data node 1, the data node 2, the data node 5, and the data node 3) as third data according to the third block size. The data node 5 and the data node 3 are two response nodes which are located behind a last response node corresponding to the second data and are arranged in a traversal order, the data node 1 and the data node 2 are father nodes of the data node 5, and the data node 1 is a father node of the data node 3.
Similarly to S306, the query response device may determine the third data in the full-volume snapshot of the data corresponding to the data model according to the third block size, the third boundary information, and the query condition, or determine the third data in the full-volume snapshot of the data meeting the query condition according to the third block size, the third boundary information, and the query condition. According to the method and the device, the third data are obtained from the full-scale snapshots of the data to be queried, so that the influence of the change of the data to be queried on the query result in the batch query process can be avoided, and the accuracy of the query result is ensured.
And S314, the query response device sends third data and fourth boundary information to the query request device, wherein the fourth boundary information is used for indicating information of a next response node of a last response node corresponding to the second data, and the third data comprises data of the next response node of the last response node corresponding to the second data.
The third data corresponds to at least one response node, the at least one response node is arranged according to a traversal order, the at least one response node corresponding to the third data and the at least one response node corresponding to the second data are arranged according to the traversal order, the fourth boundary information is used for indicating information of a next response node of a last response node corresponding to the second data, and the third data comprises data of a next response node of a last response node corresponding to the second data. For example, the fourth demarcation information indicates an identification of a response node next to the response node to which the second data corresponds, thereby indicating a response node next to the response node to which the second data corresponds. Illustratively, the last response node corresponding to the second data is data node 7, the response nodes corresponding to the third data are data node 1, data node 2, data node 5 and data node 3, and data node 5 is the next response node of data node 7, so the fourth demarcation information can be used to indicate the information of data node 5, and thus indicate data node 5.
In an optional implementation manner of the embodiment of the present application, the fourth boundary information is used not only to indicate information of a next response node of a last response node corresponding to the second data, but also to indicate information of a parent node of the next response node. For example, the fourth demarcation information is used to indicate an identity of a next responding node of the last responding node corresponding to the second data and is also used to indicate an identity of a parent node of the next responding node to indicate a next responding node of the last responding node corresponding to the second data and a parent node of the next responding node. Illustratively, the response nodes corresponding to the third data are the data node 1, the data node 2, the data node 5 and the data node 3, the data node 1 and the data node 2 are both parents of the data node 5, the data node 1 is a parent of the data node 3, and the data node 5 is a next response node of a last response node (i.e., the data node 7) corresponding to the second data, so that the fourth delimiting information is used to indicate information of the data node 5 (e.g., to indicate an identifier of the data node 5), and the fourth delimiting information also indicates information of each of the data node 1 and the data node 2 (e.g., an identifier of each of the data node 1 and the data node 2), so that the fourth delimiting information may indicate the data node 1, the data node 2 and the data node 5. For example, the identity of data node 1 is sec-policy, the identity of data node 2 is vsys [ id ═ 1], the identity of data node 5 is static-policy [ id ═ 2], and the fourth delimiting information may indicate: and the second boundary information corresponds to a data path, and the data path comprises each response node corresponding to the information indicated by the fourth boundary information.
In this embodiment, the query response device may carry the third data and the fourth boundary information in the same message or message and send them to the query request device, or carry the third data and the fourth boundary information in different messages or messages and send them to the query request device. Optionally, the fourth boundary information is located in the third data, and this embodiment of the application takes as an example that the query response device carries the third data and the fourth boundary information in the same message and sends the same message to the query request device. The query response device may 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 implementing sending the third data and the fourth boundary information to the query request device.
And S315, the query request device receives the third data and the fourth boundary information.
And the query request device receives the third data and the fourth boundary information from the query response device corresponding to the query response device sending the third data and the fourth boundary information to the query request device. Illustratively, the query request device receives a third response packet from the query response device, and parses the third response packet to obtain third data and fourth boundary information.
And S316, the query request device integrates the second data and the third data according to the third boundary information and the fourth boundary information.
The implementation process of S316 may refer to S309, and is not described herein again. Here, mainly taking the integration of the first data, the second data and the third data as an example, a process of integrating data queried by a plurality of batches is described.
In this embodiment, if the number of batch queries is greater than two, the query requesting device may integrate the data queried by multiple batches to perform the data integration process. For example, the query requesting device may perform rolling integration on the data queried by the plurality of batches according to the query batch, may perform rolling integration on the data queried by the plurality of batches according to the sequence from front to back of the query batch, or perform rolling integration on the data queried by the plurality of batches according to the sequence from back to front of the query batch, or perform rolling integration on the data queried by adjacent batches according to other sequences. For example, assuming that k batch queries are performed in one complete query process, and the query batches are 1, 2, and 3. Firstly, integrating the data queried in the 2 nd batch into the data queried in the 1 st batch to obtain integrated data D11, then integrating the data queried in the 3 rd batch into integrated data D11 to obtain integrated data D12, then integrating the data queried in the 4 th batch into integrated data D12 to obtain integrated data D13, and so on. The rolling integration of the data queried from the plurality of batches according to the query batches from back to front can be as follows: firstly integrating the data queried in the kth batch into the data queried in the kth-1 batch to obtain integrated data D21, then integrating the data queried in the kth-2 batch into integrated data D21 to obtain integrated data D22, then integrating the data queried in the kth-3 batch into integrated data D22 to obtain integrated data D23, and so on.
Take the example that the query requesting device integrates the first data, the second data, and the third data in the order of the query batch from front to back. The query request device firstly integrates the second data into the first data to obtain first integrated data, and then integrates the third data into the first integrated data to obtain second integrated data. The second whole data is the final data obtained by integrating the first data, the second data and the third data. The process of integrating the first data, the second data, and the third data is described below with reference to examples.
As an example of the embodiment of the present application, please refer to fig. 8, which illustrates a schematic diagram of integrating first data, second data, and third data provided in the embodiment of the present application, where fig. 8 illustrates, by using first boundary information for indicating information of a last responding node corresponding to the first data, second boundary information for indicating information of a next responding node of the last responding node corresponding to the first data, third boundary information for indicating information of a last responding node corresponding to the second data, and fourth boundary information for indicating information of a next responding node of the last responding node corresponding to the second data as an example (that is, the example shown in fig. 8 corresponds to the first possible implementation manner in S309). Referring to fig. 8 in conjunction with fig. 4, the "xxx" in the first data is first boundary information indicating information of a last response node corresponding to the first data (e.g., information "source-ip" of the data node 6). "booth" in the second data indicates backward and forward, "xx: border" ("booth") is second border information used to indicate information of a response node next to the last response node corresponding to the first data (for example, "destination-ip" of the data node 7), and third border information used to indicate information of the last response node corresponding to the second data (for example, "destination-ip" of the data node 7). "xx" ═ forwarder "in the third data is fourth boundary information indicating information of a response node next to the last response node to which the second data corresponds (for example, information" static-policy [ id ═ 2] "of the data node 5). The query requesting device traverses the first data in an order from the last line "</sec-policy >" of the first data to the first line "< sec-policy xmlns" = xx ">" of the first data, determines first boundary information "× that is, a border" ═ backward "" from the first data, determines information of a last response node (for example, information "source-ip" of the data node 6) corresponding to the first data from the first boundary information "× that is, a border" ═ backward "" and further determines information of a parent node of the last response node (for example, information "static-policy [ id ═ 1] of the data node 4, information" vsys [ id ═ 1] of the data node 2, information "sec-policy" of the data node 1); the inquiry request device determines that a last response node corresponding to the first data is a data node 6 according to information of the last response node corresponding to the first data, and determines that a father node of the last response node comprises a data node 4, a data node 2 and a data node 1 according to information of the father node of the last response node. And, the inquiry requesting means traverses the second data in the order from the first row of the second data "< sec-polarity xmlns" > "to the last row of the second data" </sec-polarity > ", to determine second boundary information" × that is, a border "═ box" ", from the second data, determine information of a next responding node of the last responding node corresponding to the first data (for example, information" destination-ip "of the data node 7) from the second boundary information" × that is, a border "═ box" ", and determine information of a parent node of the next responding node (for example, information" static-polarity [ id ═ 1] of the data node 4, information "vsys [ id ═ 1] of the data node 2, information" sec-polarity "of the data node 1; the inquiry request device determines that the next response node of the last response node corresponding to the first data is the data node 7 according to the information of the next response node of the last response node corresponding to the first data, and determines that the parent node of the next response node comprises the data node 4, the data node 2 and the data node 1 according to the information of the parent node of the next response node. Since the same parent node among the parent node of the last responding node (e.g., the data node 6) corresponding to the first data and the parent node of the next responding node (e.g., the data node 7) of the last responding node is the data node 4, the data node 2 and the data node 1, the query request device determines the data node 4, the data node 2 and the data node 1 as the target parent node, and the responding node other than the target parent node among the responding nodes (the data node 1, the data node 2, the data node 4 and the data node 7) corresponding to the second data is the data node 7, so that the query request device determines the data node 7 as the target node. In the same manner, the query request device determines that, of the parent node of the last responding node (e.g., the data node 7) corresponding to the second data and the parent node of the next responding node (e.g., the data node 5) of the last responding node, the same parent nodes are the data node 2 and the data node 1, so that the query request device determines the data node 2 and the data node 1 as target parent nodes, and in the responding nodes (the data node 1, the data node 2, the data node 5, and the data node 3) corresponding to the third data, the responding nodes other than the target parent nodes are the data node 5 and the data node 3, so that the query request device determines the data node 5 and the data node 3 as target nodes. The query request device extracts the data of the data node 7 from the second data, and integrates the data corresponding to the data node 7 into the first data according to the coding format of the first data and the coding format of the second data to obtain first integrated data. Then, the query requesting device extracts the data of the data node 5 and the data node 3 from the third data, and integrates the data of the data node 5 and the data node 3 into the first integrated data according to the encoding format, so as to obtain the final integrated data (for example, the second integrated data) as shown in fig. 8.
As another example of the embodiment of the present application, please refer to fig. 9, which shows another schematic diagram of integrating the first data, the second data and the third data provided by the embodiment of the present application, fig. 9 illustrates that the first boundary information is used to indicate information of a last responding node corresponding to the first data and information of a parent node of the last responding node, the second boundary information is used to indicate information of a next responding node of the last responding node corresponding to the first data and information of a parent node of the next responding node, the third boundary information is used to indicate information of a last responding node corresponding to the second data and information of a parent node of the last responding node, and the fourth boundary information is used to indicate information of a next responding node of the last responding node corresponding to the second data and information of a parent node of the next responding node (that is, the example shown in fig. 8 corresponds to the second possible implementation manner in S309). Referring to fig. 9 in conjunction with fig. 4, a first boundary information ("xx" — "backward") in the first data indicates information of a last responding node corresponding to the first data (for example, information "source-ip" of the data node 6) and information of a parent node of the last responding node (for example, information "static-policy [ id ═ 1] of the data node 4," vsys [ id ═ 1] of the data node 2 ", and information" sec-policy "of the data node 1). "booth" in the second data indicates back and forward, "xx: border" ("booth") "is second border information indicating information of a next responding node of a last responding node corresponding to the first data (for example," destination-ip "of the data node 7) and information of a parent node of the next responding node (for example," static-policy [ id ] 1 "of the data node 4), information" vsys [ id ] 1 "of the data node 2, information" sec-policy "of the data node 1), and third border information indicating information of a last responding node corresponding to the second data (for example," destination-ip "of the data node 7) and information of a parent node of the last responding node (for example," static-policy [ id ] 1 "of the data node 4), information" vssy [ id ] 2 [ 1, and information "sec-policy" of the data node 1). "xx" in the third data is forward, and "fourth delimiting information" indicates information of a next responding node of a last responding node corresponding to the second data (for example, "destination-ip" information of the data node 5) and information of a parent node of the next responding node (for example, "vsys [ id ] of the data node 2," and "sec-policy" information of the data node 1). The query request device determines that, in a parent node of a last response node corresponding to the first data and a parent node of a next response node of the last response node, the same parent node is the data node 4, the data node 2 and the data node 1 according to the first boundary information and the second boundary information, so that the query request device determines the data node 4, the data node 2 and the data node 1 as a target parent node. Among the response nodes (the data node 1, the data node 2, the data node 4, and the data node 7) corresponding to the second data, the response nodes other than the target parent node (that is, the data node 4, the data node 2, and the data node 1) are the data node 7, and thus the query requesting device determines the data node 7 as the target node. Similarly, the query request device determines, according to the third boundary information and the fourth boundary information, that, of 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, the same parent nodes are the data node 2 and the data node 1, so that the query request device determines the data node 2 and the data node 1 as target parent nodes. The response nodes except the target parent nodes (i.e., the data node 2 and the data node 1) among the response nodes (the data node 1, the data node 2, the data node 5 and the data node 3) corresponding to the third data are the data node 5 and the data node 3, and the query request device determines the data node 5 and the data node 3 as the target nodes. The query request device extracts the data of the data node 7 from the second data, and integrates the data corresponding to the data node 7 into the first data according to the coding format of the first data and the coding format of the second data to obtain first integrated data. Then, the query requesting device extracts the data of the data node 5 and the data node 3 from the third data, and integrates the data of the data node 5 and the data node 3 into the first integrated data according to the encoding format, so as to obtain the final integrated data (for example, the second integrated data) as shown in fig. 9.
In this embodiment of the present application, the first delimiting information may be located in the first data, the second delimiting information and the third delimiting information may be located in the second data, and the fourth delimiting information may be located in the third data, and when the query request device integrates the first data, the second data, and the third data, the first delimiting information may be deleted from the first data, the second delimiting information and the third delimiting information may be deleted from the second data, and the fourth delimiting information may be deleted from the third data. As shown in fig. 8 and 9, the inquiry request device also deletes the boundary information from the first data, the second data, and the third data, respectively, when integrating the first data, the second data, and the third data. In addition, the encoding format of the first data, the encoding format of the second data, and the encoding format of the third data may be an XML format or a JSON format, and fig. 8 and 9 illustrate that the encoding format of the first data, the encoding format of the second data, and the encoding format of the third data are all XML formats, and when the encoding format of the first data, the encoding format of the second data, and the encoding format of the third data are all JSON formats, the process of integrating the first data, the second data, and the third data may refer to fig. 8 and 9, which is not described herein again in this embodiment of the present application.
In the embodiment of the present application, the data model may be a YANG model, and each data node in the data model may be one of a leaf node, a leaf-list node, a container node, or a list node, for example, each data node in data nodes 1 to 7 in fig. 2 may be one of a leaf node, a leaf-list node, a container node, or a list node. When the query response device queries data in the data model, each data node can be regarded as one node, and the type of the data node can be not considered. For example, the list node may actually be a set of data nodes, and the query response apparatus uses the list node as one data node when performing a data query, so that data of the same list node may be prevented from being divided into different batches, and the relative integrity of the batches is ensured.
When the data query method provided by the embodiment of the application is implemented, the parameter field can be extended in the RPC operations such as < get >, < get-config >, < get-data > and the like, namely, the parameter field is extended in the query request. For example, taking the example that the data model is a YANG model, the following parameter fields can be extended at the rpc interface:
Figure BDA0002925620890000241
Figure BDA0002925620890000251
wherein, the bulk-size parameter indicates the block size, such as the first block size, the second block size, and the third block size; the last-node parameter indicates a parameter for indicating a last response node corresponding to a previous batch of data, for example, the last-node parameter indicates the aforementioned first boundary information, third boundary information, and the like.
In summary, in the data query method provided in this embodiment of the present application, the query response device sends, according to the batch query request sent by the query request device, first data and first boundary information to the query request device, and sends second data and second boundary information, where the first boundary information indicates a last response node corresponding to the first data, the second boundary information indicates a next response node of the last response node, and the second data includes data of the next response node, so that the query request device integrates the first data and the second data according to the first boundary information and the second boundary information, which is beneficial to reducing processing overhead of the query request device, thereby reducing processing overhead of the data query scheme. In addition, the data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of batch data queried in different batches is small, and the data quantity of the batch data can be controlled more accurately.
The following are embodiments of the apparatus of the present application that may be used to perform embodiments of the method of the present application, e.g., to perform or have the associated steps and functions of the query requesting device of fig. 3 and/or fig. 7. For details which are not disclosed in the embodiments of the apparatus of the present application, reference is made to the embodiments of the method of the present application.
Referring to fig. 10, a schematic diagram of a logical structure of a data query apparatus 1000 according to an embodiment of the present application is shown. The data query apparatus 1000 may be the query request apparatus described in the foregoing embodiments, and the data query apparatus 1000 may be a network device or a functional component in the network device. Referring to fig. 10, the data query apparatus 1000 includes, but is not limited to:
the receiving module 1010 is configured to receive first data and first boundary information, where the first boundary information is used to indicate information of a last response node corresponding to the first data. The functional implementation of the receiving module 1010 can refer to the related description of S304 above.
The receiving module 1010 is further configured to receive second data and second boundary information, where the second boundary information is used to indicate information of a next response node of the last response node (that is, a last response node corresponding to the first data), the second data includes data of the next response node, and the response node is a data node in the data model that meets the query condition. The functional implementation of the receiving module 1010 can also refer to the related description of S308 above.
An integrating module 1020 configured to integrate the first data with the second data according to the first boundary information and the second boundary information. The functional implementation of the integration module 1020 may also refer to the related description of S309 above.
Optionally, the integrating module 1020 is specifically configured to integrate the first data with the second data according to the information of the last responding node (i.e., the last responding node corresponding to the first data) indicated by the first boundary information and the information of the next responding node (i.e., the next responding node of the last responding node corresponding to the first data) indicated by the second boundary information.
Optionally, the first demarcation information is further used to indicate information of a parent node of the last responding node (i.e. the last responding node corresponding to the first data), and the second demarcation information is further used to indicate information of a parent node of the next responding node (i.e. the next responding node of the last responding node corresponding to the first data), and the integrating module 1020 is specifically configured to: determining data of a target node from the second data, wherein the target node is a response node except a target father node in response nodes corresponding to the second data, and the target father node is the same father 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.
Optionally, with continuing reference to fig. 10, the data query apparatus 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, where the first query request carries a first block size and a query condition, and the first block size indicates a maximum number of response nodes requested to be queried by the first query request. The functional implementation of the sending module 1030 may also refer to the related description of S301 above.
Optionally, the data query apparatus 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, where the second query request carries a second block size, the first boundary information, and a query condition, and the second block size indicates a maximum number of response nodes requested to be queried by the second query request. The functional implementation of the sending module 1030 may also refer to the related description of S305 above.
Optionally, the receiving module 1010 is further configured to receive third boundary information, where the third boundary information is used to indicate information of a last responding node corresponding to the second data. The functional implementation of the receiving module 1010 may also refer to the related description of S311 above.
Optionally, the data query apparatus 1000 further includes:
the sending module 1030 is configured to send a third query request, where the third query request carries a third block size, third boundary information, and a query condition, and the third block size indicates a maximum number of response nodes requested to be queried by the third query request. The functional implementation of the sending module 1030 may also refer to the related description of S312 above.
The receiving module 1010 is further configured to receive third data and fourth boundary information, where the fourth boundary information is used to indicate information of a next response node of a last response node corresponding to the second data, and the third data includes data of the next response node of the last response node corresponding to the second data. The function of the receiving module 1010 can be realized by referring to the above-mentioned related description of S315.
The integrating module 1030 is further configured to integrate the second data with the third data according to the third boundary information and the fourth boundary information. The functional implementation of the integrating module 1030 may also refer to the related description of S316 above.
In summary, in the data query apparatus (e.g., the query request apparatus) provided in this embodiment of the present application, the query request apparatus receives first data and first demarcation information, and receives second data and second demarcation information, where the first demarcation information indicates a last response node corresponding to the first data, the second demarcation information indicates a next response node of the last response node, and the second data includes data of the next response node, so that the query request apparatus integrates the first data with the second data according to the first demarcation information and the second demarcation information, which is helpful for reducing processing overhead of the query request apparatus, thereby reducing processing overhead of the data query scheme. In addition, the data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of batch data queried in different batches is small, and the data quantity of the batch data can be controlled more accurately.
Please refer to fig. 11, which illustrates a schematic logical structure diagram of another data query apparatus 1100 according to an embodiment of the present application. The data query device 1100 may be a query response device as described in the foregoing method embodiments, for example, and possesses or executes the functions of the query response device in fig. 3 and/or fig. 7, and the data query device 1100 may be a network device or a functional component in the network device. Referring to fig. 11, the data query device 1100 includes, but is not limited to:
a sending module 1110, configured to send first data and first boundary information, where the first boundary information is used to indicate information of a last response node corresponding to the first data;
the sending module 1110 is further configured to send second data and second boundary information, where the second boundary information is used to indicate information of a next responding node of the last responding node (i.e., the last responding node corresponding to the first data), the second data includes 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 condition.
And the first demarcation information and the second demarcation information are used for integrating the first data and the second data. The functional implementation of the sending module 1110 may also refer to the related descriptions of S303 and S307 above.
Optionally, with continuing reference to fig. 11, the data query apparatus 000 further includes:
a receiving module 1120, configured to receive a first query request before the sending module 1110 sends the first data and the first boundary information, where the first query request carries a first block size and a query condition, and the first block size indicates a maximum number of response nodes requested to be queried by the first query request;
a query module 1130 for querying the first data in the data model according to the first block size and the query condition.
The functional implementation of the receiving module 1120 and the querying module 1130 can refer to the related description of S302 above.
Optionally, with continuing reference to fig. 11, the data query apparatus 000 further includes:
a receiving module 1120, configured to receive a second query request before the sending module 1110 sends the second data and the second boundary information, where the second query request carries a second block size, the first boundary information, and a query condition, and the second block size indicates a maximum number of response nodes requested to be queried by the second query request;
a query module 1130, configured to query the data model for the second data according to the second block size, the first boundary information, and the query condition.
The functional implementation of the receiving module 1120 and the querying module 1130 can also refer to the related description of S306 above.
Optionally, the query module 1130 is specifically configured to: querying data meeting query conditions in a data model; acquiring a full snapshot of data meeting the query condition; first data is determined in the full snapshot based on the first block size and a query condition.
Optionally, the query module 1130 is specifically configured to determine the second data in the full-size snapshot of the data in the data model, where the full-size snapshot of the data meets the query condition, according to the second block size, the first boundary information, and the query condition.
Optionally, the sending module 1110 is further configured to send third boundary information, where the third boundary information is used to indicate information of a last responding node corresponding to the second data. The functional implementation of the sending module 1110 may also refer to the related description of S310 above.
Optionally, the receiving module 1120 is further configured to receive a third query request, where the third query request carries a third block size, third boundary information, and a query condition, and the third block size indicates a maximum number of response nodes requested to be queried by the third query request. The functional implementation of the receiving module 1120 may also refer to the related description of S312 above.
The query module 1130 is further configured to query the data model for third data according to the third block size, the third bounding information, and the query condition. The functional implementation of the receiving module 1120 may also refer to the related description of S313 above.
The sending module 1110 is further configured to send fourth boundary information and third data, where the fourth boundary information is used to indicate information of a next response node of the last response node corresponding to the second data, and the third data includes data of the next response node of the last response node corresponding to the second data. The functional implementation of the sending module 1110 may also refer to the related description of S314 above.
In summary, in the data query apparatus (e.g., the query response apparatus) provided in this embodiment of the present application, the query response apparatus sends, according to the batch query request sent by the query request apparatus, first data and first demarcation information to the query request apparatus, and sends second data and second demarcation information, where the first demarcation information indicates a last response node corresponding to the first data, the second demarcation information indicates a next response node of the last response node, and the second data includes data of the next response node, so that the query request apparatus integrates the first data and the second data according to the first demarcation information and the second demarcation information, which is beneficial to reducing processing overhead of the query request apparatus, thereby reducing processing overhead of the data query scheme. In addition, the data query scheme supports data query of any type of data nodes, batch data query can be performed by taking any type of data nodes in the data model as demarcation points, the flexibility of data query is high, the difference of batch data queried in different batches is small, and the data quantity of the batch data can be controlled more accurately.
It should be understood that the data query apparatus provided in the embodiments of the present application may also be implemented by an application-specific integrated circuit (ASIC) or a Programmable Logic Device (PLD), which may be a Complex Programmable Logic Device (CPLD), a field-programmable gate array (FPGA), a General Array Logic (GAL), or any combination thereof. The data query method provided by the above method embodiment may also be implemented by software, and when the data query method provided by the above method embodiment is implemented by software, each module in the data query apparatus may also be a software module.
Referring to fig. 12, a schematic diagram of a hardware structure of a data query apparatus 1200 according to an embodiment of the present application is shown. The data query apparatus 1200 may be a query request apparatus or a query response apparatus in any of the above embodiments, and the data query apparatus 1200 may be a network device. Referring to fig. 12, the data query apparatus 1200 includes a processor 1202, a memory 1204, a communication interface 1206, and an internal connection 1208 (bus), and the processor 1202, the memory 1204, and the communication interface 1206 are communicatively connected to each other by the internal connection 1208. Internal connections 1208 may be of any type used to implement an architecture that interconnects processor 1202, memory 1204, and communications interface 1206, e.g., internal connections 1208 may be a system bus and a system backplane.
The memory 1204 may be used for storing, among other things, a computer program 12042, which computer program 12042 may include instructions and data. In the embodiment of the present application, the Memory 1204 may 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 (including compact disc, laser disc, optical disc, digital versatile disc, blu-ray disc, etc.), or magnetic disc or other magnetic storage devices. In the embodiment of the present application, the memory 1204 is used for storing the data model and the data in the data model described in the foregoing embodiments.
Where the processor 1202 may be a general-purpose processor, the general-purpose processor may be a processor that performs certain steps and/or operations by reading and executing a computer program (e.g., computer program 12042) stored in a memory (e.g., memory 1204), which may use data stored in the memory (e.g., memory 1204) in performing the above steps and/or operations. The stored computer programs may be executed, for example, to implement the related functionality of the integration module 1020 and the query module 1130 described previously. A general purpose processor may be, for example but not limited to, a Central Processing Unit (CPU). Further, the processor 1202 may also be a dedicated processor, which may be a specially designed processor for performing certain steps and/or operations, such as, but not limited to, a Network Processor (NP), a Digital Signal Processor (DSP), an ASIC, an FPGA, and the like. Alternatively, the processor 1202 may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor 1202 includes at least one circuit to perform all or a portion of the steps of the data query methods provided by the above embodiments, such as methods or steps associated with the query request device and/or the query response device of fig. 3 and/or fig. 7.
The communication interface 1206 may include an input/output (I/O) interface, a physical interface, a logical interface, and the like, which are used for realizing interconnection of internal devices of the data query apparatus 1200, and an interface used for realizing interconnection of the data query apparatus 1200 and other devices (e.g., network devices). The physical interface may be a network interface, such as a Gigabit Ethernet (GE), which may be used to interconnect the data query apparatus 1200 with other devices (e.g., network devices), and the logical interface is an interface inside the data query apparatus 1200, which may be used to interconnect devices inside the data query apparatus 1200. It is to be understood that the communication interface 1206 can be used for communication between internal components of the data query apparatus 1200 and for communication between the data query apparatus 1200 and other devices, for example, the communication interface 1206 is used for transmission and reception of data between the data query apparatus 1200 and other devices and transmission and reception of query requests. The communication interface 1206 may implement the related functions of the receiving module 1010, the transmitting module 1030, the receiving module 1120, and the transmitting module 1110 described previously. In addition, the communication interface 1206 may further include a transceiver to transmit and receive messages, and the transceiver may also implement the related functions of the receiving module 1010, the transmitting module 1030, the receiving module 1120, and the transmitting module 1110.
Alternatively, the devices may be respectively disposed on separate chips, or at least a part or all of the devices may be disposed on the same chip. Whether each device is separately located on a different chip or integrated on one or more chips is often dependent on the needs of the product design. The embodiment of the present application does not limit the specific implementation form of the above device.
The data query apparatus 1200 shown in fig. 12 is only exemplary, and in implementation, the data query apparatus 1200 may further include other components, which are not listed herein. The data query apparatus 1200 shown in fig. 12 may perform data query by performing all or part of the steps of the data query method provided in the above embodiments.
The embodiment of the application provides a data query system, which comprises a data query device 1000 shown in fig. 10 and a data query device 1100 shown in fig. 11. Alternatively, the data query system includes the data query apparatus 1200 shown in fig. 12.
The embodiment of the present application provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed, all or part of the steps of the data query method provided by the above method embodiment are implemented.
Embodiments of the present application provide a computer program product, which includes a program or code, when the program or code runs on a computer, causes the computer to execute all or part of the steps of the data query method provided by the above method embodiments.
Embodiments of the present application provide a chip, which includes a programmable logic circuit and/or program instructions, and when the chip is operated, the chip is configured to implement all or part of the steps of the data query method provided by the above method embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product comprising one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, digital subscriber line) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or can comprise one or more data storage devices, such as a server, a data center, etc., integrated with the available medium. The usable medium may be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium, or a semiconductor medium (e.g., solid state disk), among others.
It is to be understood that "at least one" as used herein refers to one or more, and "a plurality" refers to two or more. "at least two" means two or more, and in this application, "/" means "or" unless otherwise stated, for example, A/B may mean A or B. "and/or" herein is merely an association describing an associated object, and means that there may be three relationships, e.g., a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, in the present application, the words "first", "second", "third", and the like are used for distinguishing the same items or similar items having substantially the same functions and actions for the sake of clarity. Those skilled in the art will appreciate that the words "first," "second," "third," and the like do not denote any order or quantity, but rather the order of execution.
Different types of embodiments such as the method embodiment and the apparatus embodiment provided by the embodiment of the present application can be mutually referred to, and the embodiment of the present application does not limit this. The sequence of operations in the method embodiments provided in the present application can be appropriately adjusted, and the operations can also be increased or decreased according to the situation, and any method that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present application shall be covered by the protection scope of the present application, and therefore, the details are not repeated.
In the corresponding embodiments provided in the present application, it should be understood that the disclosed apparatus and the like may be implemented by other configuration modes. For example, the above-described apparatus embodiments are merely illustrative, and for example, a division of a unit is merely a logical division, and an actual implementation may have another division, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of some interfaces, devices or units, and may be an electric or other form.
The units described as separate parts may or may not be physically separate, and parts described as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network devices (for example, terminal devices). Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above description is only an exemplary embodiment of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive various equivalent modifications or substitutions within the technical scope of the present application, and these modifications or substitutions should be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (28)

1. A data query method, wherein the method is performed by a network device, and comprises:
receiving first data and first boundary information, wherein the first boundary information is used for indicating information of a last response node corresponding to the first data;
receiving second data and second demarcation information, wherein the second demarcation information is used for indicating information of a next response node of the last response node, the second data comprises data of the next response node, and the response node is a data node which meets the query condition in a data model;
and integrating the first data and the second data according to the first demarcation information and the second demarcation information.
2. The method of claim 1, wherein the integrating the first data with the second data according to the first demarcation information and the second demarcation information comprises:
integrating the first data with the second data according to the information of the last response node indicated by the first demarcation information and the information of the next response node indicated by the second demarcation information.
3. The method of claim 1, wherein the first demarcation information is also used for information indicating a parent node of the last responding node, wherein the second demarcation information is also used for information indicating a parent node of the next responding node,
the integrating the first data with the second data according to the first demarcation information and the second demarcation information includes:
determining data of a target node from the second data, wherein the target node is a response node except a target parent node in 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 demarcation information and the second demarcation information;
merging the data of the target node with the first data.
4. The method of any of claims 1 to 3, wherein prior to receiving the first data and the first demarcation information, the method further comprises:
and sending a first query request, wherein the first query request carries a first block size and the query condition, and the first block size indicates the maximum number of response nodes requested to be queried by the first query request.
5. The method of any of claims 1 to 4, wherein prior to receiving the second data and the second demarcation information, the method further comprises:
and sending a second query request, wherein the second query request carries a second block size, the first boundary information and the query condition, and the second block size indicates the maximum number of response nodes requested to be queried by the second query request.
6. The method according to any one of claims 1 to 5, further comprising:
and receiving third demarcation information, wherein the third demarcation information is used for indicating information of a last response node corresponding to the second data.
7. The method of claim 6, further comprising:
sending a third query request, where the third query request carries a third block size, the third boundary information, and the query condition, and the third block size indicates a maximum number of response nodes requested to be queried by the third query request;
receiving third data and fourth boundary information, wherein the fourth boundary information is used for indicating information of a next response node of a last response node corresponding to the second data, and the third data comprises 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 demarcation information and the fourth demarcation information.
8. A data query method, wherein the method is performed by a network device, and comprises:
sending first data and first boundary information, wherein the first boundary information is used for indicating information of a last response node corresponding to the first data;
sending second data and second demarcation information, wherein the second demarcation information is used for indicating information of a next response node of the last response node, the second data comprises data of the next response node, and the response node is a data node which meets the query condition in a data model;
wherein the first demarcation information and the second demarcation information are used for integration of the first data and the second data.
9. The method of claim 8, wherein prior to transmitting the first data and the first demarcation information, the method further comprises:
receiving a first query request, wherein the first query request carries a first block size and the query condition, and the first block size indicates the maximum number of response nodes requested to be queried by the first query request;
querying the first data in the data model according to the first block size and the query condition.
10. The method of claim 8 or 9, wherein prior to transmitting the second data and the second demarcation information, the method further comprises:
receiving a second query request, wherein the second query request carries a second block size, the first boundary information and the query condition, and the second block size indicates the maximum number of response nodes requested to be queried 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 condition.
11. The method of claim 9, wherein querying the first data in the data model according to the first block size and the query condition comprises:
querying data meeting the query condition in the data model;
acquiring a full snapshot of data meeting the query condition;
determining the first data in the full snapshot according to the first block size and the query condition.
12. The method of claim 10, wherein querying the second data in the data model according to the second block size, the first boundary information, and the query condition comprises:
and determining the second data in the full snapshot of the data meeting the query condition in the data model according to the second block size, the first boundary information and the query condition.
13. A data query apparatus, comprising:
the device comprises a receiving module, a judging module and a judging module, wherein the receiving module is used for receiving first data and first boundary information, and the first boundary information is used for indicating information of a last response node corresponding to the first data;
the receiving module is further configured to receive second data and second demarcation information, where the second demarcation information is used to indicate information of a next response node of the last response node, the second data includes data of the next response node, and the response node is a data node in a data model that meets a query condition;
and the integration module is used for integrating the first data and the second data according to the first boundary information and the second boundary information.
14. The apparatus of claim 13,
the integration module is specifically configured to integrate the first data with the second data according to the information of the last responding node indicated by the first demarcation information and the information of the next responding node indicated by the second demarcation information.
15. The apparatus of claim 13,
the first demarcation information is further configured to indicate information of a parent node of the last response node, the second demarcation information is further configured to indicate information of a parent node of the next response node, and the integration module is specifically configured to:
determining data of a target node from the second data, wherein the target node is a response node except a target parent node in 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 demarcation information and the second demarcation information;
merging the data of the target node with the first data.
16. The apparatus of any of claims 13 to 15, further comprising:
a sending module, configured to send a first query request before the receiving module receives the first data and the first demarcation information, where the first query request carries a first block size and the query condition, and the first block size indicates a maximum number of response nodes requested to be queried by the first query request.
17. The apparatus of any one of claims 13 to 16, further comprising:
a sending module, configured to send a second query request before the receiving module receives the second data and the second boundary information, where the second query request carries a second block size, the first boundary information, and the query condition, and the second block size indicates a maximum number of response nodes requested to be queried by the second query request.
18. The apparatus of any one of claims 13 to 17,
the receiving module is further configured to receive third demarcation information, where the third demarcation information is used to indicate information of a last response node corresponding to the second data.
19. The apparatus of claim 18,
the device further comprises: a sending module, configured to send a third query request, where the third query request carries a third block size, the third boundary information, and the query condition, and the third block size indicates a maximum number of response nodes requested to be queried by the third query request;
the receiving module is further configured to receive third data and fourth boundary information, where the fourth boundary information is used to indicate information of a next response node of a last response node corresponding to the second data, and the third data includes 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 according to the third boundary information and the fourth boundary information.
20. A data query apparatus, comprising:
a sending module, configured to send first data and first boundary information, where the first boundary information is used to indicate information of a last response node corresponding to the first data;
the sending module is further configured to send second data and second boundary information, where the second boundary information is used to indicate information of a next response node of the last response node, the second data includes data of the next response node, and the response node is a data node in a data model that meets a query condition;
wherein the first demarcation information and the second demarcation information are used for integration of the first data and the second data.
21. The apparatus of claim 20, further comprising:
a receiving module, configured to receive a first query request before the sending module sends the first data and the first demarcation information, where the first query request carries a first block size and the query condition, and the first block size indicates a maximum number of response nodes requested to be queried by the first query request;
and the query module is used for querying the first data in the data model according to the first block size and the query condition.
22. The apparatus of claim 20 or 21, further comprising:
a receiving module, configured to receive a second query request before the sending module sends the second data and the second boundary information, where the second query request carries a second block size, the first boundary information, and the query condition, and the second block size indicates a maximum number of response nodes requested to be queried by the second query request;
and the query module is used for querying the second data in the data model according to the second block size, the first boundary information and the query condition.
23. The apparatus of claim 21, wherein the query module is specifically configured to:
querying data meeting the query condition in the data model;
acquiring a full snapshot of data meeting the query condition;
determining the first data in the full snapshot according to the first block size and the query condition.
24. The apparatus of claim 22,
the query module is specifically configured to determine the second data in the full snapshot of the data in the data model that meets the query condition according to the second block size, the first boundary information, and the query condition.
25. A data inquiry device is characterized by comprising a memory and a processor;
the memory is used for storing a computer program;
the processor is configured to execute a computer program stored in the memory to cause the data querying device to perform the method of any one of claims 1 to 12.
26. A computer-readable storage medium, in which a computer program is stored which, when executed, implements the method of any one of claims 1 to 12.
27. A data query system, characterized in that,
the system comprises: a data querying device as claimed in any one of claims 13 to 19, and a data querying device as claimed in any one of claims 20 to 24; alternatively, the first and second electrodes may be,
the system comprises: the data query device of claim 25.
28. A computer program product comprising a program or code which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 12.
CN202110131787.5A 2021-01-30 2021-01-30 Data query method, device and system Pending CN114840715A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110131787.5A CN114840715A (en) 2021-01-30 2021-01-30 Data query method, device and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110131787.5A CN114840715A (en) 2021-01-30 2021-01-30 Data query method, device and system

Publications (1)

Publication Number Publication Date
CN114840715A true CN114840715A (en) 2022-08-02

Family

ID=82561035

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110131787.5A Pending CN114840715A (en) 2021-01-30 2021-01-30 Data query method, device and system

Country Status (1)

Country Link
CN (1) CN114840715A (en)

Similar Documents

Publication Publication Date Title
US11277320B2 (en) Automatic provisioning of monitoring for containerized microservices
US10834013B2 (en) Network slice management
JP2009266245A (en) Method, system and program for managing devices in network
US11263542B2 (en) Technologies for auto discover and connect to a rest interface
CN113839977A (en) Message pushing method and device, computer equipment and storage medium
CN106537347B (en) System and method for distributing and processing streams
CN111490893A (en) Method, device and system for establishing network forwarding model
US20170032052A1 (en) Graph data processing system that supports automatic data model conversion from resource description framework to property graph
CN112764726A (en) Data synthesis method and device
CN111984849A (en) Information query method, device, equipment and medium
CN114168149A (en) Data conversion method and device
US10887249B2 (en) Resource trees by management controller
US8549090B2 (en) Messaging tracking system and method
WO2023279770A1 (en) Data storage method, apparatus and system, storage medium, and program product
CN113536177A (en) Page jump method, device, server and storage medium
CN114840715A (en) Data query method, device and system
CN113726885A (en) Method and device for adjusting flow quota
CN112035413A (en) Metadata information query method and device and storage medium
CN113590348B (en) Parameter transmission method, device, equipment and medium based on tree structure
US20240163182A1 (en) Automated service-oriented performance management
CN117251480A (en) Left external connection query method, device, equipment and medium in distributed environment
CN114860721A (en) Index data construction method and device
CN115617851A (en) Method, device, electronic equipment and computer readable medium for processing request
CN113590348A (en) Parameter transmission method, device, equipment and medium based on tree structure
CN115203228A (en) Data processing method, device, medium, and electronic apparatus

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination