Data interaction method, and node, terminal device and readable medium
By adding a list of broadcast nodes to the gossip broadcast protocol and optimizing the data interaction method, the problems of slow convergence and severe message redundancy are solved, achieving faster convergence and lower message redundancy.
Patent Information
- Application Number
- PCT/CN2024/139682
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-03-21
- Filing Date
- 2024-12-16
- Publication Date
- 2025-09-25
AI Technical Summary
The existing gossip broadcast protocol has a slow convergence speed in networks with poor connectivity or extreme conditions, and in order to increase the convergence speed, it may lead to serious problems such as repeated message processing and redundancy.
By adding a list of broadcast nodes to the message to be broadcast, the gossip broadcast protocol is optimized, and nodes that have not been broadcast are selected from directly connected nodes to send messages with an updated list of broadcast nodes, ensuring that each node knows the currently broadcast nodes, thereby avoiding repeated sending and processing.
It improves the convergence speed of data interaction, reduces message redundancy, and solves the problem of being unable to balance convergence speed and message redundancy.
Smart Images

Figure CN2024139682_25092025_PF_FP_ABST
Abstract
Description
Data interaction method, node, terminal device and readable medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 21, 2024, with application number 202410327443.5 and application name “Data interaction method, node, terminal device and readable medium”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application belongs to the field of data interaction technology, and in particular relates to a data interaction method, node, terminal device and readable medium. Background Art
[0003] In data broadcast technology, the existing gossip broadcast protocol selects several directly connected nodes for broadcasting each time. However, in some networks with poor connectivity or extreme networks (such as networks with star network topology), the push mode (in data interaction, the data sender actively sends data to the data receiver) has a slow convergence speed and requires the use of the pull mode (the data receiver actively pulls data from the data sender) to achieve convergence. However, in order to improve the convergence speed, the pull mode may lead to the problem of repeated message processing, resulting in serious message redundancy, and therefore has many shortcomings. Technical issues
[0004] The embodiments of the present application provide a data interaction method, a node, a terminal device, and a readable medium, which can improve the convergence speed in the current data interaction process without increasing message redundancy. Technical Solutions
[0005] In a first aspect, an embodiment of the present application provides a data interaction method, which is applied to a node; the data interaction method includes:
[0006] Determining nodes to be broadcasted for this broadcast according to a first message to be broadcasted, wherein the first message includes a list of broadcasted nodes;
[0007] Update the broadcast node list according to the node information of the node to be broadcasted to obtain a second message;
[0008] Send the second message to the node to be broadcasted.
[0009] In an optional embodiment, the first message includes a range of nodes to be broadcast; and determining the nodes to be broadcasted for this broadcast based on the first message to be broadcast includes:
[0010] Determine, from directly connected nodes of the current node, nodes that are within the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes;
[0011] The nodes to be broadcasted for this broadcast are determined based on the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable nodes.
[0012] In an optional embodiment, determining the node to be broadcasted for this broadcast based on the broadcasted node list and the node information of the directly connected node of the broadcastable node includes:
[0013] The node with the largest number of directly connected nodes is selected from the broadcastable nodes as the node to be broadcasted for this broadcast.
[0014] In an optional embodiment, determining the node to be broadcasted for this broadcast based on the broadcasted node list and the node information of the directly connected node of the broadcastable node includes:
[0015] Searching for a node that is not included in the broadcasted node list from the broadcastable nodes, and using the found node as a candidate node;
[0016] Select a node from the candidate nodes whose directly connected nodes do not intersect with the directly connected nodes of the current node as the node to be broadcasted;
[0017] At least one node is selected as the node to be broadcast from the candidate nodes that have not been selected as the node to be broadcast.
[0018] In an optional embodiment, the first message is obtained by being sent by the other node; and the method further includes:
[0019] receiving the first message;
[0020] The determining, according to the first message to be broadcasted, the nodes to be broadcasted for this broadcast includes:
[0021] Parsing the first message to obtain a broadcast range of the first message;
[0022] The nodes to be broadcasted are determined according to the broadcast range and the list of broadcasted nodes.
[0023] In an optional embodiment, the data interaction method further includes:
[0024] Determine whether the current node is a node that receives the first message for the first time;
[0025] If not, merging the broadcast node list with the node list corresponding to the first message in the currently broadcast message list, and removing duplicate nodes after the merger to obtain an updated broadcast node list; replacing the broadcast node list in the first message with the updated broadcast node list to generate a third message;
[0026] The third message, the node to be broadcasted, and the node information of the node to be broadcasted are added to a to-be-broadcast list.
[0027] In an optional embodiment, the first message is formed by an initial message to be broadcast generated by the node itself, and determining the node to be broadcasted from directly connected nodes according to the first message to be broadcast includes:
[0028] Determining a node to be broadcasted from the directly connected nodes according to a preset broadcast range of the initial message to be broadcasted;
[0029] The data interaction method further includes:
[0030] Update the node information of this node to an initial broadcast node list;
[0031] The broadcasted node list and the initial message to be broadcast are assembled to form the first message.
[0032] In an optional embodiment, determining the node to be broadcasted from directly connected nodes according to the first message to be broadcasted includes:
[0033] Reading the broadcasted node list in the first message, the broadcastable node information corresponding to the first message, and the directly connected node information of the broadcastable node information;
[0034] Searching for a node that is not included in the broadcasted node list from the broadcastable nodes, and using the found node as a candidate node;
[0035] Select a node from the candidate nodes whose directly connected nodes do not intersect with the directly connected nodes of the current node as the node to be broadcasted;
[0036] At least one node is selected as the node to be broadcast from the candidate nodes that have not been selected as the node to be broadcast.
[0037] In an optional embodiment, the sending the corresponding second message to the node to be broadcast includes:
[0038] Sort each node to be broadcasted to obtain the sending node sequence;
[0039] The corresponding second message is sent to the nodes to be broadcasted in sequence according to the sending node sequence.
[0040] In an optional embodiment, the data interaction method further includes:
[0041] If the current broadcast number of the second message is lower than the set broadcast number, determine the adjacent node to be broadcasted for the next broadcast from the directly connected nodes, update the list of broadcasted nodes in the second message, and send the second message to the adjacent node to be broadcasted for the next broadcast until the current broadcast number reaches the set broadcast number.
[0042] In a second aspect, an embodiment of the present application provides a data interaction node, including:
[0043] A to-be-broadcast node determination module determines the to-be-broadcast nodes for this broadcast according to a first message to be broadcast; the first message includes a list of already-broadcast nodes;
[0044] A second message generating module updates the broadcast node list according to the node information of the node to be broadcasted to obtain a second message;
[0045] The second message sending module sends the second message to the node to be broadcasted.
[0046] In a third aspect, an embodiment of the present application provides a terminal device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described above when executing the computer program.
[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented. Beneficial effects
[0048] The present application provides a data interaction method, node, terminal device and readable medium, which optimizes the gossip broadcast protocol, adds a list of broadcast nodes to the message to be broadcast, then selects the nodes that have not been broadcast from the directly connected nodes, and then sends a message with an updated list of broadcast nodes to the nodes that have not been broadcast. In this way, each node can know the currently broadcasted nodes when receiving the message, and can then choose to send messages only to the nodes that have not been broadcast, thereby reducing the probability of repeated transmission of the same node and improving the convergence speed. At the same time, since the message will not be processed repeatedly, the redundancy of the message is reduced, thereby solving the problem of the current gossip broadcast protocol that cannot take into account both convergence speed and message redundancy. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] FIG1 is a schematic diagram of a step flow of a data interaction method provided in an embodiment of the present application;
[0050] FIG2 is a flowchart of specific sub-steps of step S1 in FIG1 provided in one embodiment of the present application;
[0051] FIG3 is a flowchart of specific sub-steps of step S111 in FIG2 provided in one embodiment of the present application;
[0052] FIG4 is a flowchart of specific sub-steps of step S3 in FIG1 provided in one embodiment of the present application;
[0053] FIG5 is a schematic diagram of the overall process of message broadcasting provided by an embodiment of the present application;
[0054] FIG6 is a flowchart of a phase of receiving a broadcast message in a message broadcast according to an embodiment of the present application;
[0055] 7 is a second flow chart of the phase of receiving broadcast messages in a message broadcast according to an embodiment of the present application;
[0056] FIG8 is a flow chart of the stage of selecting nodes to be broadcasted in a message broadcast according to an embodiment of the present application;
[0057] FIG9 is a flow diagram of a message broadcasting phase in a message broadcasting process according to an embodiment of the present application;
[0058] FIG10 is a schematic diagram of a network topology structure according to an embodiment of the present application;
[0059] FIG11 is a second schematic diagram of a network topology structure provided by an embodiment of the present application;
[0060] FIG12 is a schematic diagram of the structure of a data interaction node provided in an embodiment of the present application;
[0061] FIG13 is a schematic diagram of the structure of the terminal device provided in an embodiment of the present application.
[0062] Implementation Methods of the Application
[0063] In the following description, specific details such as specific system structures and techniques are provided for purposes of illustration rather than limitation to facilitate a thorough understanding of the embodiments of the present application. However, it will be apparent to those skilled in the art that the present application may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obscuring the description of the present application with unnecessary detail.
[0064] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or collections thereof.
[0065] It will also be understood that the term "and / or" used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
[0066] As used in this specification and the appended claims, the term "if" can be interpreted as "when" or "upon" or "in response to determining" or "in response to detecting," depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "upon determination" or "in response to determining" or "upon detection of [described condition or event]" or "in response to detecting [described condition or event]," depending on the context.
[0067] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.
[0068] References to "one embodiment" or "some embodiments" in this specification mean that a particular feature, structure, or characteristic described in conjunction with that embodiment is included in one or more embodiments of the present application. Thus, phrases such as "in one embodiment," "in some embodiments," "in other embodiments," and "in other embodiments" appearing in various places in this specification do not necessarily refer to the same embodiment, but rather mean "one or more but not all embodiments," unless otherwise specifically emphasized. The terms "including," "comprising," "having," and variations thereof all mean "including but not limited to," unless otherwise specifically emphasized.
[0069] Currently, distributed networks can exchange data messages through the Gossip protocol, also known as the Epidemic Protocol or epidemic propagation algorithm. Currently, the distributed data transmission process based on the Gossip protocol is initiated by a seed node. When a seed node has a status update that needs to be transmitted to other nodes in the network, it randomly selects several surrounding nodes to spread the message. The nodes that receive the message will repeat the process until all nodes in the network have received the message.
[0070] In the Gossip protocol, nodes will periodically randomly select surrounding nodes to send messages, and the nodes that receive the messages will also repeat this step. Therefore, it is inevitable that messages will be sent repeatedly to the same node, causing message redundancy and increasing the processing pressure of the nodes that receive the messages. Moreover, since the messages are sent periodically, even nodes that have received the messages will repeatedly receive duplicate messages, which increases the redundancy of the messages.
[0071] Under the Gossip protocol, there are three ways of communication between two nodes in the network:
[0072] Push: Node A pushes the data (key, value, version) and the corresponding version number to node B, and node B updates the data in A that is newer than its own.
[0073] Pull: A pushes only the data key and version to B. B pushes the local data (Key, value, version) that is newer than A to A, and A updates the local data.
[0074] Push / Pull: Similar to Pull, but with one more step. A pushes local data that is newer than B to B, and B updates its local data.
[0075] In some networks with poor connectivity or extreme topology (such as networks with star network topology), the push mode converges slowly and requires the pull mode to achieve convergence; to achieve the same convergence speed, the message redundancy is high.
[0076] Based on this, as shown in FIG1 , an embodiment of the present application provides a data interaction method, which is applied to a node; the data interaction method includes:
[0077] S1: Determine the nodes to be broadcasted according to the first message to be broadcasted; the first message includes a list of broadcasted nodes.
[0078] It should be noted that the node in the embodiment of the present application is a terminal device in the distributed network, which will not be elaborated in this application.
[0079] In this step, the directly connected nodes can specifically be adjacent nodes. In a distributed network, node 1 and node 2 are adjacent and directly connected to each other, so that node 2 is the directly connected node of node 1, and node 1 is the directly connected node of node 2. It should be understood that each node includes at least one directly connected node, that is, some nodes only include one directly connected node, and some nodes include multiple directly connected nodes.
[0080] In addition, it should be noted that this step is only for the step of broadcasting the message of the node executing this data interaction method. In the interaction of the message of this application, the node broadcasts the message at least once, and each time it determines the node to be broadcast from the directly connected node. In the current gossip protocol, in the process of broadcasting multiple messages, the node to be broadcast is randomly selected, so there will be repeated sending of multiple messages to the same directly connected node.
[0081] S2: Update the broadcast node list according to the node information of the node to be broadcasted to obtain a second message.
[0082] The first message and the second message of the present application both include message content to be broadcast. The difference lies in that the broadcast node lists of the first message and the second message are different. Specifically, the broadcast node list of the first message does not include the nodes to be broadcast for this broadcast, while the broadcast node list of the second message includes the nodes to be broadcast for this broadcast.
[0083] For example, the nodes to be broadcast this time are node 3, node 4 and node 5, the list of broadcast nodes in the first message includes node 1 and node 2, and the list of broadcast nodes in the second message includes node 1, node 2, node 3, node 4 and node 5, and the content of the broadcast message is consistent with the message content of the first message.
[0084] In this way, the present application updates the list of broadcast nodes at the data sending node, so that each time the data receiving node receives the second message, it will know the latest list of broadcast nodes, so that the broadcast nodes can be avoided in the subsequent selection of nodes to be broadcast. Compared with the current gossip protocol in which nodes to be broadcast are randomly selected or selected using a specific formula, the present application greatly reduces the number of nodes that are repeatedly received and processed by continuously updating the broadcast nodes, thereby reducing message redundancy.
[0085] It is further necessary to understand that the first message and the second message in the embodiment of the present application are relative concepts, that is, when the data sending node has not yet added the node to be broadcast to the list of broadcast nodes, it is the first message, and when the node to be broadcast is added to the list of broadcast nodes, the first message is converted into the second message, and the second message is the first message of the data receiving node when sending data, which is not elaborated in this application.
[0086] S3: Send the second message to the node to be broadcasted.
[0087] In this step, a second message is sent to the node to be broadcast. After the node to be broadcast receives the second message of this node, if the broadcast has not converged, the node to be broadcast will use the second message of this node as its first message, and then continue to update the list of broadcast nodes, and send its second message to other directly connected nodes, so as to continuously spread the message until the broadcast converges, that is, the set number of node broadcasts is met (for example, all nodes receive the message, or a preset number of nodes receive the node message, for example, 90% of the nodes receive the message and stop broadcasting, and at this time 90% means that the broadcast has converged).
[0088] It can be seen that the data interaction method provided by the present application optimizes the gossip broadcast protocol, adds a list of broadcast nodes to the message to be broadcast, then selects the nodes that have not been broadcast from the directly connected nodes, and then sends a message to the node that has not been broadcast to update the list of broadcast nodes. In this way, each node can know the currently broadcasted nodes when receiving the message, and can then choose to send messages only to the nodes that have not been broadcast, thereby reducing the probability of repeated transmission of the same node and improving the convergence speed. At the same time, since the message will not be processed repeatedly, the redundancy of the message is reduced, thereby solving the problem of the current gossip broadcast protocol that cannot take into account both convergence speed and message redundancy.
[0089] It should be noted that the steps of the method of this application can be executed by a root node or a source node, or a forwarding node, that is, the message content can be generated by the node itself, or it can be the message content received from other nodes. This application does not impose any restrictions on this.
[0090] For a forwarding node, in a specific scenario, the node receives a message sent by an adjacent directly connected node and regards it as a first message. The first message includes a broadcast node list, and the broadcast node list includes its own node information. In this embodiment, the message also includes:
[0091] S011: Receive the first message.
[0092] In this embodiment, the first message received is the second message sent by the adjacent directly connected "upper node". Specifically, the first message includes the message content, the message broadcast range and the list of broadcast nodes, and the list of broadcast nodes includes the node information of this node.
[0093] Step S1, i.e., determining the nodes to be broadcasted for this broadcast according to the first message to be broadcasted, specifically includes:
[0094] S11: Parse the first message to obtain the broadcast range of the first message.
[0095] Specifically, the first message includes message content, message broadcast range and a list of broadcast nodes. Generally speaking, the message can be structured data such as a message. The list of broadcast nodes, message content and message broadcast range carried in the message are determined through preset structural parsing rules.
[0096] S12: According to the broadcast range and the list of broadcasted nodes, determine the nodes to be broadcasted.
[0097] Specifically, the broadcast range of the message includes which nodes the message can be broadcast to, for example, the range is node 1 to node 100. Based on this broadcast range, assuming that the directly connected nodes of node 99 are node 98, node 100, node 103, and node 108, then the nodes to be broadcast determined by node 99 can be node 98 and node 100, or it can be sent only to node 98 or node 100, while node 103 and node 108 are not included as nodes to be broadcast.
[0098] In an optional embodiment, the first message is formed by an initial message to be broadcast generated by the own node, that is, the own node is the source node, and the first message is broadcasted from the own node. In this case, step S1, that is, determining the nodes to be broadcasted from the directly connected nodes based on the first message to be broadcast, includes: determining the nodes to be broadcasted from the directly connected nodes based on the preset broadcast range of the initial message to be broadcast. Since the own node is the source node, the broadcast range of the first message is the initial preset broadcast range, so the nodes to be broadcasted can be determined based on the preset broadcast range and the nodes directly connected to the source node. In this embodiment, the data interaction method also includes:
[0099] S021: Update the node information of the current node to an initial broadcast node list;
[0100] Since this node is the source node, the initial broadcast node list includes this node.
[0101] S022: Assemble the broadcasted node list and the initial message to be broadcast to form the first message.
[0102] In this embodiment, since the current node is a source node, the first message is assembled by the content of the initial message to be broadcast, the preset broadcast range, and the broadcast list formed by the current node.
[0103] Exemplarily, for an embodiment in which this node is a source node, the specific process is to first receive the newly generated message content that needs to be broadcast by this node, and receive the broadcast range of this message; then, based on the broadcast range, filter out the broadcastable nodes directly connected to this node, and carry the node information of these nodes; then, based on the above content, assemble a broadcast message, and the list of broadcasted nodes carried in the message includes this node; finally, put the assembled broadcast message, the selected broadcastable nodes and the node information of these nodes into the list to be broadcast, wait for the broadcast to be processed, and add the message to the list of messages being broadcast.
[0104] In an optional embodiment, in order to avoid repeated reception of messages and reduce message redundancy caused by repeated reception and repeated processing of messages, the present application may exclude repeated processing of messages by determining whether the first message is received for the first time. In this embodiment, as shown in FIG4 , the data interaction method further includes:
[0105] S031: Determine whether this node is the first node to receive the first message.
[0106] Specifically, it is possible to determine whether the message has been broadcast and whether it does not exist in the list of messages being broadcast. If so, the received broadcast message, the selected broadcastable nodes, and the direct connection information of these nodes are put into the list to be broadcast, waiting for the broadcast to be processed, and the message is added to the list of messages being broadcast.
[0107] S032: If not, merge the broadcast node list with the node list corresponding to the first message in the message list currently being broadcast, and remove the duplicate nodes after the merger to obtain an updated broadcast node list; replace the broadcast node list in the first message with the updated broadcast node list to generate a third message.
[0108] If not, it means that the message is not received for the first time. You can merge and deduplicate ① the broadcast nodes carried in this message with the broadcast nodes of this message in the message list being broadcast. Then ② put the updated broadcast message, the selected broadcastable nodes and the direct connection information of these nodes into the list to be broadcast, waiting for the broadcast to be processed, and update the list of broadcast nodes of this message in the message list being broadcast. Since the list of broadcast nodes in the updated message is different, the assembled message is defined as the third message. It should be understood that the difference between the third message, the first message and the second message lies only in the difference in the broadcast node lists, which will not be elaborated here.
[0109] For example, the list of broadcast nodes in the message is: n1, n2, n3; the list of broadcast nodes of this message in the message list being broadcast is: n2, n3, n5. Then after deduplication and merging, the updated list of broadcast nodes is: n1, n2, n3, n5.
[0110] S033: Add the third message, the node to be broadcast, and the node information of the node to be broadcast to a to-be-broadcast list.
[0111] Specifically, in this step, after the message is put into the to-be-broadcast list, the messages in the to-be-broadcast list are traversed, a to-be-broadcast node is selected for each message, and the message is broadcast.
[0112] It should be understood that for each node, the message list being broadcast may include multiple different messages, and this application does not impose any restrictions on this.
[0113] The following is a detailed description of further preferred concepts of the present application.
[0114] In order to improve the broadcast efficiency, the present application further designs the list of broadcast nodes. Specifically, step S1 of the present application, i.e., determining the nodes to be broadcasted for this broadcast according to the first message to be broadcasted, as shown in FIG2 , specifically includes:
[0115] S110: Determine, from directly connected nodes of the current node, nodes that are in the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes.
[0116] Specifically, since the first message includes the message content, the message broadcast range and the list of broadcast nodes, it is possible to determine whether all directly connected nodes of this node can be broadcast based on the message broadcast range. At the same time, combined with the list of broadcast nodes, it is possible to know the nodes that have been broadcast among the directly connected nodes that can be broadcast, and then eliminate them, and use the nodes that have not been broadcast as broadcastable nodes.
[0117] It should be understood that the broadcastable nodes in this application are not the nodes to be broadcast. The difference is that the broadcastable nodes are nodes that are eligible for broadcasting. However, in each message broadcast, not all nodes that are eligible for broadcasting will be selected. Instead, some of them will be selected as the nodes for this broadcast, and the remaining nodes will be selected in subsequent message broadcasts. The number of selections and the number of selections are determined according to the network conditions and network characteristics, which will not be elaborated here. The nodes to be broadcast are the nodes that are ready for broadcasting this time. Obviously, the nodes to be broadcast are selected from the broadcastable nodes.
[0118] S111: Determine the nodes to be broadcasted for this broadcast based on the list of broadcasted nodes and the node information of directly connected nodes of the broadcastable nodes.
[0119] Specifically, a broadcastable node is a directly connected node of this node, and a directly connected node of a broadcastable node means a node to which this node is secondarily connected. For example, node 1 is directly connected to node 2, and node 2 is a broadcastable node, and node 3 is directly connected to node 2. At this time, node 3 is the "directly connected node of the broadcastable node", node 2 is the "broadcastable node", and node 1 is this node.
[0120] In a preferred embodiment of the present application, in order to improve broadcast efficiency, the broadcast of messages can be arranged based on the number of directly connected nodes of the broadcastable node. Specifically, since the same message may be broadcast multiple times in the broadcastable nodes, some of the nodes are selected each time, resulting in a time sequence in the broadcast of the nodes. Based on this feature, the inventor of the present application gives priority to the broadcastable nodes with a larger number of directly connected nodes as the nodes to be broadcast. Specifically, for the current message broadcast, the nodes to be broadcasted for this broadcast are determined based on the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable node, including: selecting the node with the largest number of directly connected nodes from the broadcastable nodes as the node to be broadcasted for this broadcast.
[0121] In this embodiment, since for the current message broadcast, the node with the largest number of directly connected nodes is always selected from the broadcastable nodes as the node to be broadcasted for this broadcast, the node to be broadcasted has the largest number of directly connected nodes during each message broadcast, that is, the broadcastable node with a larger number of directly connected nodes has a higher broadcast priority and can receive the message earlier, thereby giving priority to broadcasting to its own directly connected nodes. Since it has the largest number of directly connected nodes, the scope of propagation is wider, and it can converge faster.
[0122] For example, in the network topology shown in Figure 10, when node 1 generates a message for broadcast, since node 2's directly connected nodes include nodes 3 and 4, and compared to nodes 5, 6, and 7, node 2 has the most directly connected nodes, it will prioritize connecting to node 2 for broadcasting. It will then randomly select several nodes from connected nodes 5, 6, and 7 for broadcasting. This ensures that when nodes 3, 4, and 8 enter the network through node 2, they can receive the broadcast message as soon as possible, allowing it to propagate faster throughout the network, thereby improving broadcast efficiency and enabling faster convergence.
[0123] To further reduce the redundancy of message reception and processing, in an embodiment of the present application, step S111, i.e., determining the nodes to be broadcasted for this broadcast based on the list of broadcasted nodes and the node information of directly connected nodes of the broadcastable nodes, as shown in FIG3 , may include:
[0124] S1110: Searching for nodes that are not included in the broadcasted node list from the broadcastable nodes, and using the found nodes as candidate nodes.
[0125] S1111: Select a node from the candidate nodes whose directly connected nodes have no intersection with the directly connected nodes of the current node as a node to be broadcasted.
[0126] This embodiment prioritizes broadcasting to directly connected nodes without intersection, which is equivalent to prioritizing broadcasting to nodes with the greatest influence in the network architecture (ie, with the most directly connected nodes). This can complete broadcast convergence as quickly as possible and improve convergence speed.
[0127] Furthermore, the present application can also randomly select some nodes from the nodes not selected in step S1111, thereby expanding the broadcast range. Specifically, please continue to refer to FIG3 , the present application further includes:
[0128] S1112: Select at least one node as a node to be broadcast from the candidate nodes that have not been selected as nodes to be broadcast.
[0129] This embodiment selects at least one node as a to-be-broadcast node from the candidate nodes that have not yet been selected as the to-be-broadcast node, thereby avoiding the situation where the number of nodes in a single broadcast is too small, and can reduce the number of broadcasts.
[0130] For example, as shown in FIG11 , a schematic diagram of a network topology structure is shown. In this embodiment, based on the concept of combining the candidate nodes, the broadcasting steps are as follows:
[0131] 1. When node 1 generates a message for broadcast, because the nodes directly connected to node 2 (nodes 3, 4, and 8) do not intersect with its own directly connected nodes (nodes 2, 5, 6, and 7), node 2 is prioritized as the node to be broadcasted. Nodes 5 and 6 are then randomly selected as the nodes to be broadcasted. The broadcast message sent by node 1 to nodes 2, 5, and 6 carries a list of already broadcasted nodes, including nodes 1, 2, 5, and 6.
[0132] 2. When node 5 receives the message broadcast by node 1, it will know that the directly connected nodes (node 1 and node 6) are in the list of broadcast nodes, and will not broadcast again, reducing message redundancy.
[0133] 3. Node 6 receives the message from Node 1 and learns that its directly connected nodes (Node 1 and Node 5) are in the list of already broadcast nodes, while its directly connected node (Node 7) is not. Therefore, Node 6 selects Node 7 as the node to be broadcasted. The message from Node 6 to Node 7 contains the list of already broadcast nodes, which includes Node 1, Node 2, Node 5, Node 6, and Node 7.
[0134] 4. When node 2 receives the message broadcast by node 1, it learns that its directly connected nodes (nodes 3 and 4) are no longer in the broadcast list. Furthermore, node 2's directly connected nodes (nodes 1, 3, and 4) do not intersect with node 3's directly connected nodes (nodes 2 and 8) or node 4's directly connected node (node 2). Therefore, node 3 and node 4 are prioritized as the nodes to be broadcasted. The broadcast message sent by node 2 to nodes 3 and 4 carries the broadcasted node list containing nodes 1, 2, 5, 6, 3, and 4.
[0135] 5. After receiving the message broadcast by node 6, node 7 finds that all directly connected nodes are in the broadcast node list, and no longer broadcasts.
[0136] 6. After node 4 receives the message broadcast by node 2, it finds that all directly connected nodes are in the broadcast node list, so it stops broadcasting.
[0137] 7. After receiving the message from node 2, node 3 realizes that its directly connected node 8 is not in the list of already broadcast nodes, so it selects node 8 as the node to be broadcasted. The broadcast message sent by node 3 to node 8 contains the list of already broadcast nodes, which includes nodes 1, 2, 5, 6, 3, 4, and 8.
[0138] 8. After node 8 receives the message broadcast by node 3, it finds that all directly connected nodes are in the broadcast node list, so it stops broadcasting.
[0139] Through the above embodiment, since the nodes in the candidate node list that are directly connected to the nodes that have no intersection with the nodes directly connected to the current node are selected as the nodes to be broadcasted, that is, the nodes to be broadcasted, the directly connected nodes that have no intersection can be selected for priority broadcasting. The directly connected nodes that have no intersection are equivalent to the "seeds" of another "broadcast circle", thereby achieving the effect of giving priority to broadcasting the nodes with the largest influence range, which is conducive to rapid convergence. For example, in Figure 11, node 2 is the priority broadcast node, and node 2 affects nodes 3, 4 and 8. Therefore, node 2 is the "broadcast circle". The seed "infects" nodes 3, 4, and 8. If node 1 broadcasts nodes 5, 6, and 7 for the first time and node 2 for the second time, nodes 5, 6, and 7 have already been processed, and nodes 2, 3, 4, and 8 begin to be "infected", resulting in a decrease in the overall speed. Similarly, through the above method, node 2 preferentially "infects" node 3, and the infection time of nodes 8 and 4 is not much different. If node 4 is infected first, node 4 is finished, while node 8 has not yet been infected, and it still needs one more broadcast time. It can be seen that the convergence speed can be improved through this embodiment.
[0140] It can be understood that the above embodiment of the present application describes the scenario of a single message broadcast. Specifically, in actual broadcasting, for the same message, multiple message broadcasts can be performed. For example, assuming that it is necessary to broadcast to nodes 1 to 100, node 1 broadcasts to nodes 2 and 3 for the first time, and broadcasts to nodes 4 and 5 for the second time (assuming that nodes 2 to 5 are directly connected nodes of node 1). At this time, for a single broadcast, the broadcasts can be performed in sequence. In this embodiment, the sending of the corresponding second message to the node to be broadcast includes:
[0141] S31: Sort each node to be broadcasted to obtain a sending node sequence;
[0142] The sending node sequence includes the order in which the nodes are sent. For example, in the first broadcast of node 1 above, the message is broadcast to nodes 2 and 3. The sending node sequence can be: 1, node 2; 2, node 3.
[0143] S32: Send the corresponding second message to the nodes to be broadcasted in sequence according to the sending node sequence.
[0144] In addition, for multiple message broadcasts, the present application can perform multiple broadcasts in an iterative manner, and set the trigger condition for the iteration to whether the number of broadcasts meets the set number of broadcasts. It should be understood that the set number of broadcasts can be determined based on parameters such as distributed network characteristics. Optionally, the set number of broadcasts can be stored in the memory of the node sending the message through a configuration file. This application does not impose any restrictions on this.
[0145] In an optional embodiment, multiple broadcasts are performed in an iterative manner, and the data interaction method also includes: if the current number of broadcasts of the second message is lower than the set number of broadcasts, determining the adjacent node to be broadcasted for the next broadcast from the directly connected nodes, updating the list of broadcasted nodes in the second message, and sending the second message to the adjacent node to be broadcasted for the next broadcast, until the current number of broadcasts reaches the set number of broadcasts.
[0146] Specifically, it can be determined whether the number of times the message is broadcast is sufficient. If the number of times the message is broadcast is sufficient, the message is removed from the list of messages being broadcast and the record of messages that have been broadcast is updated. If the number of times the message is broadcast is insufficient, the list of broadcast nodes of the message in the list of messages being broadcast is updated.
[0147] In order to explain the present application more clearly, the present application shows process examples of each stage in the broadcasting process.
[0148] Overall process
[0149] As shown in Figure 5, the prerequisite is that each node knows the directly connected node information of its adjacent directly connected nodes in the network. The overall process includes:
[0150] 1) A node receives a gossip broadcast message from another node in the network, which carries a list of nodes to which the message has been broadcast (in other embodiments, the node's gossip broadcast message may be a newly generated message that needs to be broadcast by the node).
[0151] 2) The node selects the node to be broadcast based on the broadcast node list information carried in the message and the directly connected node information of the adjacent directly connected nodes known to the current node.
[0152] 3) The node adds the selected nodes to be broadcasted to the list of nodes that have been broadcasted carried in the message, and broadcasts the message to these nodes to be broadcasted.
[0153] Receiving broadcast messages
[0154] As shown in FIG6 and FIG7, the broadcast message may be a message newly generated by the node and needs to be broadcasted, or a broadcast message sent by other nodes.
[0155] 1) If the broadcast message is a new message generated by the node and needs to be broadcast, as shown in Figure 6, the process is as follows:
[0156] 1. Retrieve the newly generated message content to be broadcast from the memory of this node, and retrieve the broadcast range of this message;
[0157] 2. Based on the broadcast range, filter out the broadcast nodes that the node is directly connected to and carry the directly connected node information of these nodes;
[0158] 3. Based on the above content, assemble a broadcast message, and the list of broadcast nodes carried in the message includes this node;
[0159] 4. Put the assembled broadcast message, the selected broadcastable nodes and the direct connection information of these nodes into the waiting broadcast list, wait for the broadcast to be processed, and add the message to the list of messages being broadcast.
[0160] 2) If the broadcast message is received from other nodes, as shown in Figure 7, the process is as follows:
[0161] 1. Receive a broadcast message from another node, which contains a list of broadcast nodes.
[0162] 2. Check if the message has been broadcasted. If so, skip the process. Otherwise, proceed to the next step.
[0163] 3. Parse the broadcast message and obtain the broadcast range of the broadcast message;
[0164] 4. Based on the broadcast range, filter out the broadcast nodes that the node is directly connected to and carry the directly connected node information of these nodes;
[0165] 5. Determine whether this message is received for the first time, that is, whether the message has been broadcast and does not exist in the list of messages being broadcast;
[0166] (1) If yes, the received broadcast message, the selected broadcastable nodes, and the direct connection information of these nodes are put into the list to be broadcasted, waiting for the broadcast to be processed, and the message is added to the list of messages being broadcasted;
[0167] (2) If not, ① the broadcast nodes carried in this message are merged with the broadcast nodes of this message in the list of messages being broadcast, and duplicates are removed. ② The updated broadcast message, the selected broadcastable nodes, and the direct connection information of these nodes are placed in the list to be broadcasted, waiting for the broadcast to be processed, and the list of broadcast nodes of this message in the list of messages being broadcasted is updated.
[0168] After putting the message into the to-be-broadcast list, traverse the messages in the to-be-broadcast list, select a to-be-broadcast node for each message, and broadcast the message.
[0169] Select the node to be broadcasted
[0170] As shown in FIG8 , the process of selecting a node to be broadcasted for a message in a to-be-broadcast list is as follows:
[0171] 1. Get a list of all directly connected nodes of this node;
[0172] 2. Read the broadcastable node information and directly connected node information of these nodes carried in the message, as well as the broadcasted node list information carried in the broadcast message;
[0173] 3. Find the node list information included in the broadcastable node information list but not included in the broadcast node list carried in the message as the candidate node list;
[0174] 4. Find a node in the candidate node list whose directly connected nodes do not intersect with the node directly connected to this node, and select it as the node to be broadcasted;
[0175] 5. Randomly select several nodes from the candidate node list that have not been selected as nodes to be broadcasted, and also select them as nodes to be broadcasted;
[0176] 6. The node list selected in the above manner is used as the node list to be broadcasted by this node for this message, that is, the node list to be broadcasted.
[0177] Message Broadcast
[0178] As shown in Figure 9, after the message in the to-be-broadcast list selects the to-be-broadcast node, the process of message broadcasting is as follows:
[0179] 1. Add the selected nodes to be broadcast to the list of broadcast nodes carried in the message and remove duplicates;
[0180] 2. Re-serialize the messages and send them one by one to the nodes to be broadcasted;
[0181] 3. Update the number of times the message is broadcast;
[0182] 4. Determine whether the number of times the message is broadcast is sufficient;
[0183] (1) If the message has been broadcast enough times, the message will be removed from the list of messages being broadcast and the record of messages that have been broadcast will be updated;
[0184] (2) If it is insufficient, update the broadcast node list information of the message in the message list being broadcast.
[0185] It can be seen from the above stages that this application solves the problem that the current gossip broadcast protocol cannot balance convergence speed and message redundancy.
[0186] The following describes in detail a data interaction node provided by an embodiment of the present application. The data interaction node is a data sending node. As shown in FIG12 , the data interaction node includes:
[0187] The to-be-broadcasted node determination module 1 determines the to-be-broadcasted nodes for this broadcast according to the first message to be broadcast; the first message includes a list of broadcasted nodes;
[0188] A second message generating module 2 updates the broadcast node list according to the node information of the node to be broadcasted to obtain a second message;
[0189] The second message sending module 3 sends the second message to the node to be broadcasted.
[0190] It can be seen that based on the detailed description of the above method step embodiments, the data interaction node provided by the present application reduces the probability of repeated transmission of the same node and improves the convergence speed. At the same time, since the messages will not be processed repeatedly, the redundancy of the messages is reduced, thereby solving the problem of the current gossip broadcast protocol that cannot take into account both convergence speed and message redundancy.
[0191] Based on the same inventive concept, in an optional embodiment, the module for determining nodes to be broadcast includes:
[0192] a range determination unit, which determines, from directly connected nodes of the current node, nodes that are within the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes;
[0193] The node-to-be-broadcast determining unit determines the node to be broadcasted for this broadcast according to the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable node.
[0194] Based on the same inventive concept, in an optional embodiment, the to-be-broadcasted node determination unit is specifically configured to select a node with the largest number of directly connected nodes from the broadcastable nodes as the to-be-broadcasted node for this broadcast.
[0195] Based on the same inventive concept, in an optional embodiment, the to-be-broadcasted node determination unit specifically includes:
[0196] a candidate node determining unit, searching for nodes that are not included in the broadcast node list from the broadcastable nodes, and using the found nodes as candidate nodes;
[0197] An intersection determination unit selects a node whose directly connected nodes do not intersect with the directly connected nodes of the current node from the candidate nodes as a node to be broadcasted;
[0198] Based on the same inventive concept, in an optional embodiment, the to-be-broadcasted node determination unit further includes:
[0199] The selection unit selects at least one node as the node to be broadcast from the candidate nodes that have not been selected as the node to be broadcast.
[0200] Based on the same inventive concept, in an optional embodiment, the first message is obtained by sending the other node; the data interaction node further includes:
[0201] A receiving module, receiving the first message;
[0202] The module for determining nodes to be broadcasted includes:
[0203] a parsing unit, configured to parse the first message and obtain a broadcast range of the first message;
[0204] A determining unit is configured to determine nodes to be broadcasted according to the broadcast range and the list of broadcasted nodes.
[0205] Based on the same inventive concept, in an optional embodiment, the data interaction node further includes:
[0206] A judgment module, judging whether the current node is a node that receives the first message for the first time;
[0207] If not, the update module merges the broadcast node list with the node list corresponding to the first message in the currently broadcast message list, removes duplicate nodes after the merger, and obtains an updated broadcast node list; replaces the broadcast node list in the first message with the updated broadcast node list to generate a third message;
[0208] An adding module adds the third message, the node to be broadcast, and the node information of the node to be broadcast to a list of messages to be broadcast.
[0209] Based on the same inventive concept, in an optional embodiment, the first message is formed by an initial message to be broadcast generated by the node itself, and the node to be broadcast determining module is specifically configured to determine the node to be broadcast from the directly connected nodes according to a preset broadcast range of the initial message to be broadcast;
[0210] The data interaction node also includes:
[0211] Node update module, updates the node information of this node to the initial broadcast node list;
[0212] An assembling module assembles the broadcasted node list and the initial message to be broadcast to form the first message.
[0213] Based on the same inventive concept, in an optional embodiment, the second message sending module includes:
[0214] The sorting unit sorts each node to be broadcasted to obtain a sending node sequence;
[0215] The second message sending unit sends the corresponding second message to the nodes to be broadcasted in sequence according to the sending node sequence.
[0216] Based on the same inventive concept, in an optional embodiment, the data interaction node further includes:
[0217] The iterative broadcast unit determines the adjacent node to be broadcasted for the next broadcast from the directly connected nodes if the current broadcast number of the second message is lower than the set broadcast number, updates the list of broadcasted nodes in the second message, and sends the second message to the adjacent node to be broadcasted for the next broadcast until the current broadcast number reaches the set broadcast number.
[0218] In addition, the present application further provides a distributed network system, which may be a blockchain system or other distributed network system, and the present application does not impose any restrictions on this.
[0219] Specifically, this distributed network system includes multiple nodes, each of which can be a sending node or a receiving node. When the data interaction node is a sending node, the above steps of this application are executed. When the data interaction node is a receiving node, it receives the message sent by the previous sending node, and then becomes a sending node to forward the message until the broadcast converges.
[0220] FIG13 is a schematic diagram of the structure of a terminal device provided in an embodiment of the present application. The terminal device 400 includes: at least one processor 401 (only one processor is shown in FIG13 ), a memory 402, and a computer program 403 stored in the memory 402 and executable on the at least one processor 401. When the processor 401 executes the computer program 403, the steps in the above method embodiment are implemented.
[0221] The terminal device 400 can be a computing device such as a desktop computer, laptop, PDA, or cloud server. The terminal device may include, but is not limited to, a processor 401 and a memory 402. Those skilled in the art will appreciate that FIG13 is merely an example of the terminal device 400 and does not limit the terminal device 400. The terminal device 400 may include more or fewer components than shown, or may combine certain components or different components. For example, it may also include input / output devices, network access devices, etc.
[0222] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor may be a microprocessor or any conventional processor.
[0223] In some embodiments, the memory 402 may be an internal storage unit of the terminal device 400, such as a hard disk or memory of the terminal device 400. In other embodiments, the memory 402 may also be an external storage device of the terminal device 400, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 400. Furthermore, the memory 402 may also include both an internal storage unit of the terminal device 400 and an external storage device. The memory 402 is used to store an operating system, an application program, a boot loader, data, and other programs, such as the program code of the computer program. The memory 402 may also be used to temporarily store data that has been output or is about to be output.
[0224] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0225] An embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above-mentioned various method embodiments can be implemented.
[0226] An embodiment of the present application provides a computer program product. When the computer program product is run on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned various method embodiments when executing the computer program product.
[0227] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the process of the above-mentioned method embodiment by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, it can implement the steps of each of the above-mentioned method embodiments. The computer program includes computer program code, which can be in source code form, object code form, executable file, or some intermediate form. The computer-readable medium can at least include: any entity or device capable of carrying computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, mobile hard drive, magnetic disk, or optical disk. In some jurisdictions, based on legislation and patent practice, computer-readable media cannot be electric carrier signals or telecommunication signals.
[0228] In the above embodiments, the description of each embodiment has its own focus. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant description of other embodiments.
[0229] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0230] In the embodiments provided in this application, it should be understood that the disclosed devices / network equipment and methods can be implemented in other ways. For example, the device / network equipment embodiments described above are merely illustrative. For example, the division of the modules or units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0231] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of these units may be selected to achieve the purpose of this embodiment according to actual needs.
[0232] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the scope of protection of the present application.
Claims
1. A data interaction method, characterized in that: The data interaction method is applied to a node; the data interaction method includes: Determine the nodes to be broadcasted for this broadcast according to the first message to be broadcasted, wherein the first message includes a list of broadcasted nodes; Update the broadcast node list according to the node information of the node to be broadcasted to obtain a second message; Send the second message to the node to be broadcasted.
2. The data interaction method according to claim 1, characterized in that: The first message includes a range of nodes to be broadcast; and determining the nodes to be broadcasted for this broadcast based on the first message to be broadcast includes: Determine, from directly connected nodes of the current node, nodes that are within the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes; The nodes to be broadcasted for this broadcast are determined based on the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable nodes.
3. The data interaction method according to claim 2, characterized in that: The determining of the nodes to be broadcasted for this broadcast according to the broadcasted node list and the node information of the directly connected nodes of the broadcastable nodes includes: The node with the largest number of directly connected nodes is selected from the broadcastable nodes as the node to be broadcasted for this broadcast.
4. The data interaction method according to claim 2, characterized in that: The determining of the nodes to be broadcasted for this broadcast according to the broadcasted node list and the node information of the directly connected nodes of the broadcastable nodes includes: Searching for a node that is not included in the broadcasted node list from the broadcastable nodes, and using the found node as a candidate node; A node whose directly connected nodes have no intersection with the directly connected nodes of the current node is selected from the candidate nodes as a node to be broadcasted.
5. The data interaction method according to claim 4, characterized in that: The determining of the nodes to be broadcasted for this broadcast based on the list of broadcasted nodes and the node information of directly connected nodes of the broadcastable nodes further includes: At least one node is selected as the node to be broadcast from the candidate nodes that have not been selected as the node to be broadcast.
6. The data interaction method according to claim 1, characterized in that: The first message is obtained by sending it through other nodes; The data interaction method further includes: receiving the first message; The determining, according to the first message to be broadcasted, the nodes to be broadcasted for this broadcast includes: Parsing the first message to obtain a broadcast range of the first message; Determine the nodes to be broadcasted according to the broadcast range and the list of broadcasted nodes.
7. The data interaction method according to claim 6, characterized in that: The data interaction method further includes: Determining whether the node receives the first message for the first time; If not, merging the broadcast node list with the node list corresponding to the first message in the currently broadcast message list, and removing duplicate nodes after the merger to obtain an updated broadcast node list; replacing the broadcast node list in the first message with the updated broadcast node list to generate a third message; The third message, the node to be broadcasted, and the node information of the node to be broadcasted are added to a list of messages to be broadcasted.
8. The data interaction method according to claim 1, characterized in that: The first message is formed by an initial message to be broadcast generated by the node itself, and determining the node to be broadcasted from directly connected nodes according to the first message to be broadcast includes: Determining a node to be broadcasted from the directly connected nodes according to a preset broadcast range of the initial message to be broadcasted; The data interaction method further includes: Update the node information of this node to the initial broadcast node list; The broadcasted node list and the initial message to be broadcast are assembled to form the first message.
9. The data interaction method according to claim 1, characterized in that: The data interaction method further includes: If the current broadcast number of the second message is lower than the set broadcast number, determine the adjacent node to be broadcasted for the next broadcast from the directly connected nodes, update the list of broadcasted nodes in the second message, and send the second message to the adjacent node to be broadcasted for the next broadcast until the current broadcast number reaches the set broadcast number.
10. A data interaction node, characterized in that: include: A to-be-broadcasted node determination module determines the to-be-broadcasted nodes for this broadcast according to the first message to be broadcasted; The first message includes a broadcast node list; A second message generating module updates the broadcast node list according to the node information of the node to be broadcasted to obtain a second message; The second message sending module sends the second message to the node to be broadcasted.
11. The data interaction node according to claim 10, characterized in that: The first message includes a range of nodes to be broadcast; and the module for determining nodes to be broadcast includes: a range determination unit, which determines, from directly connected nodes of the current node, nodes that are within the range of nodes to be broadcasted and are not in the list of broadcasted nodes as broadcastable nodes; The node-to-be-broadcast determining unit determines the node to be broadcasted for this broadcast according to the list of broadcasted nodes and the node information of the directly connected nodes of the broadcastable node.
12. The data interaction node according to claim 11, characterized in that: The node-to-be-broadcasted determining unit is specifically configured to select a node with the largest number of directly connected nodes from the broadcastable nodes as the node to be broadcasted for this broadcast.
13. The data interaction node according to claim 11, characterized in that: The node to be broadcasted determining unit specifically includes: a candidate node determining unit, searching for nodes that are not included in the broadcast node list from the broadcastable nodes, and using the found nodes as candidate nodes; The intersection determination unit selects a node whose directly connected nodes have no intersection with the directly connected nodes of the current node from the candidate nodes as a node to be broadcasted.
14. The data interaction node according to claim 10, characterized in that: The first message is obtained by sending it through other nodes; The data interaction node also includes: A receiving module, receiving the first message; The module for determining nodes to be broadcasted includes: a parsing unit, configured to parse the first message and obtain a broadcast range of the first message; A determining unit is configured to determine nodes to be broadcasted according to the broadcast range and the list of broadcasted nodes.
15. The data interaction node according to claim 14, characterized in that: The data interaction node also includes: A judgment module, judging whether the current node is a node that receives the first message for the first time; If not, the update module merges the broadcast node list with the node list corresponding to the first message in the currently broadcast message list, removes duplicate nodes after the merger, and obtains an updated broadcast node list; replaces the broadcast node list in the first message with the updated broadcast node list to generate a third message; An adding module adds the third message, the node to be broadcast, and the node information of the node to be broadcast to a list of messages to be broadcast.
16. The data interaction node according to claim 10, characterized in that: The first message is formed by an initial message to be broadcast generated by the node itself, and the node to be broadcast determining module is specifically configured to determine the node to be broadcast from directly connected nodes according to a preset broadcast range of the initial message to be broadcast; The data interaction node also includes: Node update module, updates the node information of this node to the initial broadcast node list; An assembling module assembles the broadcasted node list and the initial message to be broadcast to form the first message.
17. The data interaction node according to claim 10, characterized in that: The second message sending module includes: The sorting unit sorts each node to be broadcasted to obtain a sending node sequence; The second message sending unit sends the corresponding second message to the nodes to be broadcasted in sequence according to the sending node sequence.
18. The data interaction node according to claim 10, characterized in that: The data interaction node also includes: The iterative broadcast unit determines the adjacent node to be broadcasted for the next broadcast from the directly connected nodes if the current broadcast number of the second message is lower than the set broadcast number, updates the list of broadcasted nodes in the second message, and sends the second message to the adjacent node to be broadcasted for the next broadcast until the current broadcast number reaches the set broadcast number.
19. A terminal device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the data interaction method according to any one of claims 1 to 9 is implemented.
20. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the data interaction method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Message broadcasting method and device, computer equipment and storage medium
CN114024786A
Message broadcasting method and device
CN116248594A
Data interaction method, node, terminal equipment and readable medium
CN118101360A
Energy efficiency flooding method and system of wireless sensor network
KR1020090037542A