WO2021159478A1 - Message order preservation method and apparatus - Google Patents

Message order preservation method and apparatus Download PDF

Info

Publication number
WO2021159478A1
WO2021159478A1 PCT/CN2020/075305 CN2020075305W WO2021159478A1 WO 2021159478 A1 WO2021159478 A1 WO 2021159478A1 CN 2020075305 W CN2020075305 W CN 2020075305W WO 2021159478 A1 WO2021159478 A1 WO 2021159478A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
preserving
order
messages
type
Prior art date
Application number
PCT/CN2020/075305
Other languages
French (fr)
Chinese (zh)
Inventor
匡小波
张高川
陈小平
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2020/075305 priority Critical patent/WO2021159478A1/en
Priority to CN202080083313.1A priority patent/CN114731334B/en
Publication of WO2021159478A1 publication Critical patent/WO2021159478A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/54Store-and-forward switching systems 
    • H04L12/56Packet switching systems
    • H04L12/5601Transfer mode dependent, e.g. ATM
    • H04L2012/5603Access techniques

Definitions

  • This application relates to the field of data communication, and in particular to a method and device for message sequence preservation.
  • the data transmission system includes multiple modules, and messages can be transmitted between the modules.
  • the message transmission method includes sequence-preserving transmission, that is, when transmitting messages between modules, the sending order of messages with sequence-preserving relationship is guaranteed.
  • the message with sequence-preserving relationship can be understood as:
  • the usual method is: if multiple messages are transmitted between the first module and the second module, the first module sends to the second module one of the multiple messages.
  • the first module can only send the message after receiving the confirmation message sent by the second module.
  • the second module is receiving and executing the message sent by the first module. After the previous message, a confirmation message is sent to the first module.
  • the bandwidth utilization rate is greatly reduced, and the transmission delay of the message is large.
  • the order-preserving transmission delay of the message is invisibly lengthened; on the other hand, due to the large transmission delay of the message, over time, an accumulation effect occurs, which greatly affects the message transmission of more upstream modules. .
  • This application provides a method for message sequence preservation, which is used to solve the problem that since the first module has to send a message after receiving the confirmation message sent by the second module, the bandwidth utilization rate is greatly reduced, and the transmission of the message is caused.
  • the delay is large, so that the order-preserving transmission delay of the message is invisibly lengthened, and because the transmission delay of the message is large, it has an accumulation effect over time, which greatly affects the more upstream modules.
  • a method for preserving message sequence including: receiving a first message, wherein the first message is any one of a plurality of messages; The transmission sequence in the multiple messages and the order-preserving relationship between the first message and other messages in the multiple messages encode the first message to obtain the encoding of the first message Send the first message and its code to the second module; wherein the code of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages .
  • the second module determines the message that is ranked before the first message and restricts the execution of the first message according to the encoding of the first message, thus realizing the first message Order-preserving transmission of messages; in addition, since the encoding of the first message indicates the execution relationship between the first message and other messages in multiple messages (that is, it is arranged before the first message and restricts the execution of the first message Therefore, compared with the prior art, when the first message is transmitted between the first module and the second module, there is no need for the second module to send a confirmation message to the first message.
  • the order-preserving transmission of the first message can be realized, which greatly shortens the transmission delay of the message, thereby avoiding the occurrence of the message.
  • the phenomenon that the transmission delay of document preservation is invisibly elongated greatly improves the utilization of bandwidth; in addition, because the transmission delay of the message is shortened, the problem of accumulation effect due to the passage of time is avoided, and the problem is extremely high. It greatly reduces the impact on the transmission of the messages of the more upstream modules; in addition, by setting the encoding for the first message, the order-preserving transmission of the messages is realized, which is simple and easy to implement.
  • the multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations.
  • a message and a second message, and the second message depends on the first message for order preservation.
  • the sequence relationship encoding the first message includes:
  • first message is the first message or the second message in the i-th group of order-preserving relations
  • set a first code based on the i-th group of order-preserving relations for the first message
  • the first code is used to indicate the order-preserving interval based on the i-th group of order-preserving relationship to which the first message belongs
  • the order-preserving interval is obtained by dividing the plurality of messages by a dividing node
  • the division node is a node where the second type of message in the i-th group of order-preserving relationship is switched to the first type of message, and the plurality of messages are based on each of the plurality of messages
  • a second code based on the i-th group of order-preserving relations is set for the first message
  • the second code is used to indicate the number of messages of the first type in the sequence-preserving interval based on the i-th group of sequence-preserving relationship to which the
  • each of the N groups of order-preserving relations is a direct order-preserving relationship; or a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relationship, The other part of the order-preserving relationship is the indirect order-preserving relationship.
  • the multiple messages include three types of messages, which are P messages, NP messages, and CPL messages, respectively, and the multiple messages include two sets of order-preserving relationships.
  • the two groups of order-preserving relations are all direct order-preserving relations; among them, the first type of message in the first group of direct order-preserving relations is a P message, and the second type of message in the first group of direct order-preserving relations is a CPL message.
  • the first type of message in the second group of direct preserving relations is a P message, and the second type of message in the second group of direct preserving relations is an NP message.
  • the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1 ⁇ k ⁇ M- 1 and both k and M are integers;
  • Said processing the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding includes:
  • the dividing node is a node where the M-th message is switched to any one of the first message to the M-1 message, and the multiple messages are in accordance with the multiple messages.
  • the order of sending each message in the The code is used to indicate the sequence number of the first message in the message in the order-preserving interval to which it belongs; if the first message is the k-th message and 2 ⁇ k ⁇ M-1, Then, a second code is set for the first message, and the second code includes a first number and a second number, and the first number is used to indicate that the first message belongs in the order-preserving interval within the first message.
  • the number of type 1 messages to type k-1 messages before a message and the second number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs ; If the first message is the M-th message, a second code is set for the first message, and the second code includes a first number and a second number, and the first number is used Indicates the number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the first message belongs, and the second number is used to indicate the number of the first message The sequence number of the message in the message in the preserving interval to which it belongs.
  • the multiple messages include type M messages, and at least one type of messages in the M type messages includes multiple types of messages, and among them, the k+1 type messages
  • a type of message directly depends on the order-preserving relationship between the k-th type of message and the order-preserving message, and a type of message in the k+1-th type of message indirectly depends on the type 1 message to the k-th type of message.
  • Type 1 messages the order is preserved for the messages with the order-preserving relationship, 1 ⁇ k ⁇ M-1 and both k and M are integers;
  • Said processing the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding includes:
  • the dividing node is a type of message or any type of message designated in the M-th type of message is switched to a type of message or any type of message that is designated in the type 1 message to the M-1 type of message.
  • the multiple messages include two types of messages, where the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages.
  • the message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
  • a method for preserving message sequence including: receiving a first message sent by a first module and its code, wherein the first message is any one of a plurality of messages; The encoding of the first message determines whether to execute the first message; wherein the encoding of the first message is used to indicate the difference between the first message and other messages in the plurality of messages Execution relationship.
  • the execution relationship between the first message and other messages in the multiple messages can be quickly determined (that is, the execution relationship between the first message and the other messages in the multiple messages is determined).
  • the order-preserving transmission of the message is realized, and the message that is arranged before the first message and restricts the execution of the first message is faster and more accurate Determine whether to execute the first message, which improves the efficiency of message execution.
  • the multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations.
  • the second type of message and the second type of message, and the second type of message depends on the first type of message for order preservation; for the i-th group of order-preserving relations, the first group of the i-th group of order-preserving relations
  • the first code of one type of message and the second type of message based on the i-th group of preserving relationship is used to indicate to which the first type of message and the second type of message belong based on the i-th group of preserving
  • the order-preserving interval of the order relationship; for the i-th group of order-preserving relations, the second message in the i-th group of order-preserving relations is based on the second code of the i-th group of order-preserving relations to indicate the second The number of the first type of message in the i-th group of order-preserving relations in the order-
  • the determining whether to execute the order according to the encoding of the first message includes:
  • the first message is executed; if the first message is the first message in the x-th group of direct order-preserving relations
  • the first message is executed when it is determined that the execution of the first target message has been completed based on the first code and the second code of the x-th group of direct order-preserving relationship of the first message
  • the first target message includes the first type of message in the x-th group of direct order-preserving relations located in the order-preserving interval to which the first message belongs and before the order-preserving interval to which the first message belongs
  • the x-th group in the order-preserving interval of is the first message in the direct order-preserving relationship; among them, 1 ⁇ x ⁇ N, and x is an integer.
  • the first The encoding of the message to determine whether to execute the first message includes:
  • the first message is executed; if the first message is only the second message in the x-th group of direct order-preserving relations Message, or if the first message is the second message in the x-th group of direct order-preserving relations and the first message is the first message in the j-th group of direct order-preserving relations, then When it is determined that the execution of the first target message has been completed according to the first message based on the first code and the second code of the x-th group of direct order-preserving relationship, the first message is executed; if the first message The message is the second type of message in the x-th group of direct order-preserving relations and the first message is the first type of message in the j-th group of direct order-preserving relations, and the first message is the q
  • the second type of message in the order-preserving relationship or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the q-th group of indirect order-preserving relations
  • the first target message includes the first message located in the first
  • the first type of message in the x-th group of direct-order-preserving relationships in the x-th group of direct-order-preserving interval to which the message belongs and the x-th group-based direct-ordering relationship to which the first message belongs The first message in the x-th group of direct sequence-preserving relationships in the sequence-preserving interval before the sequence-preserving interval; the second target message includes
  • the number of type 1 messages to type k-1 messages before the message where the second number is used to indicate the sequence number of the type k message in the message in the sequence preservation interval to which it belongs;
  • the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval.
  • the number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
  • the determining whether to execute the first message according to the encoding of the first message includes:
  • a message sequence preserving device including: a first receiving module, configured to receive a first message, wherein the first message is any one of a plurality of messages; an encoding module, Is used to compare the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding to obtain the encoding of the first message; a sending module for sending the first message and its encoding to the second module; wherein the encoding of the first message is used to indicate the first message The execution relationship between the message and other messages in the plurality of messages.
  • the multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations.
  • a message and a second message, and the second message depends on the first message for order preservation.
  • the encoding module includes: a first encoding unit, configured to, if the first message is the first type of message or the second type of message in the i-th group of order-preserving relationship, Then, a first code based on the i-th group of order-preserving relations is set for the first message, where the first code is used to indicate the i-th group of order-preserving relations to which the first message belongs
  • the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is the second type of message in the i-th group of sequence-preserving relationship and switching to the first type of message
  • the multiple messages are sorted according to the sending order of each of the multiple messages; and the second coding unit is used in the order-preserving relationship if the first message is the i-th group
  • a second code based on the i-th group of order-preserving relationship is set for the first message, where the second code is used to indicate the first message to which the first message
  • each of the N groups of order-preserving relations is a direct order-preserving relationship; or a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relationship, The other part of the order-preserving relationship is the indirect order-preserving relationship.
  • the multiple messages include three types of messages, which are P messages, NP messages, and CPL messages, respectively, and the multiple messages include two sets of order-preserving relationships.
  • the two groups of order-preserving relations are all direct order-preserving relations; among them, the first type of message in the first group of direct order-preserving relations is a P message, and the second type of message in the first group of direct order-preserving relations is a CPL message.
  • the first type of message in the second group of direct preserving relations is a P message, and the second type of message in the second group of direct preserving relations is an NP message.
  • the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1 ⁇ k ⁇ M- 1 and k and M are integers;
  • the encoding module includes: a first encoding unit, configured to set a first encoding for the first message, and the first encoding is used to indicate to which the first message belongs Sequence-preserving interval, the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is the M-th type of message being switched to the first type of message to the M-1th type of message
  • the node of any type of message, the plurality of messages are sorted according to the sending order of each message in the plurality of messages; the second coding unit is used to if the first message is the For the k-th message
  • the number of type 1 messages is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs; the fourth coding unit is used for If the message is the M-th message, a second code is set for the first message.
  • the second code includes a first number and a second number, and the first number is used to indicate the first message.
  • the number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the message belongs, and the second number is used to indicate the number of Type 1 messages to which the first message belongs.
  • the sequence number of the message in the sequence interval is used to indicate the sequence number of the first message in the sequence interval.
  • the multiple messages include type M messages, and at least one type of messages in the M type messages includes multiple types of messages, and among them, the k+1 type messages
  • a type of message directly depends on the order-preserving relationship between the k-th type of message and the order-preserving message, and a type of message in the k+1-th type of message indirectly depends on the type 1 message to the k-th type of message.
  • Type 1 messages the order is preserved for the messages with the order-preserving relationship, 1 ⁇ k ⁇ M-1 and both k and M are integers;
  • the encoding module includes: a first encoding unit, configured to set a first encoding for the first message, where the first encoding is used to indicate the sequence-preserving interval to which the first message belongs, and the sequence-preserving interval
  • the multiple messages are divided by a dividing node, and the dividing node is a message specified in the M-th type of message or any kind of messages is switched to a type 1 message to a type M-1 message
  • a type of message or a node of any type of message specified in the text the plurality of messages are sorted according to the sending order of each of the plurality of messages;
  • the third coding unit is used if the first message is the t-th message in the k-
  • the multiple messages include two types of messages, where the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages.
  • the message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
  • a message sequence preserving device including: a second receiving module, configured to receive a first message sent by the first module and its code, wherein the first message is one of a plurality of messages Any message; a determining module, configured to determine whether to execute the first message according to the encoding of the first message; wherein the encoding of the first message is used to indicate the relationship between the first message and the Describes the execution relationship of other messages in multiple messages.
  • the multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations.
  • the second type of message and the second type of message, and the second type of message depends on the first type of message for order preservation; for the i-th group of order-preserving relations, the first group of the i-th group of order-preserving relations
  • the first code of one type of message and the second type of message based on the i-th group of preserving relationship is used to indicate to which the first type of message and the second type of message belong based on the i-th group of preserving
  • the order-preserving interval of the order relationship; for the i-th group of order-preserving relations, the second message in the i-th group of order-preserving relations is based on the second code of the i-th group of order-preserving relations to indicate the second The number of the first type of message in the i-th group of order-preserving relations in the order-
  • the determining module includes: a first execution unit, configured to: If the first message is the first message in the x-th group of direct order-preserving relations, the first message is executed; the second execution unit is configured to directly preserve the order if the first message is the x-th group For the second type of message in the relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the x-th group of direct order-preserving relationship, the first target message is executed.
  • the determining module includes: An execution unit, configured to: if the first message is only the first type of message in the x-th group of direct preserving relations, or if the first message is the first message in the x-th group of direct preserving relations If the first message is the first message in the q-th group of indirect order-preserving relationship, the first message is executed; the second execution unit is configured to: if the first message is only Is the second type of message in the x-th group of direct preserving relations, or if the first message is the second type of message in the x-th group of direct preserving relations and the first message is the jth group For the first type of message in the direct preserving relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the
  • the first target message includes the first type of the x-th group of direct order-preserving relations located in the x-th group of direct-order preserving interval to which the first message belongs.
  • the second target message The message includes the first message in the q-th group of indirect order-preserving relations in the q-th group of indirect order-preserving interval to which the first message belongs, and the first message in the q-th group of indirect order-preserving relations to which the first message belongs.
  • the number of type 1 messages to type k-1 messages before the message where the second number is used to indicate the sequence number of the type k message in the message in the sequence preservation interval to which it belongs;
  • the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval.
  • the number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
  • the first message wherein the second target message includes the type 1 message to the M-1 type message that are located before the first message in the sequence preservation interval to which the first message belongs, and Type 1 messages to Type M-1 messages in the order preserving interval before the order preserving interval to which the first message belongs.
  • a computer-readable storage medium including a computer program, which when executed on a computer, causes the computer to execute the method described in any one of the first aspect or the second aspect Any of the methods described.
  • a computer program is provided, when the computer program is executed by a computer, it is used to execute the method described in any one of the first aspect or the method described in any one of the second aspect.
  • a chip including a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute any one of the first aspect The method described in item 1 or the method described in any one of the second aspect.
  • FIG. 1 is a schematic flowchart of a method for preserving message sequence provided by an embodiment of this application;
  • Figure 2 shows the first schematic diagram of encoding multiple messages
  • Figure 3 shows the second schematic diagram of encoding multiple messages
  • Figure 4 shows the third schematic diagram of encoding multiple messages
  • Figure 5 shows a fourth schematic diagram of encoding multiple messages
  • Figure 6 shows a fifth schematic diagram of encoding multiple messages
  • Figure 7 shows a sixth schematic diagram of encoding multiple messages
  • Figure 8 shows a seventh schematic diagram of encoding multiple messages
  • Figure 9 shows a schematic structural diagram of a data transmission system based on an SOC chip
  • Figure 10 shows the eighth schematic diagram of encoding multiple messages
  • Figure 11 shows a schematic diagram 9 of encoding multiple messages
  • FIG. 12 is a first structural diagram of a message sequence device provided by an embodiment of this application.
  • FIG. 13 is a second structural diagram of a message sequence preserving apparatus provided by an embodiment of the application.
  • At least one (item) refers to one or more, and “multiple” refers to two or more.
  • “And/or” is used to describe the association relationship of associated objects, indicating that there can be three types of relationships, for example, “A and/or B” can mean: only A, only B, and both A and B , Where A and B can be singular or plural.
  • the character “/” generally indicates that the associated objects before and after are in an “or” relationship.
  • the following at least one item (a) or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a).
  • At least one of a, b, or c can mean: a, b, c, "a and b", “a and c", “b and c", or "a and b and c" ", where a, b, and c can be single or multiple.
  • Fig. 1 is a schematic flow chart of a method for preserving message sequence provided by an embodiment of the application. As shown in Fig. 1, the method for preserving message sequence may include the following steps:
  • Step 101 The first module receives a first message, where the first message is any one of a plurality of messages.
  • the message sending module needs to sort each message according to the sending order of each of the multiple messages , And send each of the multiple messages to the first module in sequence.
  • the process of the message sending module sending each of the multiple messages includes: the message sending module determines the first message as the first message according to the sequence of the multiple messages. , And send the first message (that is, the first message) to the first module. After the message sending module finishes sending the first message (that is, the first message), it will be ranked The second message is determined to be the first message, and the first message (that is, the message ranked second) is sent to the first module, and the message sending module repeats the above process, combining multiple messages Each message of is sent to the first module in the order of sending. The first module sequentially receives the first message according to the sending order of the message sending module.
  • the types of the messages (including the first message) in the multiple messages can be determined according to the data transmission protocol, and the order-preserving relationship between different types of messages can also be determined according to the data transmission protocol. Specifically, according to the data transmission protocol, it can be determined that the multiple types of messages specifically include several groups of order-preserving relations, and the specific types of messages of the first type of message and the second type of message in each group of order-preserving relations.
  • each group of order-preserving relations includes the first type of message and the second type of message. Guarantee order.
  • the second kind of message depends on the first kind of message for order preservation, which can be understood as: the execution of the second kind of message depends on the execution of the first kind of message, and the execution of the first kind of message does not depend on the second kind of message.
  • the execution of the text in other words, the second type of message can be executed only after the execution of the first type of message before the second type of message is completed, and the execution of the first type of message is not affected by the second type of message Restrictions on implementation.
  • Order-preserving relationships can include direct-order-preserving relationships and indirect-order-preserving relationships. Specifically, the understanding of the direct order-preserving relationship and the indirect order-preserving relationship is as follows:
  • the process of determining the priority of multiple types of messages includes:
  • the message is the message with the highest priority.
  • the message with the highest priority is selected from the various messages, and the message with the highest priority is classified as the first type of message, and then it will only rely on
  • the order of the messages in the first class of messages is determined to be the messages whose priority is only lower than that of the first class of messages, and the messages whose priority is only lower than the first class of messages are classified as the second Class 2 messages, the priority of the second class messages is only lower than that of the first class messages; then, it will only rely on the messages in the first class messages and the messages in the second class messages for order preservation
  • the message is determined as a message with a priority lower than only the first type of message and the second type of message, and the message with a priority only lower than the first type of message and the second type of message is classified as the third Class messages, and so on, determine the priority of other kinds of messages and the class they belong
  • the order-preserving relationship is a direct order-preserving relationship
  • the priorities of the two messages in the order-preserving relationship are not adjacent, then the order-preserving relationship is not adjacent.
  • the order relationship is an indirect order-preserving relationship, that is, the order-preserving relationship composed of messages in the k+1 type message and the messages with which the order-preserving relationship exists in the k-th message is a direct order-preserving relationship.
  • the order-preserving relationship between the messages in the class 1 message and the messages with the order-preserving relationship between the class 1 message and the class k-1 message is an indirect order-preserving relationship, and in the class k+1 message
  • a type of message directly relies on the messages in the k-th type of message that has an order-preserving relationship with it for order preservation, and a type of message in the k+1 type of messages indirectly depends on the type 1 message to the k-th message Among the -1 messages, the messages with the order-preserving relationship are preserved, and 1 ⁇ k ⁇ M-1.
  • the six types of messages include a total of 6 groups of order-preserving relationships, which are: : Message A and Message B are a set of order-preserving relations, among which message B depends on message A for order-preserving; message F and message C are a set of order-preserving relations, among which message C depends on the message F is a sequence-preserving relationship; message B and message D are a set of sequence-preserving relationships, among which message D depends on message B for sequence-preserving; message C and message E are a set of sequence-preserving relationships, among which, Message E depends on message C for sequence preservation; message A and message D are a set of sequence preservation relationships, among which message D depends on message A for sequence preservation; message F and message E are a group of sequence preservation relationships.
  • the first type of messages includes message A and message F
  • the second type of messages includes message B and message C
  • the third type of messages includes message D and message E.
  • the first type of message has the highest priority
  • the second type of message has the second priority
  • the third type of message has the lowest priority
  • the message A and the message B are a set of direct order-preserving relationships.
  • Message F and Message C are a set of direct order-preserving relationships
  • Message B and Message D are a set of direct-preserving relationships
  • Message C and Message E are a set of direct-preserving relationships
  • Message A and Text D is a group of indirect order-preserving relations
  • messages F and E are a group of indirect order-preserving relations.
  • message B and message F, message A and message C are all messages with adjacent priorities. However, because the above two combinations do not have a preserving relationship, they cannot form a direct preserving relationship. Although message A and message E, message F and message D are all messages with non-adjacent priorities, since the above two combinations do not have an order-preserving relationship, they cannot form an indirect order-preserving relationship.
  • the types of messages include P messages, CPL messages, and NP messages; among them, P messages and CPL messages are a set of order-preserving relationships, and CPL messages depend on The order of P messages is preserved, that is, the execution of P messages is not restricted by the execution of CPL messages, and the execution of CPL messages is restricted by the execution of P messages. In other words, the P messages that precede the CPL message are all executed. After completion, the CPL message can be executed, and the P message is executed unconditionally; the P message and the NP message are a set of sequence preservation relationship, and the NP message depends on the P message for sequence preservation, that is, the execution of the P message It is not restricted by the execution of NP messages.
  • NP messages The execution of NP messages is restricted by the execution of P messages. In other words, NP messages can be executed only after the execution of P messages before NP messages. Unconditional execution.
  • the first type of messages includes P messages
  • the second type of messages includes CPL messages and NP messages
  • the first type of messages The priority is higher than the priority of the second type of message
  • the P message and the CPL message are a set of direct order-preserving relations
  • the P message and the NP message are a set of direct order-preserving relations.
  • the first module may be a module in the data transmission system.
  • the first module in the direction of inputting messages to the data transmission system, the first module may be the initial module of data input in the data transmission system; In the direction, the first module can be the initial module of data output in the data transmission system, and there is no special limitation here.
  • Step 102 The first module encodes the first message according to the transmission sequence of the first message in the multiple messages and the order-preserving relationship between the first message and other messages in the multiple messages to obtain the first message.
  • the encoding of the message where the encoding of the first message is used to indicate the execution relationship between the first message and other messages among the multiple messages.
  • the execution relationship between the first message and other messages in the multiple messages can be understood as a message that is ranked before the first message among the multiple messages and restricts the execution of the first message Information.
  • Method 1 Multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, each group of order-preserving relations in the N groups of order-preserving relations includes the first type of message and the second type of message. And under the condition that the second type of message in each group of order-preserving relationship depends on the corresponding first type of message for order-preserving, the steps of encoding the first message include:
  • first message is the first message or the second message in the i-th group of order-preserving relations
  • set the first code based on the i-th group of order-preserving relations for the first message, where the first message
  • the first code of the message is used to indicate the order-preserving interval based on the i-th group of order-preserving relationship to which the first message belongs.
  • the second type of message in the relationship is switched to the node of the first type of message, and the above multiple messages are sorted according to the sending order of each of the multiple messages; if the first message is the i-th group, the order is preserved For the second type of message in the relationship, a second code based on the i-th group of order-preserving relationship is set for the first message, where the second code of the first message is used to indicate the i-th based
  • the number of messages of the first type in the order-preserving interval of the group order-preserving relationship that is, the first type of message in the i-th group order-preserving relationship
  • 1 ⁇ i ⁇ N and i is an integer
  • the value of i The number is at least one.
  • each of the multiple messages can be understood as follows: First, determine that the multiple messages include a total of several types of messages, several groups of order-preserving relations, and each group of order-preserving relations The first type of message and the second type of message in each group of order-preserving relationship depend on the first type of message in the corresponding order-preserving relationship for order-preserving; then, based on each group The order-preserving relationship encodes the first message and the second message in the corresponding order-preserving relationship among multiple messages. Specifically, based on a set of order-preserving relationships, the group of multiple messages is protected.
  • the process of encoding the first type of message and the second type of message in the order relationship includes: switching the second type of message in the group of order-preserving relations to the node of the first type of message as the division node, and Multiple messages are divided to obtain at least one sequence-preserving interval based on the group sequence-preserving relationship, where the multiple messages are sorted according to the sending order of each of the multiple messages; among the multiple messages
  • the first code is set for each of the first type of message (the first type of message in the group of order-preserving relations) and the second type of message (the second type of message in the group of order-preserving relations), where more
  • the first code of the first type of message and the second type of message in each message is used to indicate the order-preserving interval to which the first type of message and the second type of message belong (that is, the order-preserving relationship based on the group Sequence-preserving interval), that is, the first code of each first-type message and every second-type message in the same sequence-preserving interval in multiple messages is the same, and the first code is the
  • a second type of message (the second type of message in the order-preserving relationship of the group) is set with a second code, and the second code of the second type of message among multiple messages is used to indicate to which the second type of message belongs
  • the number of messages of the first type (the first type of message in the group of order-preserving relations) in the order-preserving interval (that is, the order-preserving interval based on the group of order-preserving relations), in other words, the number of messages of the second type among the plurality of messages
  • the second code of this type of message is used to indicate the number of the first type of message (that is, the first type of message in the group of order-preserving relations) whose first code is the same as the first code of the second type of message.
  • the encoding based on the first type of message in the group of order-preserving relations includes only the first code
  • the encoding of the second type of message based on the group of order-preserving relations includes the first code and the second code.
  • the codes set for the first type of message and the second type of the order-preserving relationship in the group of multiple messages correspond to the order-preserving relationship of the group; for other Repeat the above process for the first message and the second message in each group of order-preserving relations, and then based on the other groups of order-preserving relations, you can get the first message and the first type of message in the corresponding order-preserving relations among multiple messages.
  • the second type of message encoding is based on the order-preserving relationship of the group.
  • each of the above N groups of preserving relations is a direct preserving relationship, or some of the above N groups of preserving relations are direct preserving relations, and the other part of the above preserving relations is Indirect order-preserving relationship.
  • the above coding process for each set of order-preserving relations is applicable to direct order-preserving relations and indirect order-preserving relations.
  • FIG. 2 shows a schematic diagram 1 of encoding multiple messages
  • FIG. 3 shows a schematic diagram 2 of encoding multiple messages
  • FIG. 4 shows a schematic diagram 3 of encoding multiple messages.
  • the multiple messages include a total of five types of messages, namely, message A, message B, message C, message D, and message E.
  • the multiple messages include a total of Four groups of direct order-preserving relations and two groups of indirect order-preserving relations. Among them, the first group of direct order-preserving relations includes message A and message B.
  • message B directly depends on message A for order-preserving, that is, message A is The first type of message in the first group of direct order-preserving relations, and message B is the second type of message in the first group of direct order-preserving relations; the second group of direct order-preserving relations includes message A and message C, Among them, message C directly depends on message A for order preservation, that is, message A is the first message in the second group of direct order preservation relations, and message C is the second message in the second group of direct order preservation relations.
  • the third group of direct preserving relations includes message B and message D, among which, message D directly depends on message B for preserving, that is, message B is the third group of direct preserving relations
  • message D is the second message in the third group of direct order-preserving relations
  • the fourth group of direct-order preserving relations includes message C and message E, among which, message E directly depends on the message C performs order preservation, that is, message C is the first type of message in the fourth group of direct order preservation relations, and message E is the second type of message in the fourth group of direct order preservation relations
  • the first group of indirect order preservation relations The relationship includes message A and message D.
  • Message D indirectly depends on message A for order preservation, that is, message D is the second type of message in the first group of indirect order preservation relations, and message A is the first group of messages.
  • the types of messages included in multiple messages, the number of groups of order-preserving relations, and the first and second types of messages in each group of order-preserving relations can be determined and combined by the message sending module.
  • Sending to the first module can also be determined by the first module according to the data transmission protocol, and there is no special limitation here.
  • each message A and each message B in the multiple messages are coded based on the first set of direct order-preserving relations.
  • the message B is switched to the message among multiple messages.
  • the node of message A is used as a dividing node to divide multiple messages, that is, in the sequence of multiple messages, as long as message A appears after message B, the order-preserving interval is divided.
  • three preserving intervals are obtained, which are the first preserving interval to the third preserving interval based on the first direct preserving relationship.
  • the three order-preserving intervals based on the first group of direct order-preserving relationships set the first code for message A and message B in multiple messages, because the first code is used to indicate that message A and message B belong Therefore, a corresponding code can be set for each order-preserving interval based on the first set of direct order-preserving relations, where the code of the first order-preserving interval is 0, and the code of the second order-preserving interval is 1.
  • the code of the third order-preserving interval is 2, and the code of each order-preserving interval is set to the first code of message A and message B in the corresponding order-preserving interval, that is, message A in the same order-preserving interval Same as the first code of message B.
  • the three preserving intervals based on the first set of direct preserving relationships set the second code for the message B in multiple messages. Because the second code of the message B is used to indicate the preserving interval to which message B belongs The number of messages A, therefore, the second code of each message B can be set according to the number of messages A in the sequence preservation interval to which message B belongs. Since the message A is the first type of message in the first group of direct preserving relations, the code of the message A based on the first group of direct preserving relations only includes the first code. Since the message B is the second type of message in the first group of direct order-preserving relations, the codes of the message B based on the first group of direct preserving relations include the first code and the second code.
  • the codes set for each message A and message B in the multiple messages are as shown in the codes above message A and message B in Figure 2, where , The codes of message A and message B are both shown in brackets. Because of the direct order-preserving relationship based on the first group, message A only includes the first code. Therefore, the number in brackets above message A is the message The first code of A, because based on the first group of direct preserving relationship, message B includes the first code and the second code, so the first code and second code of message B are separated by a comma, and the one before the comma is The first code of message B, and the second code of message B after the comma.
  • the number after each message in the multiple messages indicates the sending order (ie, the arrangement order) of the corresponding message in the multiple messages.
  • FIG. 5 shows schematic diagram four of encoding multiple messages
  • FIG. 6 shows schematic diagram five of encoding multiple messages
  • multiple messages include Five types of messages, the five types of messages are message A, message B, message C, message D, and message E, and the five types of messages include three groups of direct order-preserving relationships.
  • the order-preserving relations are as follows: Message A and message B form the first group of direct order-preserving relations, among which, message B directly depends on message A for order-preserving, and message A and message C form the second group of direct order-preserving relations.
  • message C directly depends on message A for sequence preservation
  • message D and message E form a third group of direct sequence preservation relations, among which message E directly depends on message D for sequence preservation.
  • the encoding set for each of the multiple messages is message A and message B, as shown in the code located above message A and message B in Figure 5. Shown.
  • the codes set for each message D and message E in the plurality of messages based on the third set of direct order-preserving relations are as shown in the codes located above the message D and the message E in FIG. 6.
  • the process of encoding the first message by the first module may include the following two types:
  • the first module can sort the first messages according to the order in which each first message is received after receiving each first message (that is, each message among multiple messages) ( That is, multiple messages are sorted); in combination with the above method, each first message after sorting is coded based on each group of order-preserving relations. It should be noted that, since the first message is received in the order in which the first message was sent, sorting the first message according to the order in which the first message was received still maintains the original order of the first message .
  • the first module can encode the received first message every time a first message is received. Specifically, after receiving the first message, the first module first determines which group of order-preserving relationships the first message belongs to, and determines which message in each group of order-preserving relationships to which the first message belongs ( That is, the first message or the second message), then, based on each group of order-preserving relations to which the first message belongs, and the first message or the first message in each group of order-preserving relations to which the first message belongs. For the second message, the first message is respectively set with codes based on each group of order-preserving relations to which it belongs.
  • the first message as the first type of message in the first group of order-preserving relations as an example to describe the encoding process of the first message, where the first group of order-preserving relations is the first message Any group of order-preserving relations in at least one group of order-preserving relations to which it belongs.
  • the order-preserving interval to which the first message belongs is determined as the first order-preserving interval Interval, and set the first code of the first message to 0.
  • the first module receives the first type of message and/or the second type of message in the first group of order-preserving relationship before the first message, then if the first group of messages received most recently before the first message
  • the message in the order-preserving relationship is the first type of message in the first group of order-preserving relations, and the first code of the first message in the first group of order-preserving relations received most recently is determined as the first
  • the first code of the message that is, the first message in the first group of order-preserving relations received last time and the first message belong to the same order-preserving interval; if the last received before the first message
  • the message in the first group of order-preserving relations is the second type of message in the first group of order-preserving relations, then the first code of the second type of message in the first group of order-preserving relations received most recently One is added on the basis (that is, when the second type of message in the first group of order-preserving relations is switched to the first type of message, the order-preserving interval is reversed, and when the order-preserving interval is reversed, the first code
  • first message as the second type of message in the first group of order-preserving relations as an example to illustrate the encoding process of the first message, where the first group of order-preserving relations are at least Any group of order-preserving relations in a group of order-preserving relations.
  • the preserving interval to which the first message belongs is determined as the first preserving Interval, and set the first code of the first message to 0, and set the second code of the first message to 0.
  • the first module receives the first type of message and/or the second type of message in the first group of order-preserving relationship before the first message, then if the first group of messages received most recently before the first message
  • the message in the order-preserving relationship is the second type of message in the first group of order-preserving relations, and the first code of the second type of message in the first group of order-preserving relations received most recently is determined as the first
  • the first code of the message, the second code of the second type of message in the first group of order-preserving relations received last time is determined as the second code of the first message, that is, the first group received last time
  • the second type of message in the order-preserving relationship belongs to the same order-preserving interval as the first message; if the message in the first group of order-preserving relations received last time before the first message is the first group of order-preserving messages
  • the first code of the first type of message in the first group of order-preserving relations received most recently is determined as the first code of the first message, and it will be compared with the first code based on
  • the number of messages of the first group in the first group of sequence-preserving relations in which the first code of the sequence-preserving relationship is equal to the first code of the first message is set as the second code of the first message. It should be noted that the first code, the second code, and the order-preserving interval in the above process all correspond to the first group of order-preserving relations.
  • the principle of setting codes based on the other groups of order-preserving relations for the first message is the same as the above-mentioned principle of setting the first message based on the first group of order-preserving relations.
  • the principle of the text setting code is the same, so I will not repeat it here.
  • each message in the M message includes one kind of message, among which, the k+1th message directly depends on the kth message for protection.
  • the k+1 type message indirectly depends on each type of message from the type 1 message to the type k-1 message for order preservation, 1 ⁇ k ⁇ M-1 and k and M are integers
  • the steps of encoding the first message include:
  • the first code of the first message is used to indicate the order-preserving interval to which the first message belongs.
  • the order-preserving interval is obtained by dividing multiple messages by a dividing node, and the dividing node is the Mth.
  • the sequence number in the message if the first message is a k-th message and 2 ⁇ k ⁇ M-1, then the second code is set for the first message, and the second code of the first message includes the first Number and second number, the first number is used to indicate the number of type 1 messages to type k-1 messages before the first message in the order-preserving interval to which the first message belongs
  • the k+1 type messages directly depend on the k type messages for order preservation, the k+1 type messages indirectly depend on the type 1 messages to the k-1 type messages.
  • Each type of message is sequenced. Therefore, the smaller the value of k, the higher the priority of the k-th message, and the larger the value of k, the lower the priority of the k-th message. Based on this, it can be obtained that the priority of the first type of message is the highest, the priority of the M-th type of message is the lowest, and the k+1 type of messages and each of the type 1 to k-th messages All messages have an order-preserving relationship.
  • the order-preserving relationship between the k+1 type message and the k-th type message is a direct order-preserving relationship
  • the k+1 type message and the type 1 message to the k-1 The order-preserving relationship of any type of messages in the class of messages is an indirect order-preserving relationship. Since the division of multiple messages into M types of messages, the priority of each type of messages, and the order-preserving relationship between each type of messages have been described above, the details are not repeated here.
  • the overall idea of encoding each message in multiple messages can be understood as: first determine the multiple messages including a total of several messages and the order-preserving relationship between each message, according to The order-preserving relationship between each message determines the priority of each message, and then determines the class of each message according to the priority of each message; then, the message with the lowest priority is switched to priority
  • the node of the message with the level higher than the lowest priority is used as the dividing node (that is, the node of any type of message from the M-th type of message being switched to the type 1 message to the M-1 type of message is used as the dividing node)
  • Divide multiple messages to obtain at least one sequence-preserving interval, where multiple messages are sorted according to the sending order of each of the multiple messages; finally, based on each sequence-preserving interval and each message
  • the category to which it belongs that is, the priority of each message), encodes each message in each order-preserving interval.
  • the process of encoding each message in each order-preserving interval is as follows:
  • the first code of each message is used to indicate the sequence-preserving interval to which each message belongs, that is, the first code of each message in the same sequence-preserving interval among multiple messages is the same.
  • the second code is set for each message according to the priority of each message and the order-preserving interval to which each message belongs. Specifically, if the message is the message with the highest priority, that is, the message is a type 1 message, the second sequence number of the message is set according to the sequence number of the message in the sequence preservation interval to which the message belongs.
  • the second code of the message is used to indicate the sequence number of the message in the message in the order-preserving interval to which it belongs; if the message is the message with the lowest priority, that is, the message is the M-th message , The second code of the message includes the first number and the second number.
  • the number of messages (ie Set the first number of the message according to the number of type 1 messages to type M-1 messages before the message in the order-preserving interval to which the message belongs, and set the first number of the message according to the order-preserving interval to which the message belongs Set the second number in the sequence number of the message in the message; if the message is a message of any priority between the highest priority and the lowest priority, that is, the message is a k-th message and 2 ⁇ k ⁇ M -1, the second code of the message includes the first number and the second number, among which, according to the number of messages that precede the message and have a higher priority than the priority of the message in the order-preserving interval to which the message belongs (I.e. the number of type 1 messages to k-1 types of messages) Set the first number of the message, and set the number of the message according to the sequence number of the message in the message in the sequence to which it belongs The second number.
  • FIG. 7 shows a sixth schematic diagram of encoding multiple messages.
  • the multiple messages include a total of 5 types of messages, namely: message a, message b, message c, message d, and message e.
  • sequence preservation relationship is as follows: message b directly depends on message a for sequence preservation, message c directly depends on message b for sequence preservation, message d directly depends on message c for sequence preservation, and message e directly depends on Message d is for order preservation, message c indirectly depends on message a for order preservation, message d indirectly depends on message a for order preservation, message d indirectly depends on message b for order preservation, and message e indirectly Rely on message a for order preservation, message e indirectly depends on message b for order preservation, and message e indirectly depends on message c for order preservation.
  • the priority order of the five types of messages from high to low is: message a>message b>message c>message d>message e, that is, the first type of messages includes message a, The second type of message includes message b, the third type of message includes message c, the fourth type of message includes message d, and the fifth type of message includes message e.
  • the types of messages included in multiple messages and the order-preserving relationship between different types of messages can be determined by the message sending module and sent to the first module, and the first module can also be based on the data The transmission protocol is determined, and there is no special restriction here.
  • the process of encoding each message in the multiple messages includes: firstly dividing the multiple messages according to the dividing node to obtain at least one sequence-preserving interval, and dividing the node into a message e, switching to a message a, a message b.
  • the node of any one of message c and message d, that is, in the sequence of multiple messages, the messages after message e are message a, message b, message c, and message
  • a division of the order-preserving interval is performed.
  • multiple messages are divided into five order-preserving intervals, namely the first order-preserving interval to the fifth order-preserving interval. Based on the five preserving intervals, the first code is set for each of the multiple messages.
  • the first code of the message is used to indicate the preserving interval to which the message belongs, it can be five preserving intervals Set the code for each preserving interval in, where the code of the first preserving interval is 0, the code of the second preserving interval is 1, the code of the third preserving interval is 2, and the code of the fourth preserving interval is 3
  • the code of the fifth order-preserving interval is 4, and the code of each order-preserving interval is set as the first code of each message in the corresponding order-preserving interval.
  • the second code of each of the multiple messages is set based on the above five sequence preserving intervals and the priority of each message.
  • the second code is set according to the sequence number of the message in the message in the sequence preservation interval to which the message belongs. If the message is message b or message c or message d, the second code of the message includes the first number and the second number. The number of messages with higher priority of the message sets the first number of the message, and the second number is set according to the sequence number of the message in the message in the sequence to which it belongs. If the message is message e, that is, the message is the message with the lowest priority, the second code of the message includes the first number and the second number.
  • the sum of the number of message a, message b, message c, and message d sets the first number of the message, and sets the message according to the sequence number of the message in the message in the sequence to which it belongs The second number.
  • the code of each message obtained after encoding each of the multiple messages is shown in the code above each message in Figure 7, where the code of each message is shown in brackets
  • For message a separate the first code and the second code of message a with a comma, and the first code is located before the second code; for message b, message c, message d, and message e, Separate the first number and the second number in the first code and the second code with a comma, where the first code is at the front, the first number is at the middle, and the second number is at the end.
  • the process of encoding the first message by the first module may include the following two types:
  • the first module can sort the first messages according to the order in which each first message is received after receiving each first message (that is, each message among multiple messages) ( That is, multiple messages are sorted); each first message is coded in combination with the above method. It should be noted that, since the first message is received in the order in which the first message was sent, sorting the first message according to the order in which the first message was received still maintains the original order of the first message .
  • the first module can encode the received first message every time a first message is received. Specifically, after receiving the first message, the first module first determines the type of the first message, and determines the first message according to the type of the first message and the order-preserving relationship between the first message and other types of messages. The priority of the message (that is, the class to which the first message belongs), and then the first message is encoded according to the priority of the first message. In the following, the specific process of message encoding will be described.
  • the sequence-preserving interval to which the first message belongs is determined as the first sequence-preserving interval, the first code of the first message is set to 0, and the second code is set for the first message. Specifically, if the first message is a type 1 message (that is, the message with the highest priority), the second code is set according to the sequence number of the first message in the message in the sequence preservation interval to which it belongs, Since the first message here is the first message among multiple messages, the first message is the first message among the messages in the preserving interval to which it belongs.
  • the second code of a message is set to 1; if the first message is a message other than the first type of message (that is, other messages with a priority lower than the highest priority), then the first message
  • the second code includes a first number and a second number, and the first number is set according to the number of messages before and higher than the priority of the first message in the order-preserving interval to which the first message belongs.
  • the sequence number of the message in the message in the sequence to which it belongs sets the second number of the first message. Since the first message here is the first message among multiple messages, the first message The number is 0, and the second number is 1.
  • the first code of the last received message before the first message is set as the first code of the first message, That is, the first message and the last received message before the first message are in the same order-preserving interval, and according to the order-preserving interval to which the first message belongs, it is before the first message and has a higher priority than the first message Set the first number of the first message to the number of messages with high priority (because the first code of the messages belonging to a preserving interval is the same, so it can be based on the first code and the first code of the first message Set the first number to the number of messages that are the same and that are located before the first message and have a priority higher than the priority of the first message), according to the sequence number of the first message in the message in the sequence to which it belongs Set the second number of the first message.
  • the first message is a message with a priority higher than the lowest priority and lower than the highest priority (that is, any type of message from the second to the M-1 class of messages)
  • the last message received before the first message is the message with the lowest priority
  • one is added to the first code of the last message received that is, the message with the lowest priority is switched to
  • the order-preserving interval is reversed, and when the order-preserving interval is reversed, the first code is increased by one to be the first code of the message in the next order-preserving interval )
  • the obtained first code added by one is determined as the first code of the first message, that is, the most recently received message and the first message belong to a different order-preserving interval, and the first message belongs to
  • the number of messages in the sequence preserving interval before the first message and with a higher priority than the first message is set to the first number of the first message, because the sequence preserving interval is performed at the first message Therefore, the first message is the first message in the preserving interval, and the first number
  • the second number of the first message is 1; it was received last time before the first message
  • the first code of the last received message before the first message is set to the first code of the first message, that is, the first message
  • the last message received before the first message belongs to the same order-preserving interval, and according to the order-preserving interval to which the first message belongs, it is before the first message and has a higher priority than the first message
  • the number of messages sets the first number of the first message (because the first codes of the messages belonging to a preserving interval are the same, the first code can be the same as the first code of the first message and located in the first Set the first number for the number of messages before the message and the priority is higher than the priority of the first message), and set the first message according to the sequence number of the first message in the messages in the sequence to which it belongs The second number.
  • the most recently received message before the first message is the message with the lowest priority (i.e. type M message)
  • add one to the first code of the most recently received message that is, when the message with the lowest priority is switched to any message with the priority higher than the lowest priority, the order-preserving interval is reversed, And when the order-preserving interval is reversed, add one to the first code as the first code of the message in the next order-preserving interval), and determine the first code after the increment by one as the first code of the first message Code, that is, the most recently received message and the first message belong to a different sequence preserving interval, and the second code of the first message is set according to the sequence number of the first message in the preserving interval to which it belongs.
  • the message is the first message in the order-preserving interval, so the second code of the first message is 1; the last message received before the first message is the one with priority higher than the lowest priority.
  • Set the first code of the last message received before the first message to the first code of the first message, that is, the first message and the last message received before the first message They belong to the same sequence-preserving interval, and the second code of the first message is set according to the sequence number of the first message in the messages in the sequence-preserving interval to which it belongs.
  • the steps of encoding the first message include:
  • the first code of the first message is used to indicate the order-preserving interval to which the first message belongs.
  • the order-preserving interval is obtained by dividing multiple messages by the dividing node, and the dividing node is the A message or any message specified in the M-type message is switched to a node of a message or any kind of message designated in the M-1 message.
  • the second code wherein the second code of the first message is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs.
  • the first message is the t-th message in the k-th message and 2 ⁇ k ⁇ M-1, then according to the first message before the first message in the order-preserving interval to which the first message belongs Set the first number of the first message to the number of messages with the order-preserving relationship (direct order-preserving relationship and indirect order-preserving relationship) in the k-1th message, that is, according to the order-preserving interval to which the first message belongs.
  • the number of messages that are before the first message and whose priority is higher than the priority of the first message and have an order-preserving relationship (direct order-preserving relationship and indirect order-preserving relationship) with the first message Set the number of the first message
  • the first number that is, the first number of the first message is used to indicate that the first message belongs to the first message before the first message in the first message to the k-1 message and the sequence is preserved.
  • the number of messages in the relationship (direct preserving relationship and indirect preserving relationship), and the second number of the first message is set according to the sequence number of the first message in the message in the preserving interval to which it belongs, that is, the first message
  • the second number of a message is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs.
  • the first message is the q-th message in the M-th class of messages, according to the order-preserving interval to which the first message belongs, the first message to the M-1 class message before the first message Set the first number of the first message according to the number of messages that have a preserving relationship (direct preserving relationship and indirect preserving relationship).
  • the number of messages whose priority level is higher than the priority of the first message and which has a sequence-preserving relationship (direct sequence-preserving relationship and indirect sequence-preserving relationship) with the first message is set to the first number of the first message, and the first message
  • the first number is used to indicate the number of messages that have a sequence-preserving relationship with the first message before the first message in the sequence-preserving interval to which the first message belongs, and according to the first message
  • the sequence number of a message in the message in the sequence to which it belongs sets the second number of the first message, that is, the second number of the first message is used to indicate the sequence number of the first message in the sequence to which it belongs The sequence number of the packets in the interval.
  • Figure 8 shows the seventh schematic diagram of encoding multiple messages.
  • the multiple messages include six types of messages, namely: message A, message B, message C, message D, message E, and message.
  • Message F where message C directly depends on message A for order preservation, message D directly depends on message B for order preservation, message E directly depends on message C for order preservation, and message F directly depends on Message C is for order preservation, message E indirectly depends on message A for order preservation, and message F indirectly depends on message A for order preservation.
  • the above-mentioned six types of messages can be divided into three types of messages, and the three types of messages are in descending order of priority: the first type of message, the second type of message, and the third type of message.
  • the first type of message includes message A and message B
  • the second type of message includes message C and message D
  • the third type of message includes message E and message F.
  • the node in which message E or F is switched to any one of message A, message B, message C, and message D is used as a dividing node to divide multiple messages to obtain Six sequence-preserving intervals, each of the multiple messages is encoded according to the six sequence-preserving intervals and the above principles, and the obtained code of each message is located above each message in Figure 8, where, The code of each message is in brackets.
  • message A and message B separate the first code and second code of message A and message B with a comma, and the first code is located before the second code.
  • message C For message C, message D, message E, and message F, separate the first number and the second number in the first code and the second code with a comma, where the first code is at the top, and the first number Located in the middle, the second number is at the end.
  • Step 103 The first module sends the first message and its code to the second module.
  • the first module after the first module encodes the first message, it sends the first message and its encoding to the second module.
  • the code of the first message may be carried in the first message and sent together, or the codes of the first message and the first message may be sent separately, which is not particularly limited in this application.
  • the first module may use an out-of-sequence bus transmission mode or a multi-channel transmission mode to send the first message and its code to the second module to improve transmission efficiency.
  • a transmission channel of each type of message can also be set to transmit a corresponding type of message through the transmission channel of each type of message.
  • the code is set for the first message, so that the first message
  • the code indicates the execution relationship between the first message and other messages in the multiple messages (that is, the message that is arranged before the first message and restricts the execution of the first message). Therefore, in the first module and the second When the first message is transmitted between the modules, the encoding of the first message is transmitted, so that the second module determines the message that is ranked before the first message and restricts the execution of the first message according to the encoding of the first message.
  • Order-preserving transmission of the first message since the encoding of the first message indicates the execution relationship between the first message and other messages in the multiple messages (that is, it is arranged before the first message and restricts the first message). Therefore, compared with the prior art, when the first message is transmitted between the first module and the second module, there is no need for the second module to send a confirmation message to the first module, and the first module is also not required To confirm whether the confirmation message is received, no link or flow control is required. Only by sending the first message and its code, the order-preserving transmission of the first message can be realized, which greatly reduces the transmission delay of the message.
  • Step 104 The second module receives the first message and its code sent by the first module, where the first message is any one of the multiple messages, and the code of the first message is used to indicate the first message.
  • the execution relationship between a message and other messages among multiple messages It should be noted that the execution relationship has been described above, so it will not be repeated here.
  • Step 105 The second module determines whether to execute the first message according to the encoding of the first message.
  • the encoding of the first message is analyzed to determine the execution relationship between the first message and other messages in the plurality of messages, and according to the first message and other messages in the plurality of messages The execution relationship of the message determines whether to execute the first message.
  • Method 1 Multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, where each group of order-preserving relations in the N groups of order-preserving relations includes the first type of message and the second type of message , And the second type of message depends on the first type of message for order preservation, and for the i-th group of order-preserving relations, the first and second types of messages in the i-th group of order-preserving relations are based on the i-th group
  • the first code of the order-preserving relationship is used to indicate the order-preserving interval to which the first type of message and the second-type message belong; for the i-th group of order-preserving relations, the second type of message in the i-th group of order-preserving relations is based on The second code of the i-th group of order-preserving relations is used to indicate the number of the first type of messages in the i-th group of order-preserving relations within the order-preserving interval based on the i-th group of order-preserving relations to which the second message belongs, and Under the condition that each
  • the first message A message is the kind of message in the direct order-preserving relationship to which it belongs. It should be noted that if the first message is the first message in the direct preserving relationship to which it belongs, the number of groups of the direct preserving relationship to which the first message belongs is at least one group, if the first message For the second type of message in the direct preserving relationship to which it belongs, the number of groups of the direct preserving relationship to which the first message belongs is one group.
  • the first message is executed. Since the first message is the first message in the x-th group of direct preserving relations, and since each group of preserving relations in the N groups of preserving relations is a direct preserving relation, each group of direct preserving relations is The execution of the first message is not restricted by the execution of other messages. Therefore, when the first message is the first message in the x-th group of direct order-preserving relations, the first message can be directly executed. No need to wait for the execution of other messages. It should be noted that the value range of x is: 1 ⁇ x ⁇ N, and x is an integer, and the number of x values is at least one.
  • the first message belongs to the first type of message in a group of direct preserving relations, and the direct preserving to which the first message belongs The order relationship is the second group of direct order-preserving relationships. If the number of values of x is 3, and the values of x are 1, 3, and 4, then the first message belongs to the first message in the three groups of direct order-preserving relations, and the first message belongs to Direct order-preserving relations are the first group of direct order-preserving relations, the third group of direct order-preserving relations, and the fourth group of direct order-preserving relations.
  • the first target message includes the first type of message in the x-th group of direct order-preserving relations located in the order-preserving interval to which the first message belongs, and the order-preserving interval before the order-preserving interval to which the first message belongs.
  • the x-th group within is the first message in the direct order-preserving relationship.
  • the number of values of x Is 1, and the order-preserving interval here is the order-preserving interval of the base x-th group.
  • the numbers of the preserving intervals based on the direct preserving relationship of the xth group are numbered in ascending order, that is, the code of the preserving interval in the front is smaller than the preserving interval in the back. If the first code in the x-th group of direct order-preserving relations is less than the first code of the first message, it is judged whether all the first messages in the x-th group of direct order-preserving relations have been executed.
  • the first message is message A8 in Figures 5 and 6, it can be seen from Figures 5 and 6 that the first message belongs to the first group of direct order-preserving relations and the second group of direct-order preserving relations, and the first message
  • the messages are the first messages in the first group of direct order-preserving relations and the second group of direct-order preserving relations. Therefore, after the first message is received, the first message is directly executed.
  • the first message is the message E11 in Figure 5 and Figure 6, and the code of the first message based on the third group of direct preserving relationship is (1,1)
  • the code based on the third group of direct preserving relationship is (1,1)
  • the execution of the first type of message in the third group of order-preserving relations with the first code less than 1 is completed, that is, it is judged whether all the messages D with the first code of 0 based on the third group of direct order-preserving relations have been executed, if yes , It is judged whether the execution number of the message D with the first code of 1 based on the third group of direct order-preserving relationship is equal to 1, and if so, the first message is executed.
  • the numbers in the preserving intervals based on each group of direct preserving relations are numbered in ascending order, that is, the first codes of the messages based on the corresponding direct preserving relations are all in descending order.
  • the first type of message in each group of direct order-preserving relations is executed in ascending order based on the first encoding of each group of direct order-preserving relations, it is determined whether to execute the first message.
  • the judgment process is as follows:
  • the first message is executed, if not, it is determined that the first code is adjacent to the first code of the first message and is smaller than the x-th group of direct preserving relationship of the first code of the first message (that is, the selected one Whether all the first messages in the group x group (direct order preserving relationship) have been executed, if yes, execute the first message, if not, wait until the above conditions are met before the first message can be executed. It should be noted that the first codes in the above judgment process all correspond to the selected x-th group of direct order-preserving relations.
  • the judgment process is as follows:
  • the order-preserving relationship to which the message belongs is a direct order-preserving relationship; or the order-preserving relationship to which the first message belongs is a direct order-preserving relationship and an indirect order-preserving relationship).
  • the first message is executed.
  • the first message is only the first message in the x-th group of direct order-preserving relations, or the first message is the first message in the x-th group of direct preserving relations and the first message is the qth message
  • the first message in the group indirect order-preserving relationship so it can be determined that the execution of the first message is not restricted by the execution of other messages, that is, the first message is the message with the highest priority, so that the first message is received
  • the first message can be executed directly after the message.
  • the number of values of x and q can both be at least one. That is, the number of the x-th group of direct order-preserving relations to which the first message belongs is at least one, and the number of the q-th group of indirect order-preserving relations to which the first message belongs is at least one.
  • the first message is only the second type of message in the x-th group of direct order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the first
  • execute The first message where the first target message includes the first type of message in the x-th group of direct order-preserving relations in the x-th group of direct-order preserving interval to which the first message belongs and the The first message in the x-th group of direct-order-preserving relations in the x-th group of direct-order preserving intervals before the order-preserving interval based on the x-th group of direct preserving relations to which the first message belongs. Since the principle of this process is the same as the principle in the above manner, it will not be repeated here. It should be noted that the number of
  • the first message is the second message in the x-th group of direct order-preserving relations and the first message is the first message in the j-th group of direct order-preserving relations, and the first message is the qth group of indirect
  • the second type of message in the order-preserving relationship or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the second type of the q-th group of indirect order-preserving relations Message, it is determined that the first target message has been executed according to the first code and the second code of the first message based on the direct sequence preservation relationship of the xth group, and according to the first message, the indirect sequence preservation is based on the qth group When the first code and the second code of the relationship determine that the execution of the second target message has been completed, the first message is executed.
  • the second target message includes the first message in the q-th group of indirect order-preserving relationships in the q-th group of indirect sequence-preserving interval to which the first message belongs, and the first message in the q-th group of indirect sequence-preserving relationships to which the first message belongs.
  • the first target message has been executed according to the first code and the second code of the first message based on the x-th group of direct order-preserving relationship, and according to the first message
  • the first message is executed.
  • the concept of the second target message corresponding to each q-th group of indirect order-preserving relationship is the same as the concept of the second target message above, and the second target message has been described above. , So I won’t repeat it here.
  • the first message is message A8 in Figures 2 to 4, then it can be seen from Figures 2 to 4 that according to the encoding of the first message, it can be known that the first message belongs to the direct order preservation relationship and indirect order preservation The first message in the relationship, therefore, the first message is executed directly after the first message is received; if the first message is message B6 in Figures 2 to 4, and the first message is based on the first message
  • the code of a group of direct preserving relations is (0,1), then it is judged whether the execution number of the message A whose first code is 0 based on the first direct preserving relation is equal to 1, if so, the first message is executed .
  • the code is (1,1)
  • the first message is based on The code of the second group of indirect preserving relations is (1,2)
  • the numbering of the preserving intervals based on each group of preserving relations is numbered in ascending order, that is, the messages are numbered based on the corresponding preserving relations (direct preserving relations).
  • the first codes of order-preserving relations and indirect order-preserving relations are coded in ascending order, if the first codes are based on each group of order-preserving relations (direct order-preserving relations and indirect order-preserving relations) If the first message in each group of direct preserving relationship is executed in order from small to large, the principle and method of determining whether to execute the first message are the same as the principle of determining whether to execute the first message. Therefore, it is not here. Let me repeat it again.
  • Each type of message in the M type includes one type of message.
  • the k+1 type message directly depends on the k type message for protection.
  • the k+1 type message indirectly depends on each type of message from the type 1 message to the type k-1 message for order preservation, 1 ⁇ k ⁇ M-1 and k and M are integers;
  • a number is used to indicate the number of type 1 messages to type M-1 messages before the M-th message in the order-preserving interval to which the M-th message belongs, and the second number is used to indicate the number of the M-th message.
  • the first message is executed. Since the first message is a type 1 message, that is, the first message is the message with the highest priority, and its execution is not restricted by the execution of other messages. Therefore, after receiving the first message, you can Execute the first message directly.
  • the first message is the k-th message and 2 ⁇ k ⁇ M-1, and it is determined that the first target message has been executed according to the first code, first number, and second number of the first message, then execute The first message, where the first target message includes the type 1 message to the k-1 type message located before the first message in the sequence preservation interval to which the first message belongs, and the first message to which the first message belongs The 1st message to the k-1th message in the preserving interval before the preserving interval of. That is, the first message is a message with a priority lower than the highest priority and higher than the lowest priority. Therefore, the execution of the first message is subject to the messages that are ranked before it and higher than its priority (that is, the first type of message).
  • the following example illustrates the process. If the numbers of the order-preserving intervals are numbered in ascending order, that is, the first code of the packets in the order-preserving interval in the front is smaller than that of the packets in the order-preserving interval in the back.
  • the first code of the first message then it is judged that the first code is smaller than the first code of the first message from the first message to the k-1th message (that is, the message with the priority higher than the priority of the first message) Whether the execution has been completed, if so, according to the second code of the message with the same first code as the first code of the first message (for the message with the highest priority) or the second number in the second code (for the message with the highest priority) The priority is higher than the priority of the first message and lower than the highest priority message) and the second number of the first message is judged to be the first message before the first message in the sequence preservation interval to which the first message belongs. Whether the number of executions of type 1 messages to type k-1 messages (messages with priority higher than the priority of the first message) is equal to the first number of the first message, if yes, execute the first message .
  • the second target message includes the type 1 message to the M-1 type message in the order preserving interval to which the first message belongs and the type 1 message before the first message and the order preserving interval to which the first message belongs.
  • the priority order of the five types of messages in the multiple messages in Figure 7 from high to low is: message a>message b>message c>message d>message e, that is, the first type
  • the message includes message a
  • the second type message includes message b
  • the third type message includes message c
  • the fourth type message includes message d
  • the fifth type message includes message e.
  • first message is message a10 in Figure 7, since the first message is message a, and message a has the highest priority, that is, message a is a type 1 message, so the message can be executed directly a.
  • first message is d6 in Figure 7, since the number of the first message is (1,2,4), if the first number is 0 and the priority is higher than the priority of message d6
  • the message ie message c1(0,0,1)
  • the first number is equal to 1 and is located before the first message and has a priority higher than that of message d6 (ie message When the execution number of c3(1,0,1) and message a5(1,3) is equal to 2, the first message is executed.
  • the process of determining whether to execute the first message according to the encoding of the first message is as follows:
  • the first message is the t-th message in the k-th message and 2 ⁇ k ⁇ M-1, and the first target message is determined according to the first code, first number, and second number of the first message
  • the first message is executed, where the first target message includes the first message to the k-1th message in the sequence preservation interval to which the first message belongs.
  • the first target message includes the first message to the k-1th message in the sequence preservation interval to which the first message belongs.
  • the first message is the q-th message in the M-th class message, and the second target message is determined to have been executed according to the first code, first number, and second number of the first message, then execute the first message A message, where the second target message includes the type 1 message before the first message in the order-preserving interval to which the first message belongs to the M-1 type message.
  • the order relationship direct order preservation relationship and indirect order preservation relationship
  • a message that has an order-preserving relationship direct order-preserving relationship and indirect order-preserving relationship).
  • the multiple messages in Figure 8 include six types of messages, namely: message A, message B, message C, message D, message E, and message F.
  • message C directly depends on Message A is in order
  • message D is directly dependent on message B for order protection
  • message E is directly dependent on message C for order protection
  • message F is directly dependent on message C for order protection
  • message E is indirectly Rely on message A for order preservation
  • message F indirectly depends on message A for order preservation.
  • the above-mentioned six types of messages can be divided into three types of messages, and the three types of messages are in descending order of priority: the first type of message, the second type of message, and the third type of message.
  • the first type of message includes message A and message B
  • the second type of message includes message C and message D
  • the third type of message includes message F and message F.
  • the first message is message A8 in FIG. 8, since the first message is message A, and message A has the highest priority, the first message can be executed directly.
  • the first message is message D10 in Figure 8 since the code of the first message is (1,1,5), if the first number is 0 and the priority is higher than the priority of message D10
  • the message ie message B2(0,2)
  • the first number is equal to 1 and is located before message D10 and has a priority higher than that of message D10 (ie message B9
  • the execution quantity of (1,4) is equal to 1, the first message is executed.
  • the first message is message E14 in Figure 8 since the number of the first message is (2,1,2), if the first number is 0 and the priority is higher than the priority of message E14
  • the message ie message C1(0,0,1), message A3(0,3)
  • the first number is 1 and the priority is higher than the priority of message E14.
  • Messages (message C7 (1,0,2), message A8 (1,3), message A11 (1,6)) have all been executed, and the first number is 2 and is before message E14 and has priority
  • the number of executions of messages with a priority level higher than that of message E14 ie, message C13(2,0,1)
  • the first message is executed.
  • the method for determining whether the second module is the end module of the first message may include: carrying the identification information (such as ip address, etc.) of the end module in the first message, and receiving the first message and its code in the second module Then, it is judged whether the identification information of the end module carried in the first message is the same as the identification information of the second module, if so, the second module is the end module, and if not, the second module is not the end module.
  • the second module can quickly determine the execution relationship between the first message and other messages in the multiple messages according to the encoding of the first message (that is, determine the Before the first message and restrict the execution of the first message), the order-preserving transmission of the message is realized, and the second module is faster according to the message that is ranked before the first message and restricts the execution of the first message Accurately determine whether to execute the first message, which improves the efficiency of message execution.
  • the foregoing message sequence preservation method can be applied to a data transmission system, and the data transmission system may include multiple servers, among which data transmission can be realized between the servers.
  • the first module and the second module may be one server among multiple servers.
  • the data transmission system can also be a data transmission system based on an SOC chip.
  • the data transmission system based on an SOC chip can include multiple modules, and data transmission can be realized between the modules.
  • the first module and the second module can be multiple modules. Of a module.
  • the above-mentioned SOC chip may be, for example, a server chip with a PCIe interface, a memory chip with a PCIe interface form, a terminal chip with a PCIe interface, and an AI chip with a PCIe interface, etc., which are not specifically limited here.
  • Figure 9 shows a schematic structural diagram of a data transmission system based on an SOC chip.
  • the data transmission system using PCIe SOC chip includes module A, module B, module C, module D, module E, module F, etc.
  • the data transmission system transmits three types of messages, namely P messages, CPL messages, and NP messages; among them, P messages and CPL messages are the first group of sequence preservation relationships, and CPL messages rely on P messages for sequence preservation; P messages and NP messages are The second group of order-preserving relationships, and NP messages rely on P messages for order-preserving. Based on this, the three types of messages can be divided into two types of messages.
  • the first type of messages includes P messages
  • the second type of messages includes CPL messages and NP messages.
  • the priority of the first type of messages is It is higher than the second type of message, in which the order-preserving relationship between the P message and the CPL message is a direct order-preserving relationship, and the order-preserving relationship between the P message and the NP message is a direct order-preserving relationship.
  • the message sending module Serdes1 sends the first message to module A in order, and module A encodes the first message.
  • module A uses The above-mentioned first module encodes the message by setting the encoding for the first message, and sending the first message and its encoding to module B.
  • module A is the initial module in the data input direction.
  • Module B receives the first message and its code, determines whether module B is the end module of the first message, if so, determines whether to execute the first message according to the encoding of the first message, and if it is determined to execute the first message , Then operate the memory in module B based on the first message and in accordance with the order-preserving rules; if module B is not the end module of the first message, send the first message and its code to module C and store it in module C Repeat the operation of module B above.
  • the first message may be a P message, a CPL message, or an NP message. P messages, CPL messages, and NP messages are transmitted in lanes and out of order between modules.
  • module D encodes the first message. Specifically, module D uses the encoding method of the first module to set the encoding for the first message. , And send the first message and its code to module E. Among them, module D is the initial module in the data output direction. Module E receives the first message and its code, and transmits the first message and its code to module F; Module F parses the code of the first message to restore the original arrangement information, and receives the message according to the original arrangement information The module Serdes2 sends the first message.
  • the first message can be a P message, a CPL message, or an NP message
  • the P message, CPL message, and NP message are transmitted between modules in a lane-dividing and out-of-sequence transmission manner.
  • FIG. 10 shows a schematic diagram eight of encoding multiple messages
  • FIG. 11 shows a schematic diagram nine of encoding multiple messages.
  • Module A and Module D use the first method in the first module to set the encoding for each of the multiple messages as shown in Figure 10.
  • the multiple messages are performed based on the first set of order-preserving relationships.
  • the node where the CPL message is switched to the P message is used as the dividing node to divide the sequence preservation interval for multiple messages; when multiple messages are encoded based on the second set of sequence preservation relations, the NP message is switched to P
  • the message node is used as a dividing node to divide the order-preserving interval for multiple messages; the specific coding principle has been explained above, so it will not be repeated here.
  • the principle for modules such as module B, module C, module E, and module F to determine whether to execute the first message according to the encoding of the first message has been explained above, so it will not be repeated here.
  • Module A and Module D use the second method in the first module to set the encoding for each of the multiple messages as shown in Figure 11.
  • the node where the CPL message is switched to the P message is used as the division
  • the node divides the order-preserving interval for multiple messages.
  • the principle for modules such as module B, module C, module E, and module F to determine whether to execute the first message according to the encoding of the first message has been explained above, so it will not be repeated here.
  • Fig. 12 is a structural schematic diagram 1 of a message sequence preserving apparatus provided by an embodiment of the application.
  • the apparatus 1200 may include: a first receiving module 1201, an encoding module 1202, and a sending module 1203, where: A receiving module 1201, configured to receive a first message, where the first message is any one of a plurality of messages; an encoding module 1202, configured to receive the first message in the plurality of messages according to the The transmission sequence in the text and the order-preserving relationship between the first message and other messages in the plurality of messages encode the first message to obtain the encoding of the first message; sending module 1203, configured to send the first message and its code to the second module; wherein the code of the first message is used to indicate the first message and other messages in the plurality of messages The execution relationship.
  • the multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations.
  • a message and a second message, and the second message depends on the first message for order preservation.
  • the encoding module 1202 includes: a first encoding unit, configured to, if the first message is the first type of message or the second type of message in the i-th group of order-preserving relations , A first code based on the i-th group of order-preserving relationship is set for the first message, where the first code is used to indicate to which the first message belongs based on the i-th group of preserving
  • the order-preserving interval of the relationship, the order-preserving interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is that the second type of message in the i-th group of order-preserving relations is switched to the first type of message
  • the node of the message, the plurality of messages are sorted according to the sending order of each message of the plurality of messages; and the second coding unit is used to if the first message is the i-th group of order-preserving relations For the second type of message in the first message, a second code based on the i-th group of order
  • each of the N groups of order preserving relations is a direct preserving relationship; or a part of the N groups of preserving relations is a direct preserving relationship, The other part of the order-preserving relationship is the indirect order-preserving relationship.
  • the multiple messages include three types of messages, which are P messages, NP messages, and CPL messages, respectively, and the multiple messages include two sets of order-preserving relationships.
  • the two groups of order-preserving relations are all direct order-preserving relations; among them, the first type of message in the first group of direct order-preserving relations is a P message, and the second type of message in the first group of direct order-preserving relations is a CPL message.
  • the first type of message in the second group of direct preserving relations is a P message, and the second type of message in the second group of direct preserving relations is an NP message.
  • the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1 ⁇ k ⁇ M- 1 and both k and M are integers;
  • the third code Unit configured to set a second code for the first message if the first message is the k-th message and 2 ⁇ k ⁇ M-1, and the second code includes the first number And a second number, where the first number is used to indicate the number of type 1 messages to type k-1 messages before the first message in the order-preserving interval to which the first message belongs, so The second number is used to indicate the sequence number of the first message in the message in the order-preserving interval to which it belongs; the fourth coding unit is used to indicate if the first message is the M-th type message Message, a second code is set for the first message.
  • the second code includes a first number and a second number. The number of Type 1 messages to Type M-1 messages before the first message, and the second number is used to indicate the number of messages in the sequence-preserving interval to which the first message belongs Arrange the serial number.
  • the multiple messages include type M messages, and at least one type of messages in the M type messages includes multiple types of messages, and among them, the k+1 type messages
  • a type of message directly depends on the order-preserving relationship between the k-th type of message and the order-preserving message, and a type of message in the k+1-th type of message indirectly depends on the type 1 message to the k-th type of message.
  • Type 1 messages the order is preserved for the messages with the order-preserving relationship, 1 ⁇ k ⁇ M-1 and both k and M are integers;
  • the multiple messages include two types of messages, where the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages.
  • the message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
  • the above-mentioned device of the present application can be used to execute the technical solution of the method embodiment executed by the first module in FIG.
  • FIG. 13 is a second structural diagram of a message sequence preserving device provided by an embodiment of the application.
  • the device 1300 may include: a second receiving module 1301, a determining module 1302, wherein: a second receiving module 1301 , For receiving the first message and its code sent by the first module, where the first message is any one of a plurality of messages; the determining module 1302 is for receiving the first message according to the The encoding determines whether to execute the first message; wherein the encoding of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages.
  • the multiple messages include N groups of order-preserving relations, 1 ⁇ N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first The second type of message and the second type of message, and the second type of message depends on the first type of message for order preservation; for the i-th group of order-preserving relations, the first group of the i-th group of order-preserving relations The first code of one type of message and the second type of message based on the i-th group of preserving relationship is used to indicate to which the first type of message and the second type of message belong based on the i-th group of preserving The order-preserving interval of the order relationship; for the i-th group of order-preserving relations, the second message in the i-th group of order-preserving relations is based on the second code of the i-th group of order-preserving relations to indicate the second The number of the first type of message in the i-th group of order-preserving relations in the order-preserving interval based on the
  • the determining module 1302 includes: a first execution unit, configured to: If the first message is the first message in the x-th group of direct order-preserving relationship, then the first message is executed; the second execution unit is configured to if the first message is the x-th group of direct preserving For the second type of message in the sequence relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the x-th group of direct sequence preservation relationship, the execution The first message, where the first target message includes the first type of message in the x-th group of direct sequence preserving relationships in the sequence preserving interval to which the first message belongs, and the first message in the first message belonging to The first type of message in the x-th group of direct order-preserving relations in the order-preserving interval before the order-preserving interval; where 1 ⁇ x ⁇ N, and x is an integer.
  • the determining module 1302 includes: The first execution unit is configured to: if the first message is only the first message in the x-th group of direct order-preserving relations, or if the first message is the first message in the x-th group of direct order-preserving relations A message and the first message is the first message in the q-th group of indirect order-preserving relations, then the first message is executed; the second execution unit is configured to execute the first message if the first message Only the second type of message in the x-th group of direct order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the jth group For the first type of message in the group direct preserving relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second
  • the number of type 1 messages to type k-1 messages before the message where the second number is used to indicate the sequence number of the type k message in the message in the sequence preservation interval to which it belongs;
  • the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval.
  • the number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
  • the second execution unit if the first message is the k-th message and 2 ⁇ k ⁇ M-1, and according to the first code, first number and second If the number determines that the execution of the first target message has been completed, the first message is executed, where the first target message includes the sequence preserving interval to which the first message belongs and is located before the first message Type 1 messages to type k-1 messages, and type 1 messages to type k-1 messages in the order-preserving interval before the order-preserving interval to which the first message belongs; third The execution unit is configured to: if the first message is an M-th message, and it is determined that the execution of the second target message has been completed according to the first code, the first number, and the second number of the first message, then execute all The first message, wherein the second target message includes the type 1 message to the M-1 type message that are located before the first message in the order
  • the above-mentioned device of the present application can be used to execute the technical solution of the method embodiment executed by the second module in FIG.
  • the present application also provides a computer-readable storage medium, including a computer program, which when executed on a computer, causes the computer to execute any one of the methods executed by the first module in FIG. 1 or the method in FIG. 1 Any method performed by the second module.
  • This application also provides a computer program, when the computer program is executed by a computer, it is used to execute any one of the methods executed by the first module in FIG. 1 or any one executed by the second module in FIG. 1 method.
  • the present application also provides a chip including a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the first module in FIG. 1 Any method executed or any method executed by the second module in FIG. 1.
  • the chip may also include a memory and a communication interface.
  • the communication interface may be an input/output interface, a pin, an input/output circuit, or the like.
  • the steps of the foregoing method embodiments may be completed by hardware integrated logic circuits in the processor or instructions in the form of software.
  • the processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components.
  • the general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware encoding processor, or executed and completed by a combination of hardware and software modules in the encoding processor.
  • the software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers.
  • the storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
  • the memory mentioned in the above embodiments may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory.
  • the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory.
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • static random access memory static random access memory
  • dynamic RAM dynamic RAM
  • DRAM dynamic random access memory
  • synchronous dynamic random access memory synchronous DRAM, SDRAM
  • double data rate synchronous dynamic random access memory double data rate SDRAM, DDR SDRAM
  • enhanced synchronous dynamic random access memory enhanced SDRAM, ESDRAM
  • synchronous connection dynamic random access memory serial DRAM, SLDRAM
  • direct rambus RAM direct rambus RAM
  • the disclosed system, device, and method can be implemented in other ways.
  • the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disks or optical disks and other media that can store program codes. .

Abstract

Provided are a message order preservation method and apparatus. The method comprises: receiving a first message, wherein the first message is any one of a plurality of messages; according to the sending order of the first message in the plurality of messages and an order preservation relationship between the first message and the other messages in the plurality of messages, coding the first message to obtain a code of the first message, wherein the code of the first message is used for indicating an execution relationship between the first message and the other messages in the plurality of messages; and sending the first message and the code thereof to a second module. By means of the present application, the order-preserving transmission of a message is realized, and a transmission delay of the message is greatly shortened, such that the phenomenon of the order-preserving transmission delay of the message being invisibly lengthened is prevented, the utilization rate of a bandwidth is greatly improved, the problem of an accumulation effect occurring due to the passage of time is also avoided, and the influence on the transmission of a message of a further upstream module is greatly reduced.

Description

报文保序方法和装置Message sequence preserving method and device 技术领域Technical field
本申请涉及数据通信领域,尤其涉及一种报文保序方法和装置。This application relates to the field of data communication, and in particular to a method and device for message sequence preservation.
背景技术Background technique
随着互联网和通信技术的快速发展,数据传输系统被广泛应用于服务器、存储器、网络和人工智能系统中。数据传输系统包括多个模块,模块之间可进行报文传输。报文的传输方式包括保序传输,即在模块之间传输报文时,保证存在保序关系的报文之间的发送顺序,其中,存在保序关系的报文可以理解为:针对存在保序关系的两种报文,其中,第二种报文依赖于第一种报文进行保序,即第二种报文的执行依赖于第一种报文的执行,则在执行一报文且该报文为第二种报文时,需确认排在该报文之前的第一种报文均执行完成后,才可执行该报文。With the rapid development of the Internet and communication technologies, data transmission systems are widely used in servers, storage, networks, and artificial intelligence systems. The data transmission system includes multiple modules, and messages can be transmitted between the modules. The message transmission method includes sequence-preserving transmission, that is, when transmitting messages between modules, the sending order of messages with sequence-preserving relationship is guaranteed. Among them, the message with sequence-preserving relationship can be understood as: There are two types of messages in the order relationship. Among them, the second type of message depends on the first type of message for order preservation, that is, the execution of the second type of message depends on the execution of the first type of message, then the execution of a message And when the message is the second type of message, it is necessary to confirm that the execution of the first type of message before the message is completed before the message can be executed.
目前,为了实现报文的保序传输,通常采用的方式为:若多个报文在第一模块和第二模块之间传输,则在第一模块向第二模块发送多个报文中的报文时,为了实现报文的保序传输,第一模块要在接收到第二模块发送的确认消息后,方可发送该报文,其中,第二模块在接收并执行第一模块发送的前一个报文后,向第一模块发送确认消息。At present, in order to realize the order-preserving transmission of messages, the usual method is: if multiple messages are transmitted between the first module and the second module, the first module sends to the second module one of the multiple messages. In order to realize the order-preserving transmission of the message, the first module can only send the message after receiving the confirmation message sent by the second module. The second module is receiving and executing the message sent by the first module. After the previous message, a confirmation message is sent to the first module.
显然,在上述方式中,一方面,由于第一模块要在接收到第二模块发送的确认消息后发送报文,极大的降低了带宽的利用率,且导致报文的传输延时大,从而使得报文的保序传输延时被无形拉长;另一方面,由于报文的传输延时大,随着时间的推移,产生积累效应,极大的影响了更上游模块的报文传输。Obviously, in the above method, on the one hand, since the first module has to send the message after receiving the confirmation message sent by the second module, the bandwidth utilization rate is greatly reduced, and the transmission delay of the message is large. As a result, the order-preserving transmission delay of the message is invisibly lengthened; on the other hand, due to the large transmission delay of the message, over time, an accumulation effect occurs, which greatly affects the message transmission of more upstream modules. .
发明内容Summary of the invention
本申请提供一种报文保序方法,用于解决由于第一模块要在接收到第二模块发送的确认消息后发送报文,极大的降低了带宽的利用率,且导致报文的传输延时大,从而使得报文的保序传输延时被无形拉长的问题,以及由于报文的传输延时大,随着时间的推移,产生积累效应,极大的影响了更上游模块的报文传输的问题。This application provides a method for message sequence preservation, which is used to solve the problem that since the first module has to send a message after receiving the confirmation message sent by the second module, the bandwidth utilization rate is greatly reduced, and the transmission of the message is caused. The delay is large, so that the order-preserving transmission delay of the message is invisibly lengthened, and because the transmission delay of the message is large, it has an accumulation effect over time, which greatly affects the more upstream modules. The problem of message transmission.
第一方面,提供了一种报文保序方法,包括:接收第一报文,其中,所述第一报文为多个报文中的任意一个;根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码以得到所述第一报文的编码;向第二模块发送所述第一报文及其编码;其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。In a first aspect, a method for preserving message sequence is provided, including: receiving a first message, wherein the first message is any one of a plurality of messages; The transmission sequence in the multiple messages and the order-preserving relationship between the first message and other messages in the multiple messages encode the first message to obtain the encoding of the first message Send the first message and its code to the second module; wherein the code of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages .
根据第一报文在多个报文中的发送顺序和第一报文与多个报文中的其他报文的保序关系为第一报文设置编码,使得第一报文的编码指示第一报文与多个报文中的其他报文的执行关系(即排在第一报文之前且限制第一报文执行的报文),因此,在第一模块和第二模块之间传输第一报文时,通过传输第一报文的编码,使得第二模块根据第一报文的编码 确定排在第一报文之前且限制第一报文执行的报文,实现了第一报文的保序传输;另外,由于第一报文的编码指示第一报文与多个报文中的其他报文的执行关系(即排在第一报文之前且限制第一报文执行的报文),因此相比于现有技术,在第一模块和第二模块之间传输第一报文时,无需第二模块向第一模块发送确认消息,也无需第一模块确认是否接收到确认消息,无需链路、无需流控,仅通过发送第一报文及其编码,即可实现第一报文的保序传输,极大的缩短了报文的传输延时,从而避免出现报文保序传输延时被无形拉长的现象,极大的提高了带宽的利用率;此外,由于缩短了报文的传输延时,因此避免出现由于时间的推移而产生积累效应的问题,极大的减轻了对更上游模块的报文的传输影响;另外,通过为第一报文设置编码的方式,实现报文的保序传输,方式简单且易于执行。Set the code for the first message according to the sending order of the first message in the multiple messages and the order-preserving relationship between the first message and other messages in the multiple messages, so that the encoding of the first message indicates the first message. The execution relationship between a message and other messages in multiple messages (that is, the message that is arranged before the first message and restricts the execution of the first message), therefore, the transmission between the first module and the second module In the first message, by transmitting the encoding of the first message, the second module determines the message that is ranked before the first message and restricts the execution of the first message according to the encoding of the first message, thus realizing the first message Order-preserving transmission of messages; in addition, since the encoding of the first message indicates the execution relationship between the first message and other messages in multiple messages (that is, it is arranged before the first message and restricts the execution of the first message Therefore, compared with the prior art, when the first message is transmitted between the first module and the second module, there is no need for the second module to send a confirmation message to the first module, and there is no need for the first module to confirm whether it has received it. Acknowledgment message, no link, no flow control, only by sending the first message and its code, the order-preserving transmission of the first message can be realized, which greatly shortens the transmission delay of the message, thereby avoiding the occurrence of the message. The phenomenon that the transmission delay of document preservation is invisibly elongated greatly improves the utilization of bandwidth; in addition, because the transmission delay of the message is shortened, the problem of accumulation effect due to the passage of time is avoided, and the problem is extremely high. It greatly reduces the impact on the transmission of the messages of the more upstream modules; in addition, by setting the encoding for the first message, the order-preserving transmission of the messages is realized, which is simple and easy to implement.
在一种可能的实施方式中,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序。In a possible implementation, the multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations. A message and a second message, and the second message depends on the first message for order preservation.
在一种可能的实施方式中,所述根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码包括:In a possible implementation manner, according to the transmission sequence of the first message in the plurality of messages and the protection between the first message and other messages in the plurality of messages The sequence relationship encoding the first message includes:
若所述第一报文为第i组保序关系中的第一种报文或第二种报文,则为所述第一报文设置基于所述第i组保序关系的第一编码,其中,所述第一编码用于指示所述第一报文所属的基于所述第i组保序关系的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为所述第i组保序关系中的第二种报文切换为第一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;以及若所述第一报文为第i组保序关系中的第二种报文,则为所述第一报文设置基于所述第i组保序关系的第二编码,其中,所述第二编码用于指示所述第一报文所属的基于第i组保序关系的保序区间内的第一种报文的数量;其中,1≤i≤N且i为整数。If the first message is the first message or the second message in the i-th group of order-preserving relations, set a first code based on the i-th group of order-preserving relations for the first message , Wherein the first code is used to indicate the order-preserving interval based on the i-th group of order-preserving relationship to which the first message belongs, and the order-preserving interval is obtained by dividing the plurality of messages by a dividing node , The division node is a node where the second type of message in the i-th group of order-preserving relationship is switched to the first type of message, and the plurality of messages are based on each of the plurality of messages And if the first message is the second type of message in the i-th group of order-preserving relations, then a second code based on the i-th group of order-preserving relations is set for the first message , Wherein the second code is used to indicate the number of messages of the first type in the sequence-preserving interval based on the i-th group of sequence-preserving relationship to which the first message belongs; where 1≤i≤N and i is Integer.
在一种可能的实施方式中,所述N组保序关系中的每组保序关系均为直接保序关系;或者所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系。In a possible implementation manner, each of the N groups of order-preserving relations is a direct order-preserving relationship; or a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relationship, The other part of the order-preserving relationship is the indirect order-preserving relationship.
在一种可能的实施方式中,所述多个报文包括3种报文,分别为P报文、NP报文、CPL报文,所述多个报文包括2组保序关系,所述2组保序关系均为直接保序关系;其中,第一组直接保序关系中的第一种报文为P报文,第一组直接保序关系中的第二种报文为CPL报文;第二组直接保序关系中的第一种报文为P报文,第二组直接保序关系中的第二种报文为NP报文。In a possible implementation manner, the multiple messages include three types of messages, which are P messages, NP messages, and CPL messages, respectively, and the multiple messages include two sets of order-preserving relationships. The two groups of order-preserving relations are all direct order-preserving relations; among them, the first type of message in the first group of direct order-preserving relations is a P message, and the second type of message in the first group of direct order-preserving relations is a CPL message. The first type of message in the second group of direct preserving relations is a P message, and the second type of message in the second group of direct preserving relations is an NP message.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;In a possible implementation manner, the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1≤k≤M- 1 and both k and M are integers;
所述根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码包括:Said processing the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding includes:
为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文切换为所述第1类报文至第M-1类报文中的任意一类报文的节点,所述多个报文按照所述多个报 文中的每个报文的发送顺序排序;若所述第一报文为所述第k类报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;若所述第一报文为所述第k类报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;若所述第一报文为所述第M类报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。Setting a first code for the first message, where the first code is used to indicate the sequence-preserving interval to which the first message belongs, and the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, The dividing node is a node where the M-th message is switched to any one of the first message to the M-1 message, and the multiple messages are in accordance with the multiple messages. The order of sending each message in the The code is used to indicate the sequence number of the first message in the message in the order-preserving interval to which it belongs; if the first message is the k-th message and 2≤k≤M-1, Then, a second code is set for the first message, and the second code includes a first number and a second number, and the first number is used to indicate that the first message belongs in the order-preserving interval within the first message. The number of type 1 messages to type k-1 messages before a message, and the second number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs ; If the first message is the M-th message, a second code is set for the first message, and the second code includes a first number and a second number, and the first number is used Indicates the number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the first message belongs, and the second number is used to indicate the number of the first message The sequence number of the message in the message in the preserving interval to which it belongs.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系报文进行保序,1≤k≤M-1且k和M均为整数;In a possible implementation manner, the multiple messages include type M messages, and at least one type of messages in the M type messages includes multiple types of messages, and among them, the k+1 type messages A type of message directly depends on the order-preserving relationship between the k-th type of message and the order-preserving message, and a type of message in the k+1-th type of message indirectly depends on the type 1 message to the k-th type of message. In Type 1 messages, the order is preserved for the messages with the order-preserving relationship, 1≤k≤M-1 and both k and M are integers;
所述根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码包括:Said processing the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding includes:
为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文中指定的一种报文或者任一种报文切换为第1类报文至第M-1类报文中指定的一种报文或者任一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;若所述第一报文为所述第k类报文中的第s种报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;若所述第一报文为所述第k类报文中的第t种报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文中与其存在保序关系的报文数量;第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;若所述第一报文为所述第M类报文中的第q种报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文中与其存在保序关系的报文数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。Setting a first code for the first message, where the first code is used to indicate the sequence-preserving interval to which the first message belongs, and the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, The dividing node is a type of message or any type of message designated in the M-th type of message is switched to a type of message or any type of message that is designated in the type 1 message to the M-1 type of message. The node of the message, the plurality of messages are sorted according to the sending order of each of the plurality of messages; if the first message is the sth type of message in the k-th type of message And k=1, a second code is set for the first message, where the second code is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs; If the first message is a t-th message in the k-th message and 2≤k≤M-1, then a second code is set for the first message, and the second code includes The first number and the second number, where the first number is used to indicate the type 1 message to the k-1 type message before the first message in the sequence preservation interval to which the first message belongs The number of messages in the text with which there is a sequence-preserving relationship; the second number is used to indicate the sequence number of the first message in the message within the sequence-preserving interval to which it belongs; if the first message is the For the q-th type of message in the M-th type of message, a second code is set for the first message, and the second code includes a first number and a second number, where the first number is used to indicate The number of messages in the order-preserving interval to which the first message belongs, from the first message to the M-1th message before the first message, with which there is a preserving relationship, and the second number is used It indicates the sequence number of the first message in the message in the preserving interval to which it belongs.
在一种可能的实施方式中,所述多个报文包括2类报文,其中,第一类报文包括P报文,第二类报文包括NP报文和CPL报文,所述NP报文依赖于所述P报文进行保序,所述CPL报文依赖于所述P报文进行保序。In a possible implementation manner, the multiple messages include two types of messages, where the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages. The message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
第二方面,提供了一种报文保序方法,包括:接收第一模块发送的第一报文及其编码,其中所述第一报文为多个报文中的任意一个报文;根据所述第一报文的编码确定是否执行所述第一报文;其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。In a second aspect, a method for preserving message sequence is provided, including: receiving a first message sent by a first module and its code, wherein the first message is any one of a plurality of messages; The encoding of the first message determines whether to execute the first message; wherein the encoding of the first message is used to indicate the difference between the first message and other messages in the plurality of messages Execution relationship.
在接收到第一模块发送的第一报文及其编码后,根据第一报文的编码即可快速的确定第一报文与多个报文中的其他报文的执行关系(即确定排在第一报文之前且限制第一报文 执行的报文),实现了报文的保序传输,以及根据排在第一报文之前且限制第一报文执行的报文更加快速准确的确定是否执行第一报文,提高了报文执行的效率。After receiving the first message and its code sent by the first module, according to the code of the first message, the execution relationship between the first message and other messages in the multiple messages can be quickly determined (that is, the execution relationship between the first message and the other messages in the multiple messages is determined). Before the first message and restrict the execution of the first message), the order-preserving transmission of the message is realized, and the message that is arranged before the first message and restricts the execution of the first message is faster and more accurate Determine whether to execute the first message, which improves the efficiency of message execution.
在一种可能的实施方式中,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序;针对第i组保序关系,所述第i组保序关系中的第一种报文和第二种报文基于所述第i组保序关系的第一编码用于指示所述第一种报文和所述第二种报文所属的基于所述第i组保序关系的保序区间;针对第i组保序关系,所述第i组保序关系中的第二种报文基于所述第i组保序关系的第二编码用于指示所述第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量。In a possible implementation, the multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations. The second type of message and the second type of message, and the second type of message depends on the first type of message for order preservation; for the i-th group of order-preserving relations, the first group of the i-th group of order-preserving relations The first code of one type of message and the second type of message based on the i-th group of preserving relationship is used to indicate to which the first type of message and the second type of message belong based on the i-th group of preserving The order-preserving interval of the order relationship; for the i-th group of order-preserving relations, the second message in the i-th group of order-preserving relations is based on the second code of the i-th group of order-preserving relations to indicate the second The number of the first type of message in the i-th group of order-preserving relations in the order-preserving interval based on the i-th group of order-preserving relations to which this kind of message belongs.
在一种可能的实施方式中,在所述N组保序关系中的每组保序关系均为直接保序关系的条件下,所述根据所述第一报文的编码确定是否执行所述第一报文包括:In a possible implementation manner, under the condition that each of the N groups of order-preserving relations is a direct order-preserving relationship, the determining whether to execute the order according to the encoding of the first message The first message includes:
若所述第一报文为第x组直接保序关系中的第一种报文,则执行所述第一报文;若所述第一报文为第x组直接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文,其中,第一目标报文包括位于所述第一报文所属的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;其中,1≤x≤N,且x为整数。If the first message is the first message in the x-th group of direct order-preserving relations, the first message is executed; if the first message is the first message in the x-th group of direct order-preserving relations For the two types of messages, the first message is executed when it is determined that the execution of the first target message has been completed based on the first code and the second code of the x-th group of direct order-preserving relationship of the first message, Wherein, the first target message includes the first type of message in the x-th group of direct order-preserving relations located in the order-preserving interval to which the first message belongs and before the order-preserving interval to which the first message belongs The x-th group in the order-preserving interval of is the first message in the direct order-preserving relationship; among them, 1≤x≤N, and x is an integer.
在一种可能的实施方式中,在所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系的条件下,所述根据所述第一报文的编码确定是否执行所述第一报文包括:In a possible implementation manner, under the condition that a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relation, and the other part of the order-preserving relations is an indirect order-preserving relation, the first The encoding of the message to determine whether to execute the first message includes:
若所述第一报文仅为第x组直接保序关系中的第一种报文,或者若所述第一报文为第x组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第一种报文,则执行所述第一报文;若所述第一报文仅为第x组直接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文;若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第q组间接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据所述第一报文基于第q组间接保序关系的第一编码和第二编码确定第二目标报文均已执行完成时,执行所述第一报文;其中,第一目标报文包括位于所述第一报文所属的基于第x组直接保序关系的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的基于第x组直接保序关系的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;第二目标报文包括位于所述第一报文所属的基于第q组间接保序关系的保序区间内的第q组间接保序关系中的第一种报文和位于所述第一报文所属的基于第q组间接保序关系的保序区间之前的保序区间内的第q组间接保序关系中的第一种报文。If the first message is only the first message in the x-th group of direct order-preserving relations, or if the first message is the first message in the x-th group of direct preserving relations and the If the first message is the first message in the q-th group of indirect order-preserving relations, the first message is executed; if the first message is only the second message in the x-th group of direct order-preserving relations Message, or if the first message is the second message in the x-th group of direct order-preserving relations and the first message is the first message in the j-th group of direct order-preserving relations, then When it is determined that the execution of the first target message has been completed according to the first message based on the first code and the second code of the x-th group of direct order-preserving relationship, the first message is executed; if the first message The message is the second type of message in the x-th group of direct order-preserving relations and the first message is the first type of message in the j-th group of direct order-preserving relations, and the first message is the q-th group of indirect messages. The second type of message in the order-preserving relationship, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the q-th group of indirect order-preserving relations According to the second type of message of the first message, it is determined that the first target message has been executed according to the first code and the second code of the x-th group of direct order-preserving relationship, and according to the first message When it is determined that the second target message has been executed based on the first code and the second code of the q-th group of indirect order-preserving relations, the first message is executed; wherein, the first target message includes the first message located in the first The first type of message in the x-th group of direct-order-preserving relationships in the x-th group of direct-order-preserving interval to which the message belongs and the x-th group-based direct-ordering relationship to which the first message belongs The first message in the x-th group of direct sequence-preserving relationships in the sequence-preserving interval before the sequence-preserving interval; the second target message includes the q-th group-based indirect sequence-preserving relationship that belongs to the The first message in the q-th group of indirect order-preserving relations in the order-preserving interval and the q-th message in the order-preserving interval before the order-preserving interval based on the q-th group of indirect order-preserving relations to which the first message belongs The first message in the group indirect order preserving relationship.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的每类报 文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;针对所述M类报文中的每类报文,所述每类报文的第一编码均用于指示所述报文所属的保序区间;在k=1的条件下,第1类报文的第二编码用于指示所述第1类报文在其所属的保序区间内的报文中的排列序号;在2≤k≤M-1的条件下,每个第k类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第k类报文所属的保序区间内在所述第k类报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第k类报文在其所属的保序区间内的报文中的排列序号;针对第M类报文,所述第M类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第M类报文所属的保序区间内在所述第M类报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第M类报文在其所属的保序区间内的报文中的排列序号。In a possible implementation manner, the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1≤k≤M- 1 and k and M are integers; for each type of message in the M type of message, the first code of each type of message is used to indicate the order-preserving interval to which the message belongs; where k= Under the condition of 1, the second code of the type 1 message is used to indicate the sequence number of the type 1 message in the message in the sequence preservation interval to which it belongs; under the condition of 2≤k≤M-1 Below, the second code of each k-th message includes a first number and a second number, and the first number is used to indicate that the k-th message belongs in the order-preserving interval to which the k-th message belongs. The number of type 1 messages to type k-1 messages before the message, where the second number is used to indicate the sequence number of the type k message in the message in the sequence preservation interval to which it belongs; For the M-th message, the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval. The number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
在一种可能的实施方式中,所述根据所述第一报文的编码确定是否执行所述第一报文包括:In a possible implementation manner, the determining whether to execute the first message according to the encoding of the first message includes:
若所述第一报文为所述第k类报文且k=1,则执行所述第一报文;若所述第一报文为所述第k类报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行所述第一报文,其中,所述第一目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第k-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文;若所述第一报文为第M类报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行所述第一报文,其中,所述第二目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第M-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文。If the first message is the k-th type message and k=1, execute the first message; if the first message is the k-th type message and 2≤k≤M -1, and it is determined that the execution of the first target message has been completed according to the first code, the first number, and the second number of the first message, then the first message is executed, where the first target message includes In the order-preserving interval to which the first message belongs, type 1 messages to type k-1 messages that are before the first message and the order-preserving interval to which the first message belongs Type 1 messages to type k-1 messages in the sequence interval; if the first message is a type M message, and according to the first code, first number, and second number of the first message If it is determined that the execution of the second target message has been completed, the first message is executed, wherein the second target message includes the sequence preserving interval to which the first message belongs and is located before the first message Type 1 messages to Type M-1 messages and Type 1 messages to Type M-1 messages that are located in the order-preserving interval before the order-preserving interval to which the first message belongs.
第三方面,提供了一种报文保序装置,包括:第一接收模块,用于接收第一报文,其中,所述第一报文为多个报文中的任意一个;编码模块,用于根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码以得到所述第一报文的编码;发送模块,用于向第二模块发送所述第一报文及其编码;其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。In a third aspect, a message sequence preserving device is provided, including: a first receiving module, configured to receive a first message, wherein the first message is any one of a plurality of messages; an encoding module, Is used to compare the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding to obtain the encoding of the first message; a sending module for sending the first message and its encoding to the second module; wherein the encoding of the first message is used to indicate the first message The execution relationship between the message and other messages in the plurality of messages.
在一种可能的实施方式中,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序。In a possible implementation, the multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations. A message and a second message, and the second message depends on the first message for order preservation.
在一种可能的实施方式中,所述编码模块包括:第一编码单元,用于若所述第一报文为第i组保序关系中的第一种报文或第二种报文,则为所述第一报文设置基于所述第i组保序关系的第一编码,其中,所述第一编码用于指示所述第一报文所属的基于所述第i组保序关系的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为所述第i组保序关系中的第二种报文切换为第一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;以及第二编码单元,用于若所述第一报文为第i组保序关系中的第二种报文,则为所述第一报文设置基于所述第i组保序关系的第二编码,其中,所述第二编码用于指示所述第一报文所属的基于第i组保序关系的保序区间内的第 一种报文的数量;其中,1≤i≤N且i为整数。In a possible implementation manner, the encoding module includes: a first encoding unit, configured to, if the first message is the first type of message or the second type of message in the i-th group of order-preserving relationship, Then, a first code based on the i-th group of order-preserving relations is set for the first message, where the first code is used to indicate the i-th group of order-preserving relations to which the first message belongs The sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is the second type of message in the i-th group of sequence-preserving relationship and switching to the first type of message The multiple messages are sorted according to the sending order of each of the multiple messages; and the second coding unit is used in the order-preserving relationship if the first message is the i-th group For the second type of message, a second code based on the i-th group of order-preserving relationship is set for the first message, where the second code is used to indicate the first message to which the first message belongs. The number of messages of the first type in the order-preserving interval of the i group of order-preserving relations; among them, 1≤i≤N and i is an integer.
在一种可能的实施方式中,所述N组保序关系中的每组保序关系均为直接保序关系;或者所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系。In a possible implementation manner, each of the N groups of order-preserving relations is a direct order-preserving relationship; or a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relationship, The other part of the order-preserving relationship is the indirect order-preserving relationship.
在一种可能的实施方式中,所述多个报文包括3种报文,分别为P报文、NP报文、CPL报文,所述多个报文包括2组保序关系,所述2组保序关系均为直接保序关系;其中,第一组直接保序关系中的第一种报文为P报文,第一组直接保序关系中的第二种报文为CPL报文;第二组直接保序关系中的第一种报文为P报文,第二组直接保序关系中的第二种报文为NP报文。In a possible implementation manner, the multiple messages include three types of messages, which are P messages, NP messages, and CPL messages, respectively, and the multiple messages include two sets of order-preserving relationships. The two groups of order-preserving relations are all direct order-preserving relations; among them, the first type of message in the first group of direct order-preserving relations is a P message, and the second type of message in the first group of direct order-preserving relations is a CPL message. The first type of message in the second group of direct preserving relations is a P message, and the second type of message in the second group of direct preserving relations is an NP message.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;所述编码模块包括:第一编码单元,用于为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文切换为所述第1类报文至第M-1类报文中的任意一类报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;第二编码单元,用于若所述第一报文为所述第k类报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第三编码单元,用于若所述第一报文为所述第k类报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第四编码单元,用于若所述第一报文为所述第M类报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。In a possible implementation manner, the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1≤k≤M- 1 and k and M are integers; the encoding module includes: a first encoding unit, configured to set a first encoding for the first message, and the first encoding is used to indicate to which the first message belongs Sequence-preserving interval, the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is the M-th type of message being switched to the first type of message to the M-1th type of message The node of any type of message, the plurality of messages are sorted according to the sending order of each message in the plurality of messages; the second coding unit is used to if the first message is the For the k-th message and k=1, a second code is set for the first message, where the second code is used to indicate the message of the first message in the order-preserving interval to which it belongs The sequence number in the; the third coding unit, used to set the second coding for the first message if the first message is the k-th message and 2≤k≤M-1, so The second code includes a first number and a second number, and the first number is used to indicate the type 1 message to the k-th message before the first message in the order-preserving interval to which the first message belongs. The number of type 1 messages, the second number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs; the fourth coding unit is used for If the message is the M-th message, a second code is set for the first message. The second code includes a first number and a second number, and the first number is used to indicate the first message. The number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the message belongs, and the second number is used to indicate the number of Type 1 messages to which the first message belongs. The sequence number of the message in the sequence interval.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系报文进行保序,1≤k≤M-1且k和M均为整数;In a possible implementation manner, the multiple messages include type M messages, and at least one type of messages in the M type messages includes multiple types of messages, and among them, the k+1 type messages A type of message directly depends on the order-preserving relationship between the k-th type of message and the order-preserving message, and a type of message in the k+1-th type of message indirectly depends on the type 1 message to the k-th type of message. In Type 1 messages, the order is preserved for the messages with the order-preserving relationship, 1≤k≤M-1 and both k and M are integers;
所述编码模块包括:第一编码单元,用于为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文中指定的一种报文或者任一种报文切换为第1类报文至第M-1类报文中指定的一种报文或者任一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;第二编码单元,用于若所述第一报文为所述第k类报文中的第s种报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第三编码单元,用于若所述第一报文为所述第k类报文中的第t种报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属 的保序区间内在所述第一报文之前的第1类报文至第k-1类报文中与其存在保序关系的报文数量;第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第四编码单元,用于若所述第一报文为所述第M类报文中的第q种报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文中与其存在保序关系的报文数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。The encoding module includes: a first encoding unit, configured to set a first encoding for the first message, where the first encoding is used to indicate the sequence-preserving interval to which the first message belongs, and the sequence-preserving interval The multiple messages are divided by a dividing node, and the dividing node is a message specified in the M-th type of message or any kind of messages is switched to a type 1 message to a type M-1 message A type of message or a node of any type of message specified in the text, the plurality of messages are sorted according to the sending order of each of the plurality of messages; the second coding unit is used for If the first message is the s-th message in the k-th message and k=1, then a second code is set for the first message, where the second code is used to indicate the The sequence number of the first message in the messages in the order-preserving interval to which it belongs; the third coding unit is used if the first message is the t-th message in the k-th message and 2≤k≤M-1, a second code is set for the first message, and the second code includes a first number and a second number, where the first number is used to indicate the first message The number of messages in the order-preserving interval to which the message belongs, from the first message to the k-1th message before the first message, which has a preserving relationship with it; the second number is used to indicate the first message The sequence number of the message in the message in the order-preserving interval to which it belongs; the fourth coding unit is used for if the first message is the qth message in the M-th message The first message is provided with a second code, and the second code includes a first number and a second number, wherein the first number is used to indicate that the first message belongs to the sequence preservation interval in the first message. The number of messages with order-preserving relationship between the first message to the M-1 class message before the message, and the second number is used to indicate that the first message is in the order-preserving interval to which it belongs The sequence number in the message.
在一种可能的实施方式中,所述多个报文包括2类报文,其中,第一类报文包括P报文,第二类报文包括NP报文和CPL报文,所述NP报文依赖于所述P报文进行保序,所述CPL报文依赖于所述P报文进行保序。In a possible implementation manner, the multiple messages include two types of messages, where the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages. The message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
第四方面,提供一种报文保序装置,包括:第二接收模块,用于接收第一模块发送的第一报文及其编码,其中所述第一报文为多个报文中的任意一个报文;确定模块,用于根据所述第一报文的编码确定是否执行所述第一报文;其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。In a fourth aspect, a message sequence preserving device is provided, including: a second receiving module, configured to receive a first message sent by the first module and its code, wherein the first message is one of a plurality of messages Any message; a determining module, configured to determine whether to execute the first message according to the encoding of the first message; wherein the encoding of the first message is used to indicate the relationship between the first message and the Describes the execution relationship of other messages in multiple messages.
在一种可能的实施方式中,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序;针对第i组保序关系,所述第i组保序关系中的第一种报文和第二种报文基于所述第i组保序关系的第一编码用于指示所述第一种报文和所述第二种报文所属的基于所述第i组保序关系的保序区间;针对第i组保序关系,所述第i组保序关系中的第二种报文基于所述第i组保序关系的第二编码用于指示所述第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量。In a possible implementation, the multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations. The second type of message and the second type of message, and the second type of message depends on the first type of message for order preservation; for the i-th group of order-preserving relations, the first group of the i-th group of order-preserving relations The first code of one type of message and the second type of message based on the i-th group of preserving relationship is used to indicate to which the first type of message and the second type of message belong based on the i-th group of preserving The order-preserving interval of the order relationship; for the i-th group of order-preserving relations, the second message in the i-th group of order-preserving relations is based on the second code of the i-th group of order-preserving relations to indicate the second The number of the first type of message in the i-th group of order-preserving relations in the order-preserving interval based on the i-th group of order-preserving relations to which this kind of message belongs.
在一种可能的实施方式中,在所述N组保序关系中的每组保序关系均为直接保序关系的条件下,所述确定模块包括:第一执行单元,用于若所述第一报文为第x组直接保序关系中的第一种报文,则执行所述第一报文;第二执行单元,用于若所述第一报文为第x组直接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文,其中,第一目标报文包括位于所述第一报文所属的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;其中,1≤x≤N,且x为整数。In a possible implementation manner, under the condition that each of the N groups of order-preserving relations is a direct order-preserving relationship, the determining module includes: a first execution unit, configured to: If the first message is the first message in the x-th group of direct order-preserving relations, the first message is executed; the second execution unit is configured to directly preserve the order if the first message is the x-th group For the second type of message in the relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the x-th group of direct order-preserving relationship, the first target message is executed. A message, wherein the first target message includes the first type of message in the x-th group of direct sequence preserving relationships located in the sequence preserving interval to which the first message belongs and the The first type of message in the x-th group of direct order-preserving relations in the order-preserving interval before the order-preserving interval; among them, 1≤x≤N, and x is an integer.
在一种可能的实施方式中,在所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系的条件下,所述确定模块包括:第一执行单元,用于若所述第一报文仅为第x组直接保序关系中的第一种报文,或者若所述第一报文为第x组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第一种报文,则执行所述第一报文;第二执行单元,用于若所述第一报文仅为第x组直接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文;第三执行单元,用于若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第二种报文,或者若 所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第q组间接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据所述第一报文基于第q组间接保序关系的第一编码和第二编码确定第二目标报文均已执行完成时,执行所述第一报文;其中,第一目标报文包括位于所述第一报文所属的基于第x组直接保序关系的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的基于第x组直接保序关系的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;第二目标报文包括位于所述第一报文所属的基于第q组间接保序关系的保序区间内的第q组间接保序关系中的第一种报文和位于所述第一报文所属的基于第q组间接保序关系的保序区间之前的保序区间内的第q组间接保序关系中的第一种报文。In a possible implementation manner, under the condition that a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relation, and the other part of the order-preserving relations is an indirect order-preserving relation, the determining module includes: An execution unit, configured to: if the first message is only the first type of message in the x-th group of direct preserving relations, or if the first message is the first message in the x-th group of direct preserving relations If the first message is the first message in the q-th group of indirect order-preserving relationship, the first message is executed; the second execution unit is configured to: if the first message is only Is the second type of message in the x-th group of direct preserving relations, or if the first message is the second type of message in the x-th group of direct preserving relations and the first message is the jth group For the first type of message in the direct preserving relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the x-th group of direct preserving relationship, execute The first message; a third execution unit, configured to if the first message is the second type of message in the x-th group of direct sequence preservation relations and the first message is the j-th group of direct sequence preservation The first message in the relationship and the first message is the second message in the q-th group of indirect order-preserving relations, or if the first message is the first message in the x-th group of direct order-preserving relations Two types of messages and the first message is the second type of message in the q-th group of indirect order-preserving relations, then according to the first message based on the first code and the first code of the x-th group of direct order-preserving relations When the second code determines that the first target message has been executed, and according to the first message based on the first code and the second code of the q-th group of indirect order-preserving relationship, it is determined that the second target message has been executed. The first message; wherein, the first target message includes the first type of the x-th group of direct order-preserving relations located in the x-th group of direct-order preserving interval to which the first message belongs The message and the first type of message in the x-th group of direct order-preserving relationship located in the preserving interval based on the x-th group of direct-order preserving interval to which the first message belongs; the second target message The message includes the first message in the q-th group of indirect order-preserving relations in the q-th group of indirect order-preserving interval to which the first message belongs, and the first message in the q-th group of indirect order-preserving relations to which the first message belongs. The first message in the q-th group of indirect order-preserving relations in the order-preserving interval before the order-preserving interval of the q-th group of indirect order-preserving relations.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;针对所述M类报文中的每类报文,所述每类报文的第一编码均用于指示所述报文所属的保序区间;在k=1的条件下,第1类报文的第二编码用于指示所述第1类报文在其所属的保序区间内的报文中的排列序号;在2≤k≤M-1的条件下,每个第k类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第k类报文所属的保序区间内在所述第k类报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第k类报文在其所属的保序区间内的报文中的排列序号;针对第M类报文,所述第M类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第M类报文所属的保序区间内在所述第M类报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第M类报文在其所属的保序区间内的报文中的排列序号。In a possible implementation manner, the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1≤k≤M- 1 and k and M are integers; for each type of message in the M type of message, the first code of each type of message is used to indicate the order-preserving interval to which the message belongs; where k= Under the condition of 1, the second code of the type 1 message is used to indicate the sequence number of the type 1 message in the message in the sequence preservation interval to which it belongs; under the condition of 2≤k≤M-1 Below, the second code of each k-th message includes a first number and a second number, and the first number is used to indicate that the k-th message belongs in the order-preserving interval to which the k-th message belongs. The number of type 1 messages to type k-1 messages before the message, where the second number is used to indicate the sequence number of the type k message in the message in the sequence preservation interval to which it belongs; For the M-th message, the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval. The number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
在一种可能的实施方式中,所述确定模块包括:第一执行单元,用于若所述第一报文为所述第k类报文且k=1,则执行所述第一报文;第二执行单元,用于若所述第一报文为所述第k类报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行所述第一报文,其中,所述第一目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第k-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文;第三执行单元,用于若所述第一报文为第M类报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行所述第一报文,其中,所述第二目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第M-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文。In a possible implementation manner, the determining module includes: a first executing unit, configured to execute the first message if the first message is the k-th message and k=1 ; A second execution unit, for if the first message is the k-th message and 2≤k≤M-1, and according to the first code, first number, and second number of the first message If it is determined that the execution of the first target message has been completed, the first message is executed, where the first target message includes the data in the sequence preserving interval to which the first message belongs and located before the first message Type 1 messages to type k-1 messages, and type 1 messages to type k-1 messages in the order-preserving interval before the order-preserving interval to which the first message belongs; third execution Unit, configured to execute said first message if said first message is an M-th message, and according to the first code, first number, and second number of the first message, it is determined that the execution of the second target message has been completed. The first message, wherein the second target message includes the type 1 message to the M-1 type message that are located before the first message in the sequence preservation interval to which the first message belongs, and Type 1 messages to Type M-1 messages in the order preserving interval before the order preserving interval to which the first message belongs.
第五方面,提供了一种计算机可读存储介质,包括计算机程序,所述计算机程序在计算机上被执行时,使得所述计算机执行第一方面中任一项所述的方法或者第二方面中任一项所述方法。In a fifth aspect, a computer-readable storage medium is provided, including a computer program, which when executed on a computer, causes the computer to execute the method described in any one of the first aspect or the second aspect Any of the methods described.
第六方面,提供了一种计算机程序,当所述计算机程序被计算机执行时,用于执行第一方面中任一项所述的方法或者第二方面中任一项所述方法。In a sixth aspect, a computer program is provided, when the computer program is executed by a computer, it is used to execute the method described in any one of the first aspect or the method described in any one of the second aspect.
第七方面,提供了一种芯片,包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于调用并运行所述存储器中存储的计算机程序,以执行第一方面中任一项所 述的方法或者第二方面中任一项所述方法。In a seventh aspect, a chip is provided, including a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute any one of the first aspect The method described in item 1 or the method described in any one of the second aspect.
附图说明Description of the drawings
图1为本申请实施例提供的一种报文保序方法的流程示意图;FIG. 1 is a schematic flowchart of a method for preserving message sequence provided by an embodiment of this application;
图2示出了对多个报文进行编码的示意图一;Figure 2 shows the first schematic diagram of encoding multiple messages;
图3示出了对多个报文进行编码的示意图二;Figure 3 shows the second schematic diagram of encoding multiple messages;
图4示出了对多个报文进行编码的示意图三;Figure 4 shows the third schematic diagram of encoding multiple messages;
图5示出了对多个报文进行编码的示意图四;Figure 5 shows a fourth schematic diagram of encoding multiple messages;
图6示出了对多个报文进行编码的示意图五;Figure 6 shows a fifth schematic diagram of encoding multiple messages;
图7示出了对多个报文进行编码的示意图六;Figure 7 shows a sixth schematic diagram of encoding multiple messages;
图8示出了对多个报文进行编码的示意图七;Figure 8 shows a seventh schematic diagram of encoding multiple messages;
图9示出了一种基于SOC芯片的数据传输系统的结构示意图;Figure 9 shows a schematic structural diagram of a data transmission system based on an SOC chip;
图10示出了对多个报文进行编码的示意图八;Figure 10 shows the eighth schematic diagram of encoding multiple messages;
图11示出了对多个报文进行编码的示意图九;Figure 11 shows a schematic diagram 9 of encoding multiple messages;
图12为本申请实施例提供的一种报文保序装置的结构示意图一;FIG. 12 is a first structural diagram of a message sequence device provided by an embodiment of this application;
图13为本申请实施例提供的一种报文保序装置的结构示意图二。FIG. 13 is a second structural diagram of a message sequence preserving apparatus provided by an embodiment of the application.
具体实施方式Detailed ways
下面将结合附图,对本申请中的技术方案进行描述。The technical solution in this application will be described below in conjunction with the accompanying drawings.
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请中的附图,对本申请中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be described clearly and completely in conjunction with the accompanying drawings in this application. Obviously, the described embodiments are part of the embodiments of this application. , Not all examples. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
本申请的说明书实施例和权利要求书及附图中的术语“第一”、“第二”等仅用于区分描述的目的,而不能理解为指示或暗示相对重要性,也不能理解为指示或暗示顺序。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元。方法、系统、产品或设备不必限于清楚地列出的那哪些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。The terms "first", "second", etc. in the specification embodiments, claims, and drawings of this application are only used for the purpose of distinguishing description, and cannot be understood as indicating or implying relative importance, nor can it be understood as indicating Or imply the order. In addition, the terms "including" and "having" and any variations of them are intended to cover non-exclusive inclusions, for example, including a series of steps or units. The method, system, product, or device is not necessarily limited to those clearly listed steps or units, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products, or devices.
应当理解,在本申请中,“至少一个(项)”是指一个或者多个,“多个”是指两个或两个以上。“和/或”,用于描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:只存在A,只存在B以及同时存在A和B三种情况,其中A,B可以是单数或者复数。字符“/”一般表示前后关联对象是一种“或”的关系。“以下至少一项(个)”或其类似表达,是指这些项中的任意组合,包括单项(个)或复数项(个)的任意组合。例如,a,b或c中的至少一项(个),可以表示:a,b,c,“a和b”,“a和c”,“b和c”,或“a和b和c”,其中a,b,c可以是单个,也可以是多个。It should be understood that in this application, "at least one (item)" refers to one or more, and "multiple" refers to two or more. "And/or" is used to describe the association relationship of associated objects, indicating that there can be three types of relationships, for example, "A and/or B" can mean: only A, only B, and both A and B , Where A and B can be singular or plural. The character "/" generally indicates that the associated objects before and after are in an "or" relationship. "The following at least one item (a)" or similar expressions refers to any combination of these items, including any combination of a single item (a) or a plurality of items (a). For example, at least one of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c" ", where a, b, and c can be single or multiple.
图1为本申请实施例提供的一种报文保序方法的流程示意图,如图1所示,报文保序方法可以包括以下步骤:Fig. 1 is a schematic flow chart of a method for preserving message sequence provided by an embodiment of the application. As shown in Fig. 1, the method for preserving message sequence may include the following steps:
步骤101、第一模块接收第一报文,其中,第一报文为多个报文中的任意一个。Step 101: The first module receives a first message, where the first message is any one of a plurality of messages.
在本申请实施例中,若报文发送模块将多个报文发送至第一模块,则报文发送模块需按照多个报文中的每个报文的发送顺序对每个报文进行排序,以及按序将多个报文中的每个报文发送至第一模块。In the embodiment of this application, if the message sending module sends multiple messages to the first module, the message sending module needs to sort each message according to the sending order of each of the multiple messages , And send each of the multiple messages to the first module in sequence.
具体的,报文发送模块发送多个报文中的每个报文的过程包括:报文发送模块按照多个报文的排列顺序,将排在第一位的报文确定为第一报文,并向第一模块发送第一报文(即排在第一位的报文),在报文发送模块发送完第一报文(即排在第一位的报文)后,将排在第二位的报文确定为第一报文,并向第一模块发送该第一报文(即排在第二位的报文),报文发送模块重复上述过程,将多个报文中的每个报文按照发送顺序发送至第一模块。第一模块按照报文发送模块的发送顺序依次接收第一报文。Specifically, the process of the message sending module sending each of the multiple messages includes: the message sending module determines the first message as the first message according to the sequence of the multiple messages. , And send the first message (that is, the first message) to the first module. After the message sending module finishes sending the first message (that is, the first message), it will be ranked The second message is determined to be the first message, and the first message (that is, the message ranked second) is sent to the first module, and the message sending module repeats the above process, combining multiple messages Each message of is sent to the first module in the order of sending. The first module sequentially receives the first message according to the sending order of the message sending module.
多个报文中的报文(包括第一报文)的种类可以根据数据传输协议确定,以及不同种类的报文之间的保序关系也可根据数据传输协议确定。具体的,根据数据传输协议可以确定多种报文中具体包括几组保序关系,以及每组保序关系中的第一种报文和第二种报文具体是那种报文。The types of the messages (including the first message) in the multiple messages can be determined according to the data transmission protocol, and the order-preserving relationship between different types of messages can also be determined according to the data transmission protocol. Specifically, according to the data transmission protocol, it can be determined that the multiple types of messages specifically include several groups of order-preserving relations, and the specific types of messages of the first type of message and the second type of message in each group of order-preserving relations.
需要说明的是,每组保序关系均包括第一种报文和第二种报文,每组保序关系中的第二种报文依赖于对应保序关系中的第一种报文进行保序。第二种报文依赖于第一种报文进行保序可以理解为:第二种报文的执行依赖于第一种报文的执行,第一种报文的执行不依赖于第二种报文的执行,换言之,在排在第二种报文之前的第一种报文均执行完成后,方可执行第二种报文,而第一种报文的执行不受第二种报文的执行的限制。It should be noted that each group of order-preserving relations includes the first type of message and the second type of message. Guarantee order. The second kind of message depends on the first kind of message for order preservation, which can be understood as: the execution of the second kind of message depends on the execution of the first kind of message, and the execution of the first kind of message does not depend on the second kind of message. The execution of the text, in other words, the second type of message can be executed only after the execution of the first type of message before the second type of message is completed, and the execution of the first type of message is not affected by the second type of message Restrictions on implementation.
保序关系可以包括直接保序关系和间接保序关系。具体的,直接保序关系和间接保序关系的理解如下:Order-preserving relationships can include direct-order-preserving relationships and indirect-order-preserving relationships. Specifically, the understanding of the direct order-preserving relationship and the indirect order-preserving relationship is as follows:
若多种报文对应多组保序关系,则确定多种报文的优先级的过程包括:若一种报文在其所属的所有保序关系中均为第一种报文,则该种报文为优先级最高的报文,根据上述过程,在多种报文中筛选出优先级最高的报文,并将优先级最高的报文划分为第一类报文,然后,将仅依赖于第一类报文中的报文进行保序的报文确定为优先级仅低于第一类报文的报文,将优先级仅低于第一类报文的报文划分为第二类报文,第二类报文的优先级仅低于第一类报文;再然后,将仅依赖于第一类报文中的报文和第二类报文中的报文进行保序的报文确定为优先级仅低于第一类报文和第二类报文的报文,以及将优先级仅低于第一类报文和第二类报文的报文划分为第三类报文,依次类推,确定其他各种报文的优先级和所属的类。由上可知,根据多种报文的保序关系可将多种报文被划分为M类报文,其中,第一类报文至第M类报文的优先级依次降低,以及每类报文包括至少一种报文。If multiple types of messages correspond to multiple groups of order-preserving relationships, the process of determining the priority of multiple types of messages includes: The message is the message with the highest priority. According to the above process, the message with the highest priority is selected from the various messages, and the message with the highest priority is classified as the first type of message, and then it will only rely on The order of the messages in the first class of messages is determined to be the messages whose priority is only lower than that of the first class of messages, and the messages whose priority is only lower than the first class of messages are classified as the second Class 2 messages, the priority of the second class messages is only lower than that of the first class messages; then, it will only rely on the messages in the first class messages and the messages in the second class messages for order preservation The message is determined as a message with a priority lower than only the first type of message and the second type of message, and the message with a priority only lower than the first type of message and the second type of message is classified as the third Class messages, and so on, determine the priority of other kinds of messages and the class they belong to. It can be seen from the above that according to the order-preserving relationship of multiple types of messages, various types of messages can be divided into M types of messages. Among them, the priority of the first type to the M-th type of The text includes at least one type of message.
基于此,若保序关系中的两种报文的优先级相邻,则该保序关系为直接保序关系,若保序关系中的两种报文的优先级不相邻,则该保序关系为间接保序关系,即第k+1类报文中的报文与第k类报文中与其存在保序关系的报文组成的保序关系为直接保序关系,第k+1类报文中的报文与第1类报文至第k-1类报文中与其存在保序关系的报文组成的保序关系为间接保序关系,以及第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系的报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系的报文进行保序,1≤k≤M-1。Based on this, if the priorities of the two types of messages in the order-preserving relationship are adjacent, the order-preserving relationship is a direct order-preserving relationship, and if the priorities of the two messages in the order-preserving relationship are not adjacent, then the order-preserving relationship is not adjacent. The order relationship is an indirect order-preserving relationship, that is, the order-preserving relationship composed of messages in the k+1 type message and the messages with which the order-preserving relationship exists in the k-th message is a direct order-preserving relationship. The order-preserving relationship between the messages in the class 1 message and the messages with the order-preserving relationship between the class 1 message and the class k-1 message is an indirect order-preserving relationship, and in the class k+1 message A type of message directly relies on the messages in the k-th type of message that has an order-preserving relationship with it for order preservation, and a type of message in the k+1 type of messages indirectly depends on the type 1 message to the k-th message Among the -1 messages, the messages with the order-preserving relationship are preserved, and 1≤k≤M-1.
例如,有六种报文,分别为报文A、报文F、报文B、报文C、报文D、报文E,其中,六种报文总共包括6组保序关系,分别为:报文A和报文B为一组保序关系,其中 报文B依赖于报文A进行保序;报文F和报文C为一组保序关系,其中报文C依赖于报文F进行保序;报文B和报文D为一组保序关系,其中,报文D依赖于报文B进行保序;报文C和报文E为一组保序关系,其中,报文E依赖于报文C进行保序;报文A和报文D为一组保序关系,其中,报文D依赖于报文A进行保序;报文F和报文E为一组保序关系,其中,报文E依赖于报文F进行保序。基于此并结合上述原理,第一类报文包括报文A和报文F,第二类报文包括报文B和报文C,第三类报文包括报文D和报文E。其中,第一类报文的优先级最高,第二类报文的优先级次之,第三类报文的优先级最低,以及,报文A和报文B为一组直接保序关系,报文F和报文C为一组直接保序关系,报文B和报文D为一组直接保序关系,报文C和报文E为一组直接保序关系,报文A和报文D为一组间接保序关系,报文F和报文E为一组间接保序关系。For example, there are six types of messages, namely, message A, message F, message B, message C, message D, and message E. Among them, the six types of messages include a total of 6 groups of order-preserving relationships, which are: : Message A and Message B are a set of order-preserving relations, among which message B depends on message A for order-preserving; message F and message C are a set of order-preserving relations, among which message C depends on the message F is a sequence-preserving relationship; message B and message D are a set of sequence-preserving relationships, among which message D depends on message B for sequence-preserving; message C and message E are a set of sequence-preserving relationships, among which, Message E depends on message C for sequence preservation; message A and message D are a set of sequence preservation relationships, among which message D depends on message A for sequence preservation; message F and message E are a group of sequence preservation relationships. Sequence relationship, where message E depends on message F for sequence preservation. Based on this and combining the foregoing principles, the first type of messages includes message A and message F, the second type of messages includes message B and message C, and the third type of messages includes message D and message E. Among them, the first type of message has the highest priority, the second type of message has the second priority, and the third type of message has the lowest priority, and the message A and the message B are a set of direct order-preserving relationships. Message F and Message C are a set of direct order-preserving relationships, Message B and Message D are a set of direct-preserving relationships, Message C and Message E are a set of direct-preserving relationships, Message A and Text D is a group of indirect order-preserving relations, and messages F and E are a group of indirect order-preserving relations.
需要说明的是,报文B和报文F、报文A和报文C均为优先级相邻的报文,但是由于上述两种组合不存在保序关系,因此不能构成直接保序关系,报文A和报文E、报文F和报文D虽然均为优先级不相邻的报文,但是由于上述两种组合不存在保序关系,因此不能构成间接保序关系。It should be noted that message B and message F, message A and message C are all messages with adjacent priorities. However, because the above two combinations do not have a preserving relationship, they cannot form a direct preserving relationship. Although message A and message E, message F and message D are all messages with non-adjacent priorities, since the above two combinations do not have an order-preserving relationship, they cannot form an indirect order-preserving relationship.
再例如,在基于PCIe的数据传输协议中,报文的种类包括P报文、CPL报文、NP报文;其中,P报文和CPL报文为一组保序关系,且CPL报文依赖于P报文进行保序,即P报文的执行不受CPL报文执行的限制,CPL报文的执行受P报文执行的限制,换言之,排在CPL报文之前的P报文均执行完成后,才可执行CPL报文,而P报文无条件执行;P报文和NP报文为一组保序关系,且NP报文依赖于P报文进行保序,即P报文的执行不受NP报文执行的限制,NP报文的执行受P报文执行的限制,换言之,排在NP报文之前的P报文均执行完成后,才可执行NP报文,而P报文无条件执行。基于此,在基于PCIe的数据传输协议中,可以得到两类报文,其中第一类报文包括P报文,第二类报文包括CPL报文和NP报文,第一类报文的优先级高于第二类报文的优先级,以及P报文和CPL报文为一组直接保序关系,P报文和NP报文为一组直接保序关系。For another example, in the PCIe-based data transmission protocol, the types of messages include P messages, CPL messages, and NP messages; among them, P messages and CPL messages are a set of order-preserving relationships, and CPL messages depend on The order of P messages is preserved, that is, the execution of P messages is not restricted by the execution of CPL messages, and the execution of CPL messages is restricted by the execution of P messages. In other words, the P messages that precede the CPL message are all executed. After completion, the CPL message can be executed, and the P message is executed unconditionally; the P message and the NP message are a set of sequence preservation relationship, and the NP message depends on the P message for sequence preservation, that is, the execution of the P message It is not restricted by the execution of NP messages. The execution of NP messages is restricted by the execution of P messages. In other words, NP messages can be executed only after the execution of P messages before NP messages. Unconditional execution. Based on this, in the PCIe-based data transmission protocol, two types of messages can be obtained. The first type of messages includes P messages, the second type of messages includes CPL messages and NP messages, and the first type of messages The priority is higher than the priority of the second type of message, and the P message and the CPL message are a set of direct order-preserving relations, and the P message and the NP message are a set of direct order-preserving relations.
第一模块可以为数据传输系统中的模块,例如,在向数据传输系统输入报文的方向上,第一模块可以为数据传输系统中数据输入的起始模块;在数据传输系统输出报文的方向上,第一模块可以为数据传输系统中数据输出的起始模块,此处不作特殊限定。The first module may be a module in the data transmission system. For example, in the direction of inputting messages to the data transmission system, the first module may be the initial module of data input in the data transmission system; In the direction, the first module can be the initial module of data output in the data transmission system, and there is no special limitation here.
步骤102、第一模块根据第一报文在多个报文中的发送顺序和第一报文与多个报文中的其他报文的保序关系对第一报文进行编码以得到第一报文的编码,其中,第一报文的编码用于指示第一报文与多个报文中的其他报文的执行关系。Step 102: The first module encodes the first message according to the transmission sequence of the first message in the multiple messages and the order-preserving relationship between the first message and other messages in the multiple messages to obtain the first message. The encoding of the message, where the encoding of the first message is used to indicate the execution relationship between the first message and other messages among the multiple messages.
在本申请实施例中,第一报文与多个报文中的其他报文的执行关系可以理解为在多个报文中排在第一报文之前且限制第一报文执行的报文的信息。In the embodiment of this application, the execution relationship between the first message and other messages in the multiple messages can be understood as a message that is ranked before the first message among the multiple messages and restricts the execution of the first message Information.
下面,将通过以下两种方式对第一报文的编码方式进行说明,其中:Below, the encoding method of the first message will be described in the following two ways, among which:
方式一:在多个报文包括N组保序关系,1≤N且N为整数,该N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且每组保序关系中的第二种报文依赖于对应的第一种报文进行保序的条件下,对第一报文进行编码的步骤包括:Method 1: Multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, each group of order-preserving relations in the N groups of order-preserving relations includes the first type of message and the second type of message. And under the condition that the second type of message in each group of order-preserving relationship depends on the corresponding first type of message for order-preserving, the steps of encoding the first message include:
若第一报文为第i组保序关系中的第一种报文或第二种报文,则为第一报文设置基于第i组保序关系的第一编码,其中,第一报文的第一编码用于指示第一报文所属的基于第i组保序关系的保序区间,该保序区间由划分节点对多个报文划分得到,该划分节点为第 i组保序关系中的第二种报文切换为第一种报文的节点,上述多个报文按照多个报文中的每个报文的发送顺序排序;若第一报文为第i组保序关系中的第二种报文,则为第一报文设置基于第i组保序关系的第二编码,其中,第一报文的第二编码用于指示第一报文所属的基于第i组保序关系的保序区间内的第一种报文(即第i组保序关系中的第一种报文)的数量,其中,1≤i≤N且i为整数,i的取值的数量为至少一个。If the first message is the first message or the second message in the i-th group of order-preserving relations, set the first code based on the i-th group of order-preserving relations for the first message, where the first message The first code of the message is used to indicate the order-preserving interval based on the i-th group of order-preserving relationship to which the first message belongs. The second type of message in the relationship is switched to the node of the first type of message, and the above multiple messages are sorted according to the sending order of each of the multiple messages; if the first message is the i-th group, the order is preserved For the second type of message in the relationship, a second code based on the i-th group of order-preserving relationship is set for the first message, where the second code of the first message is used to indicate the i-th based The number of messages of the first type in the order-preserving interval of the group order-preserving relationship (that is, the first type of message in the i-th group order-preserving relationship), where 1≤i≤N and i is an integer, and the value of i The number is at least one.
基于上述步骤,对多个报文中的每个报文进行编码的整体思路可以理解为:首先,确定多个报文中总共包括几种报文、几组保序关系、每组保序关系中的第一种报文和第二种报文,其中,每组保序关系中的第二种报文依赖于对应保序关系中的第一种报文进行保序;然后,基于每组保序关系分别对多个报文中对应保序关系中的第一种报文和第二种报文进行编码,具体的,基于一组保序关系,对多个报文中的该组保序关系中的第一种报文和第二种报文进行编码的过程包括:以该组保序关系中的第二种报文切换为其中的第一种报文的节点为划分节点,对多个报文进行划分,以得到基于该组保序关系的至少一个保序区间,其中,多个报文按照多个报文中的每个报文的发送顺序排序;为多个报文中的每个第一种报文(该组保序关系中的第一种报文)和第二种报文(该组保序关系中的第二种报文)设置第一编码,其中,多个报文中的第一种报文和第二种报文的第一编码均用于指示该第一种报文和第二种报文所属的保序区间(即基于该组保序关系的保序区间),即多个报文中位于同一个保序区间内的每个第一种报文和每个第二种报文的第一编码均相同,以及为多个报文中的每个第二种报文(该组保序关系中的第二种报文)设置第二编码,多个报文中的第二种报文的第二编码用于指示第二种报文所属的保序区间(即基于该组保序关系的保序区间)内的第一种报文(该组保序关系中的第一种报文)的数量,换言之,多个报文中的第二种报文的第二编码用于指示第一编码与第二种报文的第一编码相同的第一种报文(即该组保序关系中的第一种报文)的数量。由上可知,基于该组保序关系中的第一种报文的编码仅包括第一编码,基于该组保序关系中的第二种报文的编码包括第一编码和第二编码。需要说明的是,基于该组保序关系为多个报文中的该组保序关系中的第一种报文和第二种报文设置的编码均与该组保序关系对应;对于其他各组保序关系中的第一种报文和第二种报文,重复上述过程,即可基于其他各组保序关系得到多个报文中对应保序关系中的第一种报文和第二种报文的编码。Based on the above steps, the overall idea of encoding each of the multiple messages can be understood as follows: First, determine that the multiple messages include a total of several types of messages, several groups of order-preserving relations, and each group of order-preserving relations The first type of message and the second type of message in each group of order-preserving relationship depend on the first type of message in the corresponding order-preserving relationship for order-preserving; then, based on each group The order-preserving relationship encodes the first message and the second message in the corresponding order-preserving relationship among multiple messages. Specifically, based on a set of order-preserving relationships, the group of multiple messages is protected. The process of encoding the first type of message and the second type of message in the order relationship includes: switching the second type of message in the group of order-preserving relations to the node of the first type of message as the division node, and Multiple messages are divided to obtain at least one sequence-preserving interval based on the group sequence-preserving relationship, where the multiple messages are sorted according to the sending order of each of the multiple messages; among the multiple messages The first code is set for each of the first type of message (the first type of message in the group of order-preserving relations) and the second type of message (the second type of message in the group of order-preserving relations), where more The first code of the first type of message and the second type of message in each message is used to indicate the order-preserving interval to which the first type of message and the second type of message belong (that is, the order-preserving relationship based on the group Sequence-preserving interval), that is, the first code of each first-type message and every second-type message in the same sequence-preserving interval in multiple messages is the same, and the first code is the same for each of the multiple messages. A second type of message (the second type of message in the order-preserving relationship of the group) is set with a second code, and the second code of the second type of message among multiple messages is used to indicate to which the second type of message belongs The number of messages of the first type (the first type of message in the group of order-preserving relations) in the order-preserving interval (that is, the order-preserving interval based on the group of order-preserving relations), in other words, the number of messages of the second type among the plurality of messages The second code of this type of message is used to indicate the number of the first type of message (that is, the first type of message in the group of order-preserving relations) whose first code is the same as the first code of the second type of message. It can be seen from the above that the encoding based on the first type of message in the group of order-preserving relations includes only the first code, and the encoding of the second type of message based on the group of order-preserving relations includes the first code and the second code. It should be noted that, based on the order-preserving relationship of the group, the codes set for the first type of message and the second type of the order-preserving relationship in the group of multiple messages correspond to the order-preserving relationship of the group; for other Repeat the above process for the first message and the second message in each group of order-preserving relations, and then based on the other groups of order-preserving relations, you can get the first message and the first type of message in the corresponding order-preserving relations among multiple messages. The second type of message encoding.
需要说明的是,上述N组保序关系中的每组保序关系均为直接保序关系,或者上述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系。上述针对每组保序关系的编码过程均适用于直接保序关系和间接保序关系。It should be noted that each of the above N groups of preserving relations is a direct preserving relationship, or some of the above N groups of preserving relations are direct preserving relations, and the other part of the above preserving relations is Indirect order-preserving relationship. The above coding process for each set of order-preserving relations is applicable to direct order-preserving relations and indirect order-preserving relations.
下面,将举例对上述过程进行说明。Hereinafter, the above process will be explained with an example.
例如,图2示出了对多个报文进行编码的示意图一,图3示出了对多个报文进行编码的示意图二,图4示出了对多个报文进行编码的示意图三。如图2至图4所示,多个报文中总共包括五种报文,分别为报文A、报文B、报文C、报文D以及报文E,多个报文中总共包括四组直接保序关系和两组间接保序关系,其中,第一组直接保序关系包括报文A和报文B,报文B直接依赖于报文A进行保序,即报文A为第一组直接保序关系中的第一种报文,报文B为第一组直接保序关系中的第二种报文;第二组直接保序关系包括报文A和报文C,其中,报文C直接依赖于报文A进行保序,即报文A为第二组直接保序关系中的第一种报文,报文C为第二组直接保序关系中的第二种报文;第三组直接保序关系 包括报文B和报文D,其中,报文D直接依赖于报文B进行保序,即报文B为第三组直接保序关系中的第一种报文,报文D为第三组直接保序关系中的第二种报文;第四组直接保序关系包括报文C和报文E,其中,报文E直接依赖于报文C进行保序,即报文C为第四组直接保序关系中的第一种报文,报文E为第四组直接保序关系中的第二种报文;第一组间接保序关系包括报文A和报文D,其中,报文D间接依赖于报文A进行保序,即报文D为第一组间接保序关系中的第二种报文,报文A为第一组间接保序关系中的第一种报文;第二组间接保序关系包括报文A和报文E,其中,报文E间接依赖于报文A进行保序,即报文E为第二组间接保序关系中的第二种报文,报文A为第二组间接保序关系中的第一种报文。For example, FIG. 2 shows a schematic diagram 1 of encoding multiple messages, FIG. 3 shows a schematic diagram 2 of encoding multiple messages, and FIG. 4 shows a schematic diagram 3 of encoding multiple messages. As shown in Figures 2 to 4, the multiple messages include a total of five types of messages, namely, message A, message B, message C, message D, and message E. The multiple messages include a total of Four groups of direct order-preserving relations and two groups of indirect order-preserving relations. Among them, the first group of direct order-preserving relations includes message A and message B. Message B directly depends on message A for order-preserving, that is, message A is The first type of message in the first group of direct order-preserving relations, and message B is the second type of message in the first group of direct order-preserving relations; the second group of direct order-preserving relations includes message A and message C, Among them, message C directly depends on message A for order preservation, that is, message A is the first message in the second group of direct order preservation relations, and message C is the second message in the second group of direct order preservation relations. A kind of message; the third group of direct preserving relations includes message B and message D, among which, message D directly depends on message B for preserving, that is, message B is the third group of direct preserving relations A kind of message, message D is the second message in the third group of direct order-preserving relations; the fourth group of direct-order preserving relations includes message C and message E, among which, message E directly depends on the message C performs order preservation, that is, message C is the first type of message in the fourth group of direct order preservation relations, and message E is the second type of message in the fourth group of direct order preservation relations; the first group of indirect order preservation relations The relationship includes message A and message D. Message D indirectly depends on message A for order preservation, that is, message D is the second type of message in the first group of indirect order preservation relations, and message A is the first group of messages. The first message in a group of indirect order-preserving relations; the second group of indirect order-preserving relations includes message A and message E, among which, message E indirectly depends on message A for order preservation, that is, message E is The second type of message in the second group of indirect order-preserving relations, and message A is the first type of message in the second group of indirect order-preserving relations.
需要说明的是,多个报文所包括的报文的种类和保序关系的组数以及每组保序关系中的第一种报文和第二种报文可以由报文发送模块确定并发送至第一模块,还可以由第一模块根据数据传输协议确定,此处不作特殊限定。It should be noted that the types of messages included in multiple messages, the number of groups of order-preserving relations, and the first and second types of messages in each group of order-preserving relations can be determined and combined by the message sending module. Sending to the first module can also be determined by the first module according to the data transmission protocol, and there is no special limitation here.
在此基础上,基于第一组直接保序关系对多个报文中的每个报文A和每个报文B进行编码,具体的,在多个报文中以报文B切换为报文A的节点作为划分节点对多个报文进行划分,即在多个报文的排列顺序上,只要报文B后面出现报文A,就划分保序区间。如图2所示,基于第一组直接保序关系对多个报文划分后,得到三个保序区间,分别为基于第一组直接保序关系的第一保序区间至第三保序区间;基于第一组直接保序关系的三个保序区间为多个报文中的报文A和报文B设置第一编码,由于第一编码用于指示报文A和报文B所属的保序区间,因此,可以为基于第一组直接保序关系的每个保序区间设置对应的编码,其中,第一保序区间的编码为0,第二保序区间的编码为1,第三保序区间的编码为2,将每个保序区间的编码设置为对应保序区间内的报文A和报文B的第一编码,即在同一个保序区间内的报文A和报文B的第一编码相同。基于第一组直接保序关系的三个保序区间为多个报文中的报文B设置第二编码,由于报文B的第二编码用于指示报文B所属的保序区间内的报文A的数量,因此,可以根据报文B所属的保序区间内的报文A的数量设置每个报文B的第二编码。由于报文A为第一组直接保序关系中的第一种报文,因此,报文A基于第一组直接保序关系的编码仅包括第一编码。由于报文B为第一组直接保序关系中的第二种报文,因此,报文B基于第一组直接保序关系的编码包括第一编码和第二编码。最终,基于第一组直接保序关系为多个报文中的每个报文A和报文B设置的编码如图2中的位于报文A和报文B之上的编码所示,其中,报文A和报文B的编码均表示在括号中,由于基于第一组直接保序关系,报文A仅包括第一编码,因此,报文A之上的括号内的数字为报文A的第一编码,由于基于第一组直接保序关系,报文B包括第一编码和第二编码,因此报文B的第一编码和第二编码用逗号隔开,位于逗号前面的为报文B的第一编码,位于逗号后面的为报文B的第二编码。On this basis, each message A and each message B in the multiple messages are coded based on the first set of direct order-preserving relations. Specifically, the message B is switched to the message among multiple messages. The node of message A is used as a dividing node to divide multiple messages, that is, in the sequence of multiple messages, as long as message A appears after message B, the order-preserving interval is divided. As shown in Figure 2, after dividing multiple messages based on the first set of direct preserving relations, three preserving intervals are obtained, which are the first preserving interval to the third preserving interval based on the first direct preserving relationship. Interval; the three order-preserving intervals based on the first group of direct order-preserving relationships set the first code for message A and message B in multiple messages, because the first code is used to indicate that message A and message B belong Therefore, a corresponding code can be set for each order-preserving interval based on the first set of direct order-preserving relations, where the code of the first order-preserving interval is 0, and the code of the second order-preserving interval is 1. The code of the third order-preserving interval is 2, and the code of each order-preserving interval is set to the first code of message A and message B in the corresponding order-preserving interval, that is, message A in the same order-preserving interval Same as the first code of message B. The three preserving intervals based on the first set of direct preserving relationships set the second code for the message B in multiple messages. Because the second code of the message B is used to indicate the preserving interval to which message B belongs The number of messages A, therefore, the second code of each message B can be set according to the number of messages A in the sequence preservation interval to which message B belongs. Since the message A is the first type of message in the first group of direct preserving relations, the code of the message A based on the first group of direct preserving relations only includes the first code. Since the message B is the second type of message in the first group of direct order-preserving relations, the codes of the message B based on the first group of direct preserving relations include the first code and the second code. Finally, based on the first set of direct order-preserving relationships, the codes set for each message A and message B in the multiple messages are as shown in the codes above message A and message B in Figure 2, where , The codes of message A and message B are both shown in brackets. Because of the direct order-preserving relationship based on the first group, message A only includes the first code. Therefore, the number in brackets above message A is the message The first code of A, because based on the first group of direct preserving relationship, message B includes the first code and the second code, so the first code and second code of message B are separated by a comma, and the one before the comma is The first code of message B, and the second code of message B after the comma.
同理,基于第二组直接保序关系为多个报文中的每个报文A和报文C设置的编码如图2中位于报文A和报文C之下的编码所示。In the same way, the codes set for each message A and message C in the multiple messages based on the second set of direct order-preserving relations are as shown in the codes under the message A and the message C in FIG. 2.
基于第三组直接保序关系为多个报文中的每个报文B和报文D设置的编码如图3中位于报文B和报文D之上的编码所示。The codes set for each message B and message D in the multiple messages based on the third set of direct order-preserving relations are as shown in FIG. 3, which is located above the message B and the message D.
基于第四组直接保序关系为多个报文中的每个报文C和报文E设置的编码如图3中位于报文C和报文E之下的编码所示。The codes set for each message C and message E in the multiple messages based on the fourth set of direct sequence preservation relations are as shown in the codes under the message C and the message E in FIG. 3.
基于第一组间接保序关系为多个报文中的每个报文A和报文D设置的编码如图4中位于报文A和报文D之上的编码所示。The codes set for each message A and message D in the multiple messages based on the first set of indirect order-preserving relationships are as shown in FIG. 4, which is located above the message A and the message D.
基于第二组间接保序关系为多个报文中的每个报文A和报文E设置的编码如图4中位于报文A和报文E之下的编码所示。The codes set for each message A and message E in the multiple messages based on the second set of indirect order-preserving relationships are as shown in the codes under the message A and the message E in FIG. 4.
由上可知,针对图2、图3和图4中所示的多个报文,需基于每组保序关系分别为对应保序关系中的第一种报文和第二种报文设置编码。若一个报文属于多组保序关系,则该报文的编码的数量与其所属的保序关系的数量相等,其中,可以通过每组保序关系的标识信息对该报文对应的编码进行标记,以根据编码的标记确定该报文的哪个编码对应哪组保序关系。It can be seen from the above that for the multiple messages shown in Figure 2, Figure 3 and Figure 4, it is necessary to set codes for the first and second types of messages in the corresponding order-preserving relationship based on each group of order-preserving relations. . If a message belongs to multiple groups of preserving relations, the number of codes of the message is equal to the number of preserving relations to which it belongs, and the code corresponding to the message can be marked by the identification information of each group of preserving relations , To determine which code of the message corresponds to which set of order-preserving relations according to the coded mark.
需要说明的是,在图2~图4中,多个报文中的每个报文后面的数字表示对应报文在多个报文中的发送顺序(即排列顺序)。It should be noted that in FIGS. 2 to 4, the number after each message in the multiple messages indicates the sending order (ie, the arrangement order) of the corresponding message in the multiple messages.
再例如,图5示出了对多个报文进行编码的示意图四,图6示出了对多个报文进行编码的示意图五,如图5和图6中所示,多个报文包括五种报文,该五种报文分别为报文A、报文B、报文C、报文D、报文E,且该五种报文包括三组直接保序关系,该三组直接保序关系分别为:报文A和报文B组成第一组直接保序关系,其中,报文B直接依赖于报文A进行保序,报文A和报文C组成第二组直接保序关系,其中,报文C直接依赖于报文A进行保序,报文D和报文E组成第三组直接保序关系,其中,报文E直接依赖于报文D进行保序。For another example, FIG. 5 shows schematic diagram four of encoding multiple messages, and FIG. 6 shows schematic diagram five of encoding multiple messages, as shown in FIG. 5 and FIG. 6, multiple messages include Five types of messages, the five types of messages are message A, message B, message C, message D, and message E, and the five types of messages include three groups of direct order-preserving relationships. The order-preserving relations are as follows: Message A and message B form the first group of direct order-preserving relations, among which, message B directly depends on message A for order-preserving, and message A and message C form the second group of direct order-preserving relations. In which, message C directly depends on message A for sequence preservation, message D and message E form a third group of direct sequence preservation relations, among which message E directly depends on message D for sequence preservation.
基于此并结合上述原理,基于第一组直接保序关系为多个报文中的每个报文A和报文B设置的编码如图5中位于报文A和报文B之上的编码所示。Based on this and combining the above principles, based on the first set of direct order-preserving relations, the encoding set for each of the multiple messages is message A and message B, as shown in the code located above message A and message B in Figure 5. Shown.
基于第二组直接保序关系为多个报文中的每个报文A和报文C设置的编码如图5中位于报文A和报文C之下的编码所示。The codes set for each message A and message C in the multiple messages based on the second set of direct order-preserving relations are as shown in the codes under the message A and the message C in FIG. 5.
基于第三组直接保序关系为多个报文中的每个报文D和报文E设置的编码如图6中位于报文D和报文E之上的编码所示。The codes set for each message D and message E in the plurality of messages based on the third set of direct order-preserving relations are as shown in the codes located above the message D and the message E in FIG. 6.
基于上述描述,第一模块对第一报文进行编码的过程可以包括以下两种,其中:Based on the foregoing description, the process of encoding the first message by the first module may include the following two types:
第一种,第一模块可以在接收完每个第一报文(即多个报文中的每个报文)后,按照每个第一报文的接收顺序对第一报文进行排序(即对多个报文进行排序);结合上述方式基于每组保序关系对排序后的每个第一报文进行编码。需要说明的是,由于第一报文是按照第一报文的发送顺序接收的,因此,按照第一报文的接收顺序对第一报文进行排序仍然保持了第一报文原有的顺序。In the first type, the first module can sort the first messages according to the order in which each first message is received after receiving each first message (that is, each message among multiple messages) ( That is, multiple messages are sorted); in combination with the above method, each first message after sorting is coded based on each group of order-preserving relations. It should be noted that, since the first message is received in the order in which the first message was sent, sorting the first message according to the order in which the first message was received still maintains the original order of the first message .
第二种,第一模块可以在每接收到一个第一报文时,对接收到的第一报文进行编码。具体的,第一模块接收到第一报文后,首先确定第一报文属于哪几组保序关系,并确定第一报文为其所属的每组保序关系中的哪种报文(即第一种报文还是第二种报文),然后,基于第一报文所属的每组保序关系,以及第一报文为其所属的每组保序关系中第一种报文或第二种报文,分别为该第一报文设置基于其所属的每组保序关系的编码。In the second type, the first module can encode the received first message every time a first message is received. Specifically, after receiving the first message, the first module first determines which group of order-preserving relationships the first message belongs to, and determines which message in each group of order-preserving relationships to which the first message belongs ( That is, the first message or the second message), then, based on each group of order-preserving relations to which the first message belongs, and the first message or the first message in each group of order-preserving relations to which the first message belongs. For the second message, the first message is respectively set with codes based on each group of order-preserving relations to which it belongs.
具体的,下面将以第一报文为第一组保序关系中的第一种报文为例对第一报文的编码过程进行说明,其中,第一组保序关系为第一报文所属的至少一组保序关系中的任一组保序关系。Specifically, the following will take the first message as the first type of message in the first group of order-preserving relations as an example to describe the encoding process of the first message, where the first group of order-preserving relations is the first message Any group of order-preserving relations in at least one group of order-preserving relations to which it belongs.
若第一模块在第一报文之前未接收到第一组保序关系中的第一种报文和第二种报文, 则将第一报文所属的保序区间确定为第一保序区间,并将第一报文的第一编码设置为0。If the first module does not receive the first type of message and the second type of message in the first group of order-preserving relations before the first message, the order-preserving interval to which the first message belongs is determined as the first order-preserving interval Interval, and set the first code of the first message to 0.
若第一模块在第一报文之前接收到第一组保序关系中的第一种报文和/或第二种报文,则若在第一报文之前最近一次接收到的第一组保序关系中的报文为第一组保序关系中的第一种报文,则将最近一次接收到的第一组保序关系中的第一种报文的第一编码确定为第一报文的第一编码,即最近一次接收到的第一组保序关系中的第一种报文与第一报文属于同一个保序区间;若在第一报文之前最近一次接收到的第一组保序关系中的报文为第一组保序关系中的第二种报文,则在最近一次接收到的第一组保序关系中的第二种报文的第一编码的基础上增加一(即在第一组保序关系中的第二种报文切换为第一种报文时进行保序区间的翻转,并在保序区间翻转时,对第一编码增加一,以作为下一个保序区间中的报文的第一编码),并将得到的增加一之后的第一编码确定为第一报文的第一编码,即最近一次接收到的第一组保序关系中的第二种报文与第一报文属于不同的保序区间。需要说明的是,上述过程中的第一编码和保序区间均与第一组保序关系对应。If the first module receives the first type of message and/or the second type of message in the first group of order-preserving relationship before the first message, then if the first group of messages received most recently before the first message The message in the order-preserving relationship is the first type of message in the first group of order-preserving relations, and the first code of the first message in the first group of order-preserving relations received most recently is determined as the first The first code of the message, that is, the first message in the first group of order-preserving relations received last time and the first message belong to the same order-preserving interval; if the last received before the first message The message in the first group of order-preserving relations is the second type of message in the first group of order-preserving relations, then the first code of the second type of message in the first group of order-preserving relations received most recently One is added on the basis (that is, when the second type of message in the first group of order-preserving relations is switched to the first type of message, the order-preserving interval is reversed, and when the order-preserving interval is reversed, the first code is increased by one, Take it as the first code of the message in the next order-preserving interval), and determine the obtained first code after incrementing by one as the first code of the first message, that is, the first group of preserving received last time The second type of message in the relationship and the first message belong to a different order-preserving interval. It should be noted that the first code and the order-preserving interval in the above process all correspond to the first group of order-preserving relations.
下面将以第一报文为第一组保序关系中的第二种报文为例对第一报文的编码过程进行说明,其中,第一组保序关系为第一报文所属的至少一组保序关系中的任一组保序关系。The following will take the first message as the second type of message in the first group of order-preserving relations as an example to illustrate the encoding process of the first message, where the first group of order-preserving relations are at least Any group of order-preserving relations in a group of order-preserving relations.
若第一模块在第一报文之前未接收到第一组保序关系中的第一种报文和第二种报文,则将第一报文所属的保序区间确定为第一保序区间,并将第一报文的第一编码设置为0,以及将第一报文的第二编码设置为0。If the first module does not receive the first message and the second message in the first group of preserving relations before the first message, the preserving interval to which the first message belongs is determined as the first preserving Interval, and set the first code of the first message to 0, and set the second code of the first message to 0.
若第一模块在第一报文之前接收到第一组保序关系中的第一种报文和/或第二种报文,则若在第一报文之前最近一次接收到的第一组保序关系中的报文为第一组保序关系中的第二种报文,则将最近一次接收到的第一组保序关系中的第二种报文的第一编码确定为第一报文的第一编码,将最近一次接收到的第一组保序关系中的第二种报文的第二编码确定为第一报文的第二编码,即最近一次接收到的第一组保序关系中的第二种报文与第一报文属于同一个保序区间;若在第一报文之前最近一次接收到的第一组保序关系中的报文为第一组保序关系中的第一种报文,则将最近一次接收到的第一组保序关系中的第一种报文的第一编码确定为第一报文的第一编码,将与基于第一组保序关系的第一编码与第一报文的第一编码相等的第一组保序关系中的第一种报文的数量设置为第一报文的第二编码。需要说明的是,上述过程中的第一编码、第二编码和保序区间均与第一组保序关系对应。If the first module receives the first type of message and/or the second type of message in the first group of order-preserving relationship before the first message, then if the first group of messages received most recently before the first message The message in the order-preserving relationship is the second type of message in the first group of order-preserving relations, and the first code of the second type of message in the first group of order-preserving relations received most recently is determined as the first The first code of the message, the second code of the second type of message in the first group of order-preserving relations received last time is determined as the second code of the first message, that is, the first group received last time The second type of message in the order-preserving relationship belongs to the same order-preserving interval as the first message; if the message in the first group of order-preserving relations received last time before the first message is the first group of order-preserving messages For the first type of message in the relationship, the first code of the first type of message in the first group of order-preserving relations received most recently is determined as the first code of the first message, and it will be compared with the first code based on the first group of messages. The number of messages of the first group in the first group of sequence-preserving relations in which the first code of the sequence-preserving relationship is equal to the first code of the first message is set as the second code of the first message. It should be noted that the first code, the second code, and the order-preserving interval in the above process all correspond to the first group of order-preserving relations.
需要说明的是,基于第一报文所属的其他每组保序关系,分别为第一报文设置基于其他每组保序关系的编码的原理与上述基于第一组保序关系对第一报文设置编码的原理相同,因此此处不再进行赘述。It should be noted that, based on the other groups of order-preserving relations to which the first message belongs, the principle of setting codes based on the other groups of order-preserving relations for the first message is the same as the above-mentioned principle of setting the first message based on the first group of order-preserving relations. The principle of the text setting code is the same, so I will not repeat it here.
方式二:在多个报文包括M类报文,M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数的条件下,对第一报文进行编码的步骤包括:Method 2: In multiple messages including M messages, each message in the M message includes one kind of message, among which, the k+1th message directly depends on the kth message for protection. The k+1 type message indirectly depends on each type of message from the type 1 message to the type k-1 message for order preservation, 1≤k≤M-1 and k and M are integers Under conditions, the steps of encoding the first message include:
为第一报文设置第一编码,第一报文的第一编码用于指示第一报文所属的保序区间,保序区间由划分节点对多个报文划分得到,划分节点为第M类报文切换为第1类报文至第M-1类报文中的任意一类报文的节点,多个报文按照多个报文中的每个报文的发送顺序排序;若第一报文为第k类报文且k=1,则为第一报文设置第二编码,其中,第一报文的第二编码用于指示第一报文在其所属的保序区间内的报文中的排列序号;若第一报文为第 k类报文且2≤k≤M-1,则为第一报文设置第二编码,第一报文的第二编码包括第一编号和第二编号,第一编号用于指示第一报文所属的保序区间内在第一报文之前的第1类报文至第k-1类报文的数量,第二编号用于指示第一报文在其所属的保序区间内的报文中的排列序号;若第一报文为第M类报文,则为第一报文设置第二编码,第一报文的第二编码包括第一编号和第二编号,第一编号用于指示第一报文所属的保序区间内在第一报文之前的第1类报文至第M-1类报文的数量,第二编号用于指示第一报文在其所属的保序区间内的报文中的排列序号。Set the first code for the first message. The first code of the first message is used to indicate the order-preserving interval to which the first message belongs. The order-preserving interval is obtained by dividing multiple messages by a dividing node, and the dividing node is the Mth The type message is switched to the node of any type of message in the type 1 message to the type M-1 message, and the multiple messages are sorted according to the sending order of each of the multiple messages; if the first A message is a k-th message and k=1, then a second code is set for the first message, where the second code of the first message is used to indicate that the first message is in the order-preserving interval to which it belongs The sequence number in the message; if the first message is a k-th message and 2≤k≤M-1, then the second code is set for the first message, and the second code of the first message includes the first Number and second number, the first number is used to indicate the number of type 1 messages to type k-1 messages before the first message in the order-preserving interval to which the first message belongs, and the second number is used to indicate The sequence number of the first message in the messages in the sequence to which it belongs; if the first message is an M-th message, the second code is set for the first message, and the second code of the first message is The code includes a first number and a second number. The first number is used to indicate the number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the first message belongs. The number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs.
需要说明的是,由于第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,因此,k的取值越小,第k类报文的优先级越高,k的取值越大,第k类报文的优先级越低。基于此,可得第1类报文的优先级最高,第M类报文的优先级最低,以及第k+1类报文与第1类报文至第k类报文中的每类报文均存在保序关系,其中,第k+1类报文与第k类报文的保序关系为直接保序关系,第k+1类报文与第1类报文至第k-1类报文中的任意一类报文的保序关系为间接保序关系。由于将多个报文划分为M类报文、每类报文的优先级以及每类报文之间的保序关系已经在上文中进行了说明,因此此处不再进行赘述。It should be noted that since the k+1 type messages directly depend on the k type messages for order preservation, the k+1 type messages indirectly depend on the type 1 messages to the k-1 type messages. Each type of message is sequenced. Therefore, the smaller the value of k, the higher the priority of the k-th message, and the larger the value of k, the lower the priority of the k-th message. Based on this, it can be obtained that the priority of the first type of message is the highest, the priority of the M-th type of message is the lowest, and the k+1 type of messages and each of the type 1 to k-th messages All messages have an order-preserving relationship. Among them, the order-preserving relationship between the k+1 type message and the k-th type message is a direct order-preserving relationship, and the k+1 type message and the type 1 message to the k-1 The order-preserving relationship of any type of messages in the class of messages is an indirect order-preserving relationship. Since the division of multiple messages into M types of messages, the priority of each type of messages, and the order-preserving relationship between each type of messages have been described above, the details are not repeated here.
基于上述步骤,对多个报文中的每个报文进行编码的整体思路可以理解为:首先确定多个报文中总共包括几种报文、每种报文之间的保序关系,根据每种报文之间的保序关系确定每种报文的优先级,然后,根据每种报文的优先级确定每种报文的类;再然后,以优先级最低的报文切换为优先级高于最低优先级的报文的节点作为划分节点(即以第M类报文切换为第1类报文至第M-1类报文中的任意一类报文的节点作为划分节点)对多个报文进行划分,以得到至少一个保序区间,其中多个报文按照多个报文中的每个报文的发送顺序排序;最后,基于每个保序区间和每种报文所属的类(即每种报文的优先级),对每个保序区间内的每个报文进行编码。具体的,对每个保序区间内的每个报文进行编码的过程如下:Based on the above steps, the overall idea of encoding each message in multiple messages can be understood as: first determine the multiple messages including a total of several messages and the order-preserving relationship between each message, according to The order-preserving relationship between each message determines the priority of each message, and then determines the class of each message according to the priority of each message; then, the message with the lowest priority is switched to priority The node of the message with the level higher than the lowest priority is used as the dividing node (that is, the node of any type of message from the M-th type of message being switched to the type 1 message to the M-1 type of message is used as the dividing node) Divide multiple messages to obtain at least one sequence-preserving interval, where multiple messages are sorted according to the sending order of each of the multiple messages; finally, based on each sequence-preserving interval and each message The category to which it belongs (that is, the priority of each message), encodes each message in each order-preserving interval. Specifically, the process of encoding each message in each order-preserving interval is as follows:
为每个保序区间内的每个报文设置第一编码。每个报文的第一编码均用于指示每个报文所属的保序区间,即多个报文中位于同一保序区间内的每个报文的第一编码相同。根据每个报文的优先级以及每个报文所属的保序区间为每个报文设置第二编码。具体的,若报文为优先级最高的报文,即报文为第1类报文,则根据报文在其所属的保序区间内的报文中的排列序号设置该报文的第二编码,即报文的第二编码用于指示报文在其所属的保序区间内的报文中的排列序号;若报文为优先级最低的报文,即报文为第M类报文,则报文的第二编码包括第一编号和第二编号,其中,根据报文所属的保序区间内在该报文之前且优先级比该报文的优先级高的报文的数量(即根据报文所属的保序区间内在该报文之前的第1类报文至第M-1类报文的数量)设置该报文的第一编号,根据该报文在其所属的保序区间内的报文中的排列序号设置第二编号;若报文为最高优先级和最低优先级之间的任何一个优先级的报文,即报文为第k类报文且2≤k≤M-1,则报文的第二编码包括第一编号和第二编号,其中,根据报文所属的保序区间内在该报文之前且优先级比该报文的优先级高的报文的数量(即第1类报文至第k-1类报文的数量)设置该报文的第一编号,根据报文在其所属的保序区间内的报文中的排列序号设置该报文的第二编号。Set the first code for each message in each order-preserving interval. The first code of each message is used to indicate the sequence-preserving interval to which each message belongs, that is, the first code of each message in the same sequence-preserving interval among multiple messages is the same. The second code is set for each message according to the priority of each message and the order-preserving interval to which each message belongs. Specifically, if the message is the message with the highest priority, that is, the message is a type 1 message, the second sequence number of the message is set according to the sequence number of the message in the sequence preservation interval to which the message belongs. Code, that is, the second code of the message is used to indicate the sequence number of the message in the message in the order-preserving interval to which it belongs; if the message is the message with the lowest priority, that is, the message is the M-th message , The second code of the message includes the first number and the second number. Among them, according to the number of messages (ie Set the first number of the message according to the number of type 1 messages to type M-1 messages before the message in the order-preserving interval to which the message belongs, and set the first number of the message according to the order-preserving interval to which the message belongs Set the second number in the sequence number of the message in the message; if the message is a message of any priority between the highest priority and the lowest priority, that is, the message is a k-th message and 2≤k≤M -1, the second code of the message includes the first number and the second number, among which, according to the number of messages that precede the message and have a higher priority than the priority of the message in the order-preserving interval to which the message belongs (I.e. the number of type 1 messages to k-1 types of messages) Set the first number of the message, and set the number of the message according to the sequence number of the message in the message in the sequence to which it belongs The second number.
下面,举例对上述过程进行说明,图7示出了对多个报文进行编码的示意图六。如图 7所示,多个报文中总共包括5种报文,分别为:报文a、报文b、报文c、报文d、报文e,其中,每种报文之间的保序关系如下:报文b直接依赖于报文a进行保序,报文c直接依赖于报文b进行保序,报文d直接依赖于报文c进行保序,报文e直接依赖于报文d进行保序,报文c间接依赖于报文a进行保序,报文d间接依赖于报文a进行保序,报文d间接依赖于报文b进行保序,报文e间接依赖于报文a进行保序,报文e间接依赖于报文b进行保序,报文e间接依赖于报文c进行保序。基于此,5种报文的优先级从高到低的顺序为:报文a>报文b>报文c>报文d>报文e,即第一类报文包括报文a,第二类报文包括报文b,第三类报文包括报文c,第四类报文包括报文d,第五类报文包括报文e。需要说明的是,多个报文所包括的报文的种类以及不同种类的报文之间的保序关系可以由报文发送模块确定并发送至第一模块,还可以由第一模块根据数据传输协议确定,此处不作特殊限定。In the following, the foregoing process will be described with an example. FIG. 7 shows a sixth schematic diagram of encoding multiple messages. As shown in Figure 7, the multiple messages include a total of 5 types of messages, namely: message a, message b, message c, message d, and message e. The sequence preservation relationship is as follows: message b directly depends on message a for sequence preservation, message c directly depends on message b for sequence preservation, message d directly depends on message c for sequence preservation, and message e directly depends on Message d is for order preservation, message c indirectly depends on message a for order preservation, message d indirectly depends on message a for order preservation, message d indirectly depends on message b for order preservation, and message e indirectly Rely on message a for order preservation, message e indirectly depends on message b for order preservation, and message e indirectly depends on message c for order preservation. Based on this, the priority order of the five types of messages from high to low is: message a>message b>message c>message d>message e, that is, the first type of messages includes message a, The second type of message includes message b, the third type of message includes message c, the fourth type of message includes message d, and the fifth type of message includes message e. It should be noted that the types of messages included in multiple messages and the order-preserving relationship between different types of messages can be determined by the message sending module and sent to the first module, and the first module can also be based on the data The transmission protocol is determined, and there is no special restriction here.
对多个报文中的每个报文进行编码的过程包括:首先根据划分节点对多个报文进行划分以得到至少一个保序区间,划分节点为报文e切换为报文a、报文b、报文c、报文d中的任意一个的节点,即在多个报文的排列顺序上,在报文e后面的报文为报文a、报文b、报文c、报文d中的任意一个时,进行一次保序区间的划分。如图7所示,多个报文被划分为五个保序区间,分别为第一保序区间至第五保序区间。基于该五个保序区间,为多个报文中的每个报文设置第一编码,由于报文的第一编码用于指示报文所属的保序区间,因此可以为五个保序区间中的每个保序区间设置编码,其中第一保序区间的编码为0、第二保序区间的编码为1、第三保序区间的编码为2、第四保序区间的编码为3、第五保序区间的编码为4,将每个保序区间的编码设置为对应保序区间内的每个报文的第一编码。基于上述五个保序区间以及每个报文的优先级设置多个报文中的每个报文的第二编码。具体的,若报文为报文a,即报文为优先级最高的报文,则根据报文在其所属的保序区间内的报文中的排列序号设置第二编码。若报文为报文b或报文c或报文d,则报文的第二编码包括第一编号和第二编号,其中,根据报文所属的保序区间内在该报文之前且比该报文的优先级高的报文的数量设置该报文的第一编号,以及根据报文在其所属的保序区间内的报文中的排列序号设置第二编号。若报文为报文e,即报文为优先级最低的报文,则报文的第二编码包括第一编号和第二编号,其中根据报文所属的保序区间内在该报文之前的报文a、报文b、报文c、报文d的数量总和设置该报文的第一编号,以及根据报文在其所属的保序区间内的报文中的排列序号设置该报文的第二编号。最终,对多个报文中的每个报文进行编码后得到的每个报文的编码如图7中每个报文上方的编码所示,其中,每个报文的编码均表示在括号中,对于报文a,用逗号隔开报文a的第一编码和第二编码,且第一编码位于第二编码之前;对于报文b、报文c、报文d、报文e,用逗号隔开第一编码和第二编码中的第一编号和第二编号,其中第一编码位于最前面,第一编号位于中间,第二编号位于最后。The process of encoding each message in the multiple messages includes: firstly dividing the multiple messages according to the dividing node to obtain at least one sequence-preserving interval, and dividing the node into a message e, switching to a message a, a message b. The node of any one of message c and message d, that is, in the sequence of multiple messages, the messages after message e are message a, message b, message c, and message For any one of d, a division of the order-preserving interval is performed. As shown in Figure 7, multiple messages are divided into five order-preserving intervals, namely the first order-preserving interval to the fifth order-preserving interval. Based on the five preserving intervals, the first code is set for each of the multiple messages. Since the first code of the message is used to indicate the preserving interval to which the message belongs, it can be five preserving intervals Set the code for each preserving interval in, where the code of the first preserving interval is 0, the code of the second preserving interval is 1, the code of the third preserving interval is 2, and the code of the fourth preserving interval is 3 The code of the fifth order-preserving interval is 4, and the code of each order-preserving interval is set as the first code of each message in the corresponding order-preserving interval. The second code of each of the multiple messages is set based on the above five sequence preserving intervals and the priority of each message. Specifically, if the message is a message a, that is, the message is the message with the highest priority, the second code is set according to the sequence number of the message in the message in the sequence preservation interval to which the message belongs. If the message is message b or message c or message d, the second code of the message includes the first number and the second number. The number of messages with higher priority of the message sets the first number of the message, and the second number is set according to the sequence number of the message in the message in the sequence to which it belongs. If the message is message e, that is, the message is the message with the lowest priority, the second code of the message includes the first number and the second number. The sum of the number of message a, message b, message c, and message d sets the first number of the message, and sets the message according to the sequence number of the message in the message in the sequence to which it belongs The second number. Finally, the code of each message obtained after encoding each of the multiple messages is shown in the code above each message in Figure 7, where the code of each message is shown in brackets For message a, separate the first code and the second code of message a with a comma, and the first code is located before the second code; for message b, message c, message d, and message e, Separate the first number and the second number in the first code and the second code with a comma, where the first code is at the front, the first number is at the middle, and the second number is at the end.
基于上述描述,第一模块对第一报文进行编码的过程可以包括以下两种,其中:Based on the foregoing description, the process of encoding the first message by the first module may include the following two types:
第一种,第一模块可以在接收完每个第一报文(即多个报文中的每个报文)后,按照每个第一报文的接收顺序对第一报文进行排序(即对多个报文进行排序);结合上述方式对每个第一报文进行编码。需要说明的是,由于第一报文是按照第一报文的发送顺序接收的,因此,按照第一报文的接收顺序对第一报文进行排序仍然保持了第一报文原有的顺序。In the first type, the first module can sort the first messages according to the order in which each first message is received after receiving each first message (that is, each message among multiple messages) ( That is, multiple messages are sorted); each first message is coded in combination with the above method. It should be noted that, since the first message is received in the order in which the first message was sent, sorting the first message according to the order in which the first message was received still maintains the original order of the first message .
第二种,第一模块可以在每接收到一个第一报文时,对接收到的第一报文进行编码。具体的,第一模块接收到第一报文后,首先确定第一报文的种类,以及根据第一报文的种类和第一报文与其他各类报文的保序关系确定第一报文的优先级(即第一报文所属的类),然后根据第一报文的优先级对第一报文进行编码。下面,将对报文进行编码的具体过程进行说明。In the second type, the first module can encode the received first message every time a first message is received. Specifically, after receiving the first message, the first module first determines the type of the first message, and determines the first message according to the type of the first message and the order-preserving relationship between the first message and other types of messages. The priority of the message (that is, the class to which the first message belongs), and then the first message is encoded according to the priority of the first message. In the following, the specific process of message encoding will be described.
在第一报文之前未接收到多个报文中的任何一个报文的情况下,即在第一报文为多个报文中的第一个报文的情况下:In the case where the first message has not received any one of the multiple messages before, that is, in the case that the first message is the first message among the multiple messages:
将第一报文所属的保序区间确定为第一保序区间,并将第一报文的第一编码设置为0,以及为第一报文设置第二编码。具体的,若第一报文为第1类报文(即优先级最高的报文),则根据第一报文在其所属的保序区间内的报文中的排列序号设置第二编码,由于此处的第一报文为多个报文中的第一个报文,因此第一报文为在其所属的保序区间内的报文中位于第一位的报文,因为将第一报文的第二编码设置为1;若第一报文为除第1类报文之外的其他类报文(即优先级低于最高优先级的其他报文),则第一报文的第二编码包括第一编号和第二编号,其中根据第一报文所属的保序区间内在第一报文之前且比其优先级高的报文的数量设置第一编号,根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编号,由于此处的第一报文为多个报文中的第一个报文,因此第一编号为0,第二编号为1。The sequence-preserving interval to which the first message belongs is determined as the first sequence-preserving interval, the first code of the first message is set to 0, and the second code is set for the first message. Specifically, if the first message is a type 1 message (that is, the message with the highest priority), the second code is set according to the sequence number of the first message in the message in the sequence preservation interval to which it belongs, Since the first message here is the first message among multiple messages, the first message is the first message among the messages in the preserving interval to which it belongs. The second code of a message is set to 1; if the first message is a message other than the first type of message (that is, other messages with a priority lower than the highest priority), then the first message The second code includes a first number and a second number, and the first number is set according to the number of messages before and higher than the priority of the first message in the order-preserving interval to which the first message belongs. The sequence number of the message in the message in the sequence to which it belongs sets the second number of the first message. Since the first message here is the first message among multiple messages, the first message The number is 0, and the second number is 1.
在第一报文之前接收到多个报文中至少一个报文的情况下:In the case where at least one of the multiple messages is received before the first message:
若第一报文为优先级最低的报文(即第M类报文),则将第一报文之前最近一次接收到的报文的第一编码设置为第一报文的第一编码,即第一报文与第一报文之前最近一次接收到的报文在同一个保序区间,以及根据第一报文所属的保序区间内在第一报文之前且优先级比第一报文的优先级高的报文的数量设置第一报文的第一编号(由于属于一个保序区间内的报文的第一编码相同,因此可以根据第一编码与第一报文的第一编码相同且位于第一报文之前且优先级高于第一报文的优先级的报文数量设置第一编号),根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编号。If the first message is the message with the lowest priority (that is, the M-th message), the first code of the last received message before the first message is set as the first code of the first message, That is, the first message and the last received message before the first message are in the same order-preserving interval, and according to the order-preserving interval to which the first message belongs, it is before the first message and has a higher priority than the first message Set the first number of the first message to the number of messages with high priority (because the first code of the messages belonging to a preserving interval is the same, so it can be based on the first code and the first code of the first message Set the first number to the number of messages that are the same and that are located before the first message and have a priority higher than the priority of the first message), according to the sequence number of the first message in the message in the sequence to which it belongs Set the second number of the first message.
若第一报文为优先级高于最低优先级且低于最高优先级的任何一个优先级的报文(即第2类至第M-1类报文中的任何一类报文),则在第一报文之前最近一次接收到的报文为优先级最低的报文时,在最近一次接收到的报文的第一编码的基础上增加一(即在优先级最低的报文切换为优先级高于最低优先级的任何一个报文时进行保序区间的翻转,并在保序区间翻转时,对第一编码增加一,以作为下一个保序区间中的报文的第一编码),并将得到的增加一之后的第一编码确定为第一报文的第一编码,即最近接收到的报文与第一报文属于不同的保序区间,以及根据第一报文所属的保序区间内在第一报文之前且优先级比第一报文的优先级高的报文的数量设置第一报文的第一编号,由于在第一报文处进行了保序区间的划分,因此该第一报文为该保序区间内的第一个报文,则,第一报文的第一编号为0,根据第一报文在其所属的保序区间内的排列序号设置第一报文的第二编号,由于第一报文为该保序区间的第一个报文,因此该第一报文的第二编号为1;在第一报文之前最近一次接收到的报文为优先级高于最低优先级的报文时,则将第一报文之前最近一次接收到的报文的第一编码设置为第一报文的第一编码,即第一报文与第一报文之前最近一次接收到的报文属于同一个保序区间,以及根据第一报文所属的保序区间内在第一报文之前且 优先级比第一报文的优先级高的报文的数量设置第一报文的第一编号(由于属于一个保序区间内的报文的第一编码相同,因此可以根据第一编码与第一报文的第一编码相同且位于第一报文之前且优先级高于第一报文的优先级的报文数量设置第一编号),根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编号。If the first message is a message with a priority higher than the lowest priority and lower than the highest priority (that is, any type of message from the second to the M-1 class of messages), then When the last message received before the first message is the message with the lowest priority, one is added to the first code of the last message received (that is, the message with the lowest priority is switched to When the priority is higher than the lowest priority for any message, the order-preserving interval is reversed, and when the order-preserving interval is reversed, the first code is increased by one to be the first code of the message in the next order-preserving interval ), and the obtained first code added by one is determined as the first code of the first message, that is, the most recently received message and the first message belong to a different order-preserving interval, and the first message belongs to The number of messages in the sequence preserving interval before the first message and with a higher priority than the first message is set to the first number of the first message, because the sequence preserving interval is performed at the first message Therefore, the first message is the first message in the preserving interval, and the first number of the first message is 0, according to the sequence number of the first message in the preserving interval to which it belongs Set the second number of the first message. Since the first message is the first message in the order-preserving interval, the second number of the first message is 1; it was received last time before the first message When the message of is higher than the lowest priority message, the first code of the last received message before the first message is set to the first code of the first message, that is, the first message The last message received before the first message belongs to the same order-preserving interval, and according to the order-preserving interval to which the first message belongs, it is before the first message and has a higher priority than the first message The number of messages sets the first number of the first message (because the first codes of the messages belonging to a preserving interval are the same, the first code can be the same as the first code of the first message and located in the first Set the first number for the number of messages before the message and the priority is higher than the priority of the first message), and set the first message according to the sequence number of the first message in the messages in the sequence to which it belongs The second number.
若第一报文为优先级最高的报文(即第1类报文),则在第一报文之前最近一次接收到的报文为优先级最低的报文(即第M类报文)时,在最近一次接收到的报文的第一编码的基础上增加一(即在优先级最低的报文切换为优先级高于最低优先级的任何一个报文时进行保序区间的翻转,并在保序区间翻转时,对第一编码增加一,以作为下一个保序区间中的报文的第一编码),并将增加一之后的第一编码确定为第一报文的第一编码,即最近接收到的报文与第一报文属于不同的保序区间,根据第一报文在其所属的保序区间内的排列序号设置第一报文的第二编码,由于第一报文为该保序区间的第一个报文,因此该第一报文的第二编码为1;在第一报文之前最近一次接收到的报文为优先级高于最低优先级的报文时,则将第一报文之前最近一次接收到的报文的第一编码设置为第一报文的第一编码,即第一报文与第一报文之前最近一次接收到的报文属于同一个保序区间,以及根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编码。If the first message is the message with the highest priority (i.e. type 1 message), the most recently received message before the first message is the message with the lowest priority (i.e. type M message) At the time, add one to the first code of the most recently received message (that is, when the message with the lowest priority is switched to any message with the priority higher than the lowest priority, the order-preserving interval is reversed, And when the order-preserving interval is reversed, add one to the first code as the first code of the message in the next order-preserving interval), and determine the first code after the increment by one as the first code of the first message Code, that is, the most recently received message and the first message belong to a different sequence preserving interval, and the second code of the first message is set according to the sequence number of the first message in the preserving interval to which it belongs. The message is the first message in the order-preserving interval, so the second code of the first message is 1; the last message received before the first message is the one with priority higher than the lowest priority. Set the first code of the last message received before the first message to the first code of the first message, that is, the first message and the last message received before the first message They belong to the same sequence-preserving interval, and the second code of the first message is set according to the sequence number of the first message in the messages in the sequence-preserving interval to which it belongs.
在上述方式二的基础上,若M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系的报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系的报文进行保序,则对第一报文进行编码的步骤包括:On the basis of the second method above, if at least one type of message in the M type message includes multiple types of messages, one of the k+1 type messages directly depends on the k type message Preserve the order of the messages with which it has a preserving relationship. A message in the k+1 class of messages indirectly depends on the messages with which there is a preserving relation among the class 1 messages to the k-1 messages. To preserve the order, the steps of encoding the first message include:
为第一报文设置第一编码,第一报文的第一编码用于指示第一报文所属的保序区间,保序区间由划分节点对多个报文进行划分得到,划分节点为第M类报文中指定的一种报文或者任一种报文切换为第1类报文至第M-1类报文中指定的一种报文或者任一种报文的节点。Set the first code for the first message. The first code of the first message is used to indicate the order-preserving interval to which the first message belongs. The order-preserving interval is obtained by dividing multiple messages by the dividing node, and the dividing node is the A message or any message specified in the M-type message is switched to a node of a message or any kind of message designated in the M-1 message.
对第一报文设置第二编码,具体过程如下:To set the second code for the first message, the specific process is as follows:
若第一报文为第k类报文中的第s种报文且k=1,则根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编码,其中,第一报文的第二编码用于指示第一报文在其所属的保序区间内的报文中的排列序号。If the first message is the s-th message in the k-th message and k=1, then the first message is set according to the sequence number of the first message in the message in the order-preserving interval to which it belongs The second code, wherein the second code of the first message is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs.
若第一报文为第k类报文中的第t种报文且2≤k≤M-1,则根据第一报文所属的保序区间内在第一报文之前的第1类报文至第k-1类报文中与其存在保序关系(直接保序关系和间接保序关系)的报文数量设置第一报文的第一编号,即根据第一报文所属的保序区间内在第一报文之前且优先级高于第一报文的优先级且与第一报文存在保序关系(直接保序关系和间接保序关系)的报文的数量设置第一报文的第一编号,即第一报文的第一编号用于指示第一报文所属的保序区间内在第一报文之前的第1类报文至第k-1类报文中与其存在保序关系(直接保序关系和间接保序关系)的报文数量,以及根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编号,即第一报文的第二编号用于指示第一报文在其所属的保序区间内的报文中的排列序号。If the first message is the t-th message in the k-th message and 2≤k≤M-1, then according to the first message before the first message in the order-preserving interval to which the first message belongs Set the first number of the first message to the number of messages with the order-preserving relationship (direct order-preserving relationship and indirect order-preserving relationship) in the k-1th message, that is, according to the order-preserving interval to which the first message belongs The number of messages that are before the first message and whose priority is higher than the priority of the first message and have an order-preserving relationship (direct order-preserving relationship and indirect order-preserving relationship) with the first message Set the number of the first message The first number, that is, the first number of the first message is used to indicate that the first message belongs to the first message before the first message in the first message to the k-1 message and the sequence is preserved. The number of messages in the relationship (direct preserving relationship and indirect preserving relationship), and the second number of the first message is set according to the sequence number of the first message in the message in the preserving interval to which it belongs, that is, the first message The second number of a message is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs.
若第一报文为第M类报文中的第q种报文,则根据第一报文所属的保序区间内在第一报文之前的第1类报文至第M-1类报文中与其存在保序关系(直接保序关系和间接保序关系)的报文数量设置第一报文的第一编号,即根据第一报文所属的保序区间内在第一报 文之前且优先级高于第一报文的优先级且与第一报文存在保序关系(直接保序关系和间接保序关系)的报文的数量设置第一报文的第一编号,第一报文的第一编号用于指示第一报文所属的保序区间内在第一报文之前的第1类报文至第M-1类报文中与其存在保序关系的报文数量,以及根据第一报文在其所属的保序区间内的报文中的排列序号设置第一报文的第二编号,即第一报文的第二编号用于指示第一报文在其所属的保序区间内的报文中的排列序号。If the first message is the q-th message in the M-th class of messages, according to the order-preserving interval to which the first message belongs, the first message to the M-1 class message before the first message Set the first number of the first message according to the number of messages that have a preserving relationship (direct preserving relationship and indirect preserving relationship). The number of messages whose priority level is higher than the priority of the first message and which has a sequence-preserving relationship (direct sequence-preserving relationship and indirect sequence-preserving relationship) with the first message is set to the first number of the first message, and the first message The first number is used to indicate the number of messages that have a sequence-preserving relationship with the first message before the first message in the sequence-preserving interval to which the first message belongs, and according to the first message The sequence number of a message in the message in the sequence to which it belongs sets the second number of the first message, that is, the second number of the first message is used to indicate the sequence number of the first message in the sequence to which it belongs The sequence number of the packets in the interval.
由于上述对多个报文中的每个报文进行编码的原理与方式二中对每个报文进行编码的原理相同,因此此处不再进行赘述。Since the principle of encoding each of the multiple messages is the same as the principle of encoding each message in the second manner, the details are not repeated here.
由于在多个报文中确定M类报文、每类报文的优先级以及每类报文之间的保序关系已经在上文中进行了说明,因此此处不再进行赘述。Since the determination of the M type of messages, the priority of each type of messages, and the order-preserving relationship between each type of messages among multiple messages has been described above, it will not be repeated here.
下面,将举例对在每类报文包括多种报文的情况下对多个报文中的每个报文进行编码的过程进行说明。图8示出了对多个报文进行编码的示意图七,多个报文包括六种报文,分别为:报文A、报文B、报文C、报文D、报文E、报文F,其中,报文C直接依赖于报文A进行保序,报文D直接依赖于报文B进行保序,报文E直接依赖于报文C进行保序,报文F直接依赖于报文C进行保序,报文E间接依赖于报文A进行保序,报文F间接依赖于报文A进行保序。基于此,上述六种报文可以划分为三类报文,三类报文按照优先级由高到低的顺序依次为:第一类报文、第二类报文、第三类报文。其中,第一类报文包括报文A和报文B,第二类报文包括报文C和报文D,第三类报文包括报文E和报文F。In the following, an example will be given to illustrate the process of encoding each of the multiple messages when each type of message includes multiple types of messages. Figure 8 shows the seventh schematic diagram of encoding multiple messages. The multiple messages include six types of messages, namely: message A, message B, message C, message D, message E, and message. Message F, where message C directly depends on message A for order preservation, message D directly depends on message B for order preservation, message E directly depends on message C for order preservation, and message F directly depends on Message C is for order preservation, message E indirectly depends on message A for order preservation, and message F indirectly depends on message A for order preservation. Based on this, the above-mentioned six types of messages can be divided into three types of messages, and the three types of messages are in descending order of priority: the first type of message, the second type of message, and the third type of message. Among them, the first type of message includes message A and message B, the second type of message includes message C and message D, and the third type of message includes message E and message F.
在图8中,以报文E或者F切换为报文A、报文B、报文C和报文D中的任何一种报文的节点作为划分节点对多个报文进行划分,以得到六个保序区间,根据六个保序区间以及上述原理对多个报文中的每个报文进行编码,得到的每个报文的编码位于图8中每个报文之上,其中,每个报文的编码均位于括号中,对于报文A和报文B,用逗号隔开报文A和报文B的第一编码和第二编码,且第一编码位于第二编码之前,对于报文C、报文D、报文E和报文F,用逗号隔开第一编码和第二编码中的第一编号和第二编号,其中,第一编码位于最前面,第一编号位于中间,第二编号位于最后。In Figure 8, the node in which message E or F is switched to any one of message A, message B, message C, and message D is used as a dividing node to divide multiple messages to obtain Six sequence-preserving intervals, each of the multiple messages is encoded according to the six sequence-preserving intervals and the above principles, and the obtained code of each message is located above each message in Figure 8, where, The code of each message is in brackets. For message A and message B, separate the first code and second code of message A and message B with a comma, and the first code is located before the second code. For message C, message D, message E, and message F, separate the first number and the second number in the first code and the second code with a comma, where the first code is at the top, and the first number Located in the middle, the second number is at the end.
需要说明的是,在图8中每个报文后面的数字用于标识对应报文在多个报文中的排列序号。It should be noted that the number after each message in FIG. 8 is used to identify the sequence number of the corresponding message among multiple messages.
步骤103、第一模块向第二模块发送第一报文及其编码。Step 103: The first module sends the first message and its code to the second module.
在本申请实施例中,第一模块对第一报文编码之后,将第一报文及其编码发送至第二模块。具体的,第一报文的编码可以携带在第一报文中一并进行发送,还可以将第一报文和第一报文的编码分别进行发送,本申请对此不作特殊限定。第一模块可以采用乱序的总线传输方式或者多通道的传输方式向第二模块发送第一报文及其编码,以提高传输效率。具体的,在多通道的传输方式中,还可以设置每种报文的传输通道,以通过每种报文的传输通道传输对应种类的报文。In the embodiment of the present application, after the first module encodes the first message, it sends the first message and its encoding to the second module. Specifically, the code of the first message may be carried in the first message and sent together, or the codes of the first message and the first message may be sent separately, which is not particularly limited in this application. The first module may use an out-of-sequence bus transmission mode or a multi-channel transmission mode to send the first message and its code to the second module to improve transmission efficiency. Specifically, in a multi-channel transmission mode, a transmission channel of each type of message can also be set to transmit a corresponding type of message through the transmission channel of each type of message.
由上可知,根据第一报文在多个报文中的发送顺序和第一报文与多个报文中的其他报文的保序关系为第一报文设置编码,使得第一报文的编码指示第一报文与多个报文中的其他报文的执行关系(即排在第一报文之前且限制第一报文执行的报文),因此,在第一模块和第二模块之间传输第一报文时,通过传输第一报文的编码,使得第二模块根据第一报文的编码确定排在第一报文之前且限制第一报文执行的报文,实现了第一报文的保序传输; 另外,由于第一报文的编码指示第一报文与多个报文中的其他报文的执行关系(即排在第一报文之前且限制第一报文执行的报文),因此相比于现有技术,在第一模块和第二模块之间传输第一报文时,无需第二模块向第一模块发送确认消息,也无需第一模块确认是否接收到确认消息,无需链路、无需流控,仅通过发送第一报文及其编码,即可实现第一报文的保序传输,极大的缩短了报文的传输延时,从而避免出现报文保序传输延时被无形拉长的现象,极大的提高了带宽的利用率;此外,由于缩短了报文的传输延时,因此避免出现由于时间的推移而产生积累效应的问题,极大的减轻了对更上游模块的报文的传输影响;另外,通过为第一报文设置编码的方式,实现报文的保序传输,方式简单且易于执行。It can be seen from the above that according to the sending order of the first message in multiple messages and the order-preserving relationship between the first message and other messages in the multiple messages, the code is set for the first message, so that the first message The code indicates the execution relationship between the first message and other messages in the multiple messages (that is, the message that is arranged before the first message and restricts the execution of the first message). Therefore, in the first module and the second When the first message is transmitted between the modules, the encoding of the first message is transmitted, so that the second module determines the message that is ranked before the first message and restricts the execution of the first message according to the encoding of the first message. Order-preserving transmission of the first message; in addition, since the encoding of the first message indicates the execution relationship between the first message and other messages in the multiple messages (that is, it is arranged before the first message and restricts the first message). Therefore, compared with the prior art, when the first message is transmitted between the first module and the second module, there is no need for the second module to send a confirmation message to the first module, and the first module is also not required To confirm whether the confirmation message is received, no link or flow control is required. Only by sending the first message and its code, the order-preserving transmission of the first message can be realized, which greatly reduces the transmission delay of the message. This avoids the phenomenon of invisibly elongated message sequence transmission delay, which greatly improves bandwidth utilization; in addition, because the message transmission delay is shortened, the accumulation effect due to the passage of time is avoided The problem of, greatly reduces the impact on the transmission of the message of the more upstream module; in addition, by setting the encoding method for the first message, the order-preserving transmission of the message is realized, which is simple and easy to implement.
步骤104、第二模块接收第一模块发送的第一报文及其编码,其中第一报文为多个报文中的任意一个报文,其中,第一报文的编码用于指示第一报文与多个报文中的其他报文的执行关系。需要说明的是,执行关系已经在上文中进行了说明,因此此处不再进行赘述。Step 104: The second module receives the first message and its code sent by the first module, where the first message is any one of the multiple messages, and the code of the first message is used to indicate the first message. The execution relationship between a message and other messages among multiple messages. It should be noted that the execution relationship has been described above, so it will not be repeated here.
步骤105、第二模块根据第一报文的编码确定是否执行第一报文。Step 105: The second module determines whether to execute the first message according to the encoding of the first message.
在本申请实施例中,对第一报文的编码进行解析以确定第一报文与多个报文中的其他报文的执行关系,以及根据第一报文与多个报文中的其他报文的执行关系确定是否执行第一报文。In the embodiment of the present application, the encoding of the first message is analyzed to determine the execution relationship between the first message and other messages in the plurality of messages, and according to the first message and other messages in the plurality of messages The execution relationship of the message determines whether to execute the first message.
由于上文中描述了第一报文的多种编码方式,因此,下面将分别基于不同的编码方式对是否执行第一报文的过程进行说明。具体的,通过以下三种方式进行说明。Since multiple encoding methods of the first message are described above, the process of whether to execute the first message will be described below based on different encoding methods. Specifically, it will be explained in the following three ways.
方式一、在多个报文包括N组保序关系,1≤N且N为整数,其中,N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且第二种报文依赖于第一种报文进行保序,以及针对第i组保序关系,第i组保序关系中的第一种报文和第二种报文基于第i组保序关系的第一编码用于指示第一种报文和第二种报文所属的的保序区间;针对第i组保序关系,第i组保序关系中的第二种报文基于第i组保序关系的第二编码用于指示第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量,以及N组保序关系中的每组保序关系均为直接保序关系的条件下,根据第一报文的编码确定是否执行第一报文的过程如下:Method 1: Multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, where each group of order-preserving relations in the N groups of order-preserving relations includes the first type of message and the second type of message , And the second type of message depends on the first type of message for order preservation, and for the i-th group of order-preserving relations, the first and second types of messages in the i-th group of order-preserving relations are based on the i-th group The first code of the order-preserving relationship is used to indicate the order-preserving interval to which the first type of message and the second-type message belong; for the i-th group of order-preserving relations, the second type of message in the i-th group of order-preserving relations is based on The second code of the i-th group of order-preserving relations is used to indicate the number of the first type of messages in the i-th group of order-preserving relations within the order-preserving interval based on the i-th group of order-preserving relations to which the second message belongs, and Under the condition that each of the N groups of preserving relations is a direct preserving relation, the process of determining whether to execute the first message according to the code of the first message is as follows:
将第一报文的种类与每组直接保序关系中的第一种报文的种类和第二种报文的种类进行比对,以确定第一报文所属的直接保序关系,以及第一报文为其所属的直接保序关系中的哪种报文。需要说明的是,若第一报文为其所属的直接保序关系中的第一种报文,则第一报文所属的直接保序关系的组数为至少一组,若第一报文为其所属的直接保序关系中的第二种报文,则第一报文所属的直接保序关系的组数为一组。Compare the type of the first message with the type of the first message and the type of the second message in each group of direct order-preserving relations to determine the direct order-preserving relation to which the first message belongs, and the first message A message is the kind of message in the direct order-preserving relationship to which it belongs. It should be noted that if the first message is the first message in the direct preserving relationship to which it belongs, the number of groups of the direct preserving relationship to which the first message belongs is at least one group, if the first message For the second type of message in the direct preserving relationship to which it belongs, the number of groups of the direct preserving relationship to which the first message belongs is one group.
若第一报文为第x组直接保序关系中的第一种报文,则执行第一报文。由于第一报文为第x组直接保序关系中的第一种报文,且由于N组保序关系中的每组保序关系均为直接保序关系,因此每组直接保序关系中的第一种报文的执行不受其他报文的执行的限制,因此,在第一报文为第x组直接保序关系中的第一种报文时,可直接执行第一报文。无需等待其他报文的执行。需要说明的是,x的取值范围为:1≤x≤N,且x为整数,x的取值的数量为至少一个。例如,若x的取值的数量为1个,且x的取值为2,则第一报文属于一组直接保序关系中的第一种报文,且第一报文所属的直接保序关系为第2组直接保序关系。若x的取值的数量为3个,且x的取值为1、3、4,则第一报文属于三组直接保序关系中的第一种报文,且第一报文所属的直接保序关系为第1组直接保序关系、第3组直接保序 关系、第4组直接保序关系。If the first message is the first message in the x-th group of direct sequence preservation relations, the first message is executed. Since the first message is the first message in the x-th group of direct preserving relations, and since each group of preserving relations in the N groups of preserving relations is a direct preserving relation, each group of direct preserving relations is The execution of the first message is not restricted by the execution of other messages. Therefore, when the first message is the first message in the x-th group of direct order-preserving relations, the first message can be directly executed. No need to wait for the execution of other messages. It should be noted that the value range of x is: 1≤x≤N, and x is an integer, and the number of x values is at least one. For example, if the number of values of x is 1, and the value of x is 2, then the first message belongs to the first type of message in a group of direct preserving relations, and the direct preserving to which the first message belongs The order relationship is the second group of direct order-preserving relationships. If the number of values of x is 3, and the values of x are 1, 3, and 4, then the first message belongs to the first message in the three groups of direct order-preserving relations, and the first message belongs to Direct order-preserving relations are the first group of direct order-preserving relations, the third group of direct order-preserving relations, and the fourth group of direct order-preserving relations.
若第一报文为第x组直接保序关系中的第二种报文,则根据第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文是否执行完成,若是,则执行第一报文,若否,则等待,直至符合上述条件后再执行第一报文。其中,第一目标报文包括位于第一报文所属的保序区间内的第x组直接保序关系中的第一种报文和位于第一报文所属的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文。由于第一报文为第x组直接保序关系中的第二种报文,且由于N组保序关系中的每组保序关系均为直接保序关系,因此,x的取值的数量为1,以及此处的保序区间均为基第x组的保序区间。举例对该过程进行说明,若基于第x组直接保序关系的保序区间的编号按照由小到大的顺序进行编号,即排在前面的保序区间的编码小于排在后面的保序区间的编码,则判断基于第x组直接保序关系的第一编码小于第一报文的第一编码的第x组直接保序关系中的第一种报文是否均已执行完成,若是,则判断基于第x组直接保序关系的第一编码等于第一报文的第一编码的第x组直接保序关系中的第一种报文的执行数量是否等于第一报文的第二编码,若是,则执行第一报文。If the first message is the second type of message in the x-th group of direct order-preserving relations, determine whether the first target message is based on the first code and the second code of the first message based on the x-th group of direct-order preserving relations The execution is completed, if yes, execute the first message, if not, wait until the above conditions are met, and then execute the first message. Among them, the first target message includes the first type of message in the x-th group of direct order-preserving relations located in the order-preserving interval to which the first message belongs, and the order-preserving interval before the order-preserving interval to which the first message belongs The x-th group within is the first message in the direct order-preserving relationship. Since the first message is the second message in the x-th group of direct preserving relations, and since each of the N groups of preserving relations is a direct preserving relation, the number of values of x Is 1, and the order-preserving interval here is the order-preserving interval of the base x-th group. Take an example to illustrate the process. If the numbers of the preserving intervals based on the direct preserving relationship of the xth group are numbered in ascending order, that is, the code of the preserving interval in the front is smaller than the preserving interval in the back. If the first code in the x-th group of direct order-preserving relations is less than the first code of the first message, it is judged whether all the first messages in the x-th group of direct order-preserving relations have been executed. If so, then Determine whether the first code based on the x-th group of direct order-preserving relations is equal to the first code of the first message, and whether the number of executions of the first type of messages in the x-th group of direct order-preserving relations is equal to the second code of the first message If yes, execute the first message.
下面,以图5和图6为例为上述过程进行说明。若第一报文为图5和图6中的报文A8,由图5和图6可知,第一报文属于第一组直接保序关系和第二组直接保序关系,且第一报文均为第一组直接保序关系和第二组直接保序关系中的第一种报文,因此,在接收到第一报文之后,直接执行第一报文。若第一报文为图5和图6中的报文E11,以及第一报文基于第三组直接保序关系的编码为(1,1),则判断基于第三组直接保序关系的第一编码小于1的第三组保序关系中的第一种报文是否执行完成,即判断基于第三组直接保序关系的第一编码为0的报文D是否均已执行完成,若是,则判断基于第三组直接保序关系的第一编码为1的报文D的执行数量是否等于1,若是,则执行第一报文。Hereinafter, the above-mentioned process will be described by taking FIG. 5 and FIG. 6 as an example. If the first message is message A8 in Figures 5 and 6, it can be seen from Figures 5 and 6 that the first message belongs to the first group of direct order-preserving relations and the second group of direct-order preserving relations, and the first message The messages are the first messages in the first group of direct order-preserving relations and the second group of direct-order preserving relations. Therefore, after the first message is received, the first message is directly executed. If the first message is the message E11 in Figure 5 and Figure 6, and the code of the first message based on the third group of direct preserving relationship is (1,1), then it is judged that the code based on the third group of direct preserving relationship is (1,1) Whether the execution of the first type of message in the third group of order-preserving relations with the first code less than 1 is completed, that is, it is judged whether all the messages D with the first code of 0 based on the third group of direct order-preserving relations have been executed, if yes , It is judged whether the execution number of the message D with the first code of 1 based on the third group of direct order-preserving relationship is equal to 1, and if so, the first message is executed.
需要说明的是,在基于每组直接保序关系的保序区间的编号按照由小到大的顺序进行编号,即报文基于对应的直接保序关系的第一编码均按照由小到大的顺序进行编码的条件下,若按照基于每组直接保序关系的第一编码由小到大的顺序执行每组直接保序关系中的第一种报文,则确定是否执行第一报文的过程如下:It should be noted that the numbers in the preserving intervals based on each group of direct preserving relations are numbered in ascending order, that is, the first codes of the messages based on the corresponding direct preserving relations are all in descending order. Under the condition of sequential encoding, if the first type of message in each group of direct order-preserving relations is executed in ascending order based on the first encoding of each group of direct order-preserving relations, it is determined whether to execute the first message The process is as follows:
若第一报文为第x组直接保序关系中的第一种报文,则x的取值的数量为至少一个,那么需要选择至少一组第x组直接保序关系中的任意一组直接保序关系作为判断基础,以及基于选择的一组保序关系判断是否执行第一报文,具体的,判断过程如下:If the first message is the first message in the x-th group of direct order-preserving relations, and the number of values of x is at least one, then at least one group of the x-th group of direct preserving relations needs to be selected The direct order-preserving relationship is used as the basis for the judgment, and the first message is judged based on the selected set of order-preserving relationships. Specifically, the judgment process is as follows:
确定最近一次执行的第x组直接保序关系(即选择的一组第x组直接保序关系)中的第一种报文的第一编码是否与第一报文的第一编码相等,若是,则执行第一报文,若否,则确定第一编码与第一报文的第一编码相邻且小于第一报文的第一编码的第x组直接保序关系(即选择的一组第x组直接保序关系)中的第一种报文是否均已执行完成,若是,则执行第一报文,若否,则等待,直至符合上述条件才可执行第一报文。需要说明的是,上述判断过程中的第一编码均与选择的第x组直接保序关系对应。Determine whether the first code of the first message in the last executed group x-th group of direct order-preserving relations (that is, the selected group of direct-order preserving relations of group x) is equal to the first code of the first message, if so , The first message is executed, if not, it is determined that the first code is adjacent to the first code of the first message and is smaller than the x-th group of direct preserving relationship of the first code of the first message (that is, the selected one Whether all the first messages in the group x group (direct order preserving relationship) have been executed, if yes, execute the first message, if not, wait until the above conditions are met before the first message can be executed. It should be noted that the first codes in the above judgment process all correspond to the selected x-th group of direct order-preserving relations.
若第一报文为第x组直接保序关系中的第二种报文,则x的取值的数量为一个,那么以该第x组直接保序关系作为判断基础判断是否执行第一报文,具体的,判断过程如下:If the first message is the second message in the x-th group of direct order-preserving relations, then the number of values of x is one, then the x-th group of direct-order preserving relations are used as the basis for judging whether to execute the first report The text, specifically, the judgment process is as follows:
判断最近一次执行的第x组直接保序关系中的第一种报文的第一编码是否大于第一报文的第一编码,若是,则执行第一报文,若否,则判断第一编码与第一报文的第一编码 相等的第x组直接保序关系中的第一种报文的执行数量是否等于第一报文的第二编码,若是,则执行第一报文,若否,则等待,直至符合上述条件才可执行第一报文。需要说明的是,上述判断过程中的第一编码和第二编码均已第x组直接保序关系对应。Determine whether the first code of the first type of message in the x-th group of direct order-preserving relations executed last time is greater than the first code of the first message, if yes, execute the first message, if not, judge the first Whether the execution quantity of the first message in the x-th group of direct order-preserving relations whose code is equal to the first code of the first message is equal to the second code of the first message, if yes, execute the first message, if Otherwise, wait until the above conditions are met before the first message can be executed. It should be noted that both the first code and the second code in the above judgment process correspond to the x-th group directly in the order-preserving relationship.
方式二、在多个报文包括N组保序关系,2≤N且N为整数,其中,N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且第二种报文依赖于第一种报文进行保序,以及针对第i组保序关系,第i组保序关系中的第一种报文和第二种报文基于第i组保序关系的第一编码用于指示第一种报文和第二种报文所属的基于第i组保序关系的保序区间;针对第i组保序关系,第i组保序关系中的第二种报文基于第i组保序关系的第二编码用于指示第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量,以及N组保序关系中的一部分保序关系为直接保序关系,另外一部分保序关系为间接保序关系的条件下,根据第一报文的编码确定是否执行第一编码的过程如下:Manner 2: Multiple messages include N groups of order-preserving relations, 2≤N and N is an integer, where each group of order-preserving relations in the N groups of order-preserving relations includes the first type of message and the second type of message , And the second type of message depends on the first type of message for order preservation, and for the i-th group of order-preserving relations, the first and second types of messages in the i-th group of order-preserving relations are based on the i-th group The first code of the order-preserving relationship is used to indicate the order-preserving interval based on the i-th group of order-preserving relations to which the first and second messages belong; for the i-th group of order-preserving relations, in the i-th group of order-preserving relations The second code of the second type of message based on the i-th group of order-preserving relations is used to indicate the first group of the i-th group of order-preserving relations within the order-preserving interval based on the i-th group of order-preserving relations to which the second message belongs Under the condition that some of the order-preserving relations in the N groups of order-preserving relations are direct order-preserving relations, and the other part of the order-preserving relations are indirect order-preserving relations, determine whether to execute the first order according to the code of the first message. The encoding process is as follows:
将第一报文的种类与每组保序关系(即直接保序关系和间接保序关系)中的第一种报文的种类和第二种报文的种类进行比对,以确定第一报文所属的保序关系,以及第一报文为其所属的保序关系中的哪种报文。第一报文所属的保序关系为直接保序关系;或者第一报文所属的保序关系为直接保序关系和间接保序关系)。Compare the type of the first message with the type of the first message and the type of the second message in each group of order-preserving relations (ie, direct order-preserving relations and indirect order-preserving relations) to determine the first The order-preserving relationship to which the message belongs, and which type of message in the order-preserving relationship to which the first message belongs. The order-preserving relationship to which the first message belongs is a direct order-preserving relationship; or the order-preserving relationship to which the first message belongs is a direct order-preserving relationship and an indirect order-preserving relationship).
若第一报文仅为第x组直接保序关系中的第一种报文,或者若第一报文为第x组直接保序关系中的第一种报文且第一报文为第q组间接保序关系中的第一种报文,则执行第一报文。由于第一报文仅为第x组直接保序关系中的第一种报文,或者第一报文为第x组直接保序关系中的第一种报文且第一报文为第q组间接保序关系中的第一种报文,因此可以确定第一报文的执行不受其他报文执行的限制,即第一报文为优先级最高的报文,从而在接收到第一报文之后可以直接执行第一报文。需要说明的是,x和q的取值的数量均可以为至少一个。即第一报文所属的第x组直接保序关系的数量为至少一个,第一报文所属的第q组间接保序关系的数量为至少一个。If the first message is only the first message in the x-th group of direct order-preserving relations, or if the first message is the first message in the x-th group of direct order-preserving relations and the first message is the first message For the first message in the q group of indirect order-preserving relations, the first message is executed. Because the first message is only the first message in the x-th group of direct order-preserving relations, or the first message is the first message in the x-th group of direct preserving relations and the first message is the qth message The first message in the group indirect order-preserving relationship, so it can be determined that the execution of the first message is not restricted by the execution of other messages, that is, the first message is the message with the highest priority, so that the first message is received The first message can be executed directly after the message. It should be noted that the number of values of x and q can both be at least one. That is, the number of the x-th group of direct order-preserving relations to which the first message belongs is at least one, and the number of the q-th group of indirect order-preserving relations to which the first message belongs is at least one.
若第一报文仅为第x组直接保序关系中的第二种报文,或者若第一报文为第x组直接保序关系中的第二种报文且第一报文为第j组直接保序关系中的第一种报文,则在根据第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行第一报文,其中,第一目标报文包括位于第一报文所属的基于第x组直接保序关系的保序区间内的第x组直接保序关系中的第一种报文和位于第一报文所属的基于第x组直接保序关系的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文。由于该过程的原理与上文方式一中的原理相同,因此此处不再进行赘述。需要说明的是,x的取值的数量为一个,j的取值数量为至少一个。If the first message is only the second type of message in the x-th group of direct order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the first For the first type of message in the j group of direct preserving relations, when it is determined that the first target message has been executed according to the first code and the second code of the first message based on the xth group of direct preserving relations, execute The first message, where the first target message includes the first type of message in the x-th group of direct order-preserving relations in the x-th group of direct-order preserving interval to which the first message belongs and the The first message in the x-th group of direct-order-preserving relations in the x-th group of direct-order preserving intervals before the order-preserving interval based on the x-th group of direct preserving relations to which the first message belongs. Since the principle of this process is the same as the principle in the above manner, it will not be repeated here. It should be noted that the number of values of x is one, and the number of values of j is at least one.
若第一报文为第x组直接保序关系中的第二种报文且第一报文为第j组直接保序关系中的第一种报文且第一报文为第q组间接保序关系中的第二种报文,或者若第一报文为第x组直接保序关系中的第二种报文且第一报文为第q组间接保序关系中的第二种报文,则在根据第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据第一报文基于第q组间接保序关系的第一编码和第二编码确定第二目标报文均已执行完成时,执行第一报文。其中,第一目标报文已经在上文中进行了说明,因此此处不再进行赘述。第二目标报文包括位于第一报文所属的基于第q组间接保序关系的 保序区间内的第q组间接保序关系中的第一种报文和位于第一报文所属的基于第q组间接保序关系的保序区间之前的保序区间内的第q组间接保序关系中的第一种报文。由于该过程的原理与上文方式一种的原理相同,因此此处不再进行赘述。需要说明的是,x的取值的数量为一个,j的取值的数量为至少一个,q的取值的数量为至少一个。在q的取值的数量为多个的情况下,在根据第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据第一报文基于每个第q组间接保序关系的第一编码和第二编码确定每个第q组间接保序关系对应的第二目标报文均已执行完成时,执行第一报文。需要说明的是,每个第q组间接保序关系对应的第二目标报文的概念均与上文中对第二目标报文的概念相同,且上文中已经对第二目标报文进行了说明,因此此处不再进行赘述。If the first message is the second message in the x-th group of direct order-preserving relations and the first message is the first message in the j-th group of direct order-preserving relations, and the first message is the qth group of indirect The second type of message in the order-preserving relationship, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the second type of the q-th group of indirect order-preserving relations Message, it is determined that the first target message has been executed according to the first code and the second code of the first message based on the direct sequence preservation relationship of the xth group, and according to the first message, the indirect sequence preservation is based on the qth group When the first code and the second code of the relationship determine that the execution of the second target message has been completed, the first message is executed. Among them, the first target message has been described above, so it will not be repeated here. The second target message includes the first message in the q-th group of indirect order-preserving relationships in the q-th group of indirect sequence-preserving interval to which the first message belongs, and the first message in the q-th group of indirect sequence-preserving relationships to which the first message belongs. The first message in the q-th group of indirect order-preserving relations in the order-preserving interval before the order-preserving interval of the q-th group of indirect order-preserving relations. Since the principle of this process is the same as the principle of the above method, it will not be repeated here. It should be noted that the number of values of x is one, the number of values of j is at least one, and the number of values of q is at least one. In the case that the number of values of q is multiple, it is determined that the first target message has been executed according to the first code and the second code of the first message based on the x-th group of direct order-preserving relationship, and according to the first message When a message determines that the second target message corresponding to each q-th group of indirect order-preserving relations has been executed based on the first code and the second code of each q-th group of indirect order-preserving relations, the first message is executed. It should be noted that the concept of the second target message corresponding to each q-th group of indirect order-preserving relationship is the same as the concept of the second target message above, and the second target message has been described above. , So I won’t repeat it here.
下面,以图2至图4为例为上述过程进行说明。若第一报文为图2至图4中的报文A8,那么由图2至图4可知,根据第一报文的编码可知第一报文为其所属的直接保序关系和间接保序关系中的第一种报文,因此,在接收到第一报文后直接执行第一报文;若第一报文为图2至图4中的报文B6,且第一报文基于第一组直接保序关系的编码为(0,1),则判断基于第一组直接保序关系的第一编码为0的报文A的执行数量是否等于1,若是,则执行第一报文。若第一报文为图2至图4中的多个报文中的报文E10,且第一报文基于第四组直接保序关系的编码为(1,1),第一报文基于第二组间接保序关系的编码为(1,2),则判断基于第四组直接保序关系的第一编码为0的报文C是否执行完成,若是,则判断基于第四组直接保序关系的第一编码为1的报文C的执行数量是否等于1,若是,则判断基于第二组间接保序关系的第一编码为0的报文A是否执行完成,若是,判断基于第二组间接保序关系的第一编码为1的报文A的执行数量是否等于2,若是,则执行第一报文。Hereinafter, the above process will be described by taking FIGS. 2 to 4 as an example. If the first message is message A8 in Figures 2 to 4, then it can be seen from Figures 2 to 4 that according to the encoding of the first message, it can be known that the first message belongs to the direct order preservation relationship and indirect order preservation The first message in the relationship, therefore, the first message is executed directly after the first message is received; if the first message is message B6 in Figures 2 to 4, and the first message is based on the first message The code of a group of direct preserving relations is (0,1), then it is judged whether the execution number of the message A whose first code is 0 based on the first direct preserving relation is equal to 1, if so, the first message is executed . If the first message is message E10 in the multiple messages in Figures 2 to 4, and the first message is based on the fourth group of direct sequence preservation, the code is (1,1), and the first message is based on The code of the second group of indirect preserving relations is (1,2), then it is judged whether the execution of the message C whose first code is 0 based on the fourth group of direct preserving relations is completed. If so, it is judged based on the fourth group of direct preserving relations. Whether the execution quantity of the message C with the first code of 1 in the order relationship is equal to 1, if yes, judge whether the execution of the message A with the first code of 0 based on the second group of indirect order preserving relations is completed, if it is, the judgment is based on the first Whether the execution quantity of the message A with the first code of 1 in the two groups of indirect sequence preservation relations is equal to 2, and if so, execute the first message.
需要说明的是,在基于每组保序关系(直接保序关系和间接保序关系)的保序区间的编号按照由小到大的顺序进行编号,即报文基于对应的保序关系(直接保序关系和间接保序关系)的第一编码均按照由小到大的顺序进行编码的条件下,若按照基于每组保序关系(直接保序关系和间接保序关系)的第一编码由小到大的顺序执行每组直接保序关系中的第一种报文,则确定是否执行第一报文的原理与方式一种确定是否执行第一报文的原理相同,因此此处不再进行赘述。It should be noted that the numbering of the preserving intervals based on each group of preserving relations (direct preserving relations and indirect preserving relations) is numbered in ascending order, that is, the messages are numbered based on the corresponding preserving relations (direct preserving relations). Under the condition that the first codes of order-preserving relations and indirect order-preserving relations are coded in ascending order, if the first codes are based on each group of order-preserving relations (direct order-preserving relations and indirect order-preserving relations) If the first message in each group of direct preserving relationship is executed in order from small to large, the principle and method of determining whether to execute the first message are the same as the principle of determining whether to execute the first message. Therefore, it is not here. Let me repeat it again.
方式三、在多个报文包括M类报文,M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每种报文进行保序,1≤k≤M-1且k和M均为整数;针对M类报文中的每类报文,每类报文的第一编码均用于指示报文所属的保序区间;在k=1的条件下,第1类报文的第二编码用于指示第1类报文在其所属的保序区间内的报文中的排列序号;在2≤k≤M-1的条件下,每个第k类报文的第二编码均包括第一编号和第二编号,第一编号用于指示第k类报文所属的保序区间内在第k类报文之前的第1类报文至第k-1类报文的数量,第二编号用于指示第k类报文在其所属的保序区间内的报文中的排列序号;针对第M类报文,第M类报文的第二编码均包括第一编号和第二编号,第一编号用于指示第M类报文所属的保序区间内在第M类报文之前的第1类报文至第M-1类报文的数量,第二编号用于指示第M类报文在其所属的保序区间内的报文中的排列序号的条件下,根据第一报文的编码确定是否执行第一报文的过程如下:Manner Three: Multiple messages include Type M messages. Each type of message in the M type includes one type of message. Among them, the k+1 type message directly depends on the k type message for protection. The k+1 type message indirectly depends on each type of message from the type 1 message to the type k-1 message for order preservation, 1≤k≤M-1 and k and M are integers; For each type of message in the M type of message, the first code of each type of message is used to indicate the order-preserving interval to which the message belongs; under the condition of k=1, the second code of the first type of message is used It indicates the sequence number of the first type of message in the message in the order-preserving interval to which it belongs; under the condition of 2≤k≤M-1, the second code of each k-th message includes the first Number and second number, the first number is used to indicate the number of type 1 messages to type k-1 messages before the k-th message in the order-preserving interval to which the k-th message belongs, and the second number is used It indicates the sequence number of the k-th message in the message in the order-preserving interval to which it belongs; for the M-th message, the second code of the M-th message includes the first number and the second number. A number is used to indicate the number of type 1 messages to type M-1 messages before the M-th message in the order-preserving interval to which the M-th message belongs, and the second number is used to indicate the number of the M-th message The process of determining whether to execute the first message according to the code of the first message under the condition of the sequence number in the message in the sequence preservation interval to which it belongs is as follows:
根据第一报文的种类确定第一报文属于哪一类报文,然后,根据第一报文所属的报文的类和第一报文的编码确定是否执行第一报文的过程如下:Determine which type of message the first message belongs to according to the type of the first message, and then determine whether to execute the first message according to the message class to which the first message belongs and the encoding of the first message:
若第一报文为第k类报文且k=1,则执行第一报文。由于第一报文为第1类报文,即第一报文为优先级最高的报文,其的执行不受其他报文的执行的限制,因此,在接收到第一报文后,可直接执行第一报文。If the first message is a k-th message and k=1, the first message is executed. Since the first message is a type 1 message, that is, the first message is the message with the highest priority, and its execution is not restricted by the execution of other messages. Therefore, after receiving the first message, you can Execute the first message directly.
若第一报文为第k类报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行第一报文,其中,第一目标报文包括第一报文所属的保序区间内位于第一报文之前的第1类报文至第k-1类报文和位于第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文。即第一报文为优先级低于最高优先级且高于最低优先级的报文,因此,第一报文的执行受排在其之前且比其优先级高的报文(即第1类报文至第k-1类报文)的执行的限制。下面举例对该过程进行说明,若保序区间的编号按照由小到大的顺序进行编号,即排在前面的保序区间的报文的第一编码小于排在后面的保序区间的报文的第一编码,则判断第一编码小于第一报文的第一编码的第1类报文至第k-1类报文(即优先级比第一报文的优先级高的报文)是否均已执行完成,若是,则根据第一编码与第一报文的第一编码相同的报文的第二编码(针对优先级最高的报文)或第二编码中的第二编号(针对优先级高于第一报文的优先级且低于最高优先级的报文)以及第一报文的第二编号判断在第一报文所属的保序区间内位于第一报文之前的第1类报文至第k-1类报文(优先级高于第一报文的优先级的报文)的执行数量是否等于第一报文的第一编号,若是,则执行第一报文。If the first message is the k-th message and 2≤k≤M-1, and it is determined that the first target message has been executed according to the first code, first number, and second number of the first message, then execute The first message, where the first target message includes the type 1 message to the k-1 type message located before the first message in the sequence preservation interval to which the first message belongs, and the first message to which the first message belongs The 1st message to the k-1th message in the preserving interval before the preserving interval of. That is, the first message is a message with a priority lower than the highest priority and higher than the lowest priority. Therefore, the execution of the first message is subject to the messages that are ranked before it and higher than its priority (that is, the first type of message). From the message to the k-1th message). The following example illustrates the process. If the numbers of the order-preserving intervals are numbered in ascending order, that is, the first code of the packets in the order-preserving interval in the front is smaller than that of the packets in the order-preserving interval in the back. The first code of the first message, then it is judged that the first code is smaller than the first code of the first message from the first message to the k-1th message (that is, the message with the priority higher than the priority of the first message) Whether the execution has been completed, if so, according to the second code of the message with the same first code as the first code of the first message (for the message with the highest priority) or the second number in the second code (for the message with the highest priority) The priority is higher than the priority of the first message and lower than the highest priority message) and the second number of the first message is judged to be the first message before the first message in the sequence preservation interval to which the first message belongs. Whether the number of executions of type 1 messages to type k-1 messages (messages with priority higher than the priority of the first message) is equal to the first number of the first message, if yes, execute the first message .
若第一报文为第M类报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行所述第一报文,其中,第二目标报文包括第一报文所属的保序区间内位于第一报文之前的第1类报文至第M-1类报文和位于第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文。即第一报文为优先级最低的报文,因此,第一报文的执行受排在其之前且比其优先级高的报文的限制。由于具体的判断原理与上文中第一报文为第k类报文且2≤k≤M-1中的判断原理相同,因此此处不再赘述。If the first message is an M-th message, and it is determined that the execution of the second target message has been completed according to the first code, first number, and second number of the first message, the first message is executed, where , The second target message includes the type 1 message to the M-1 type message in the order preserving interval to which the first message belongs and the type 1 message before the first message and the order preserving interval to which the first message belongs. Messages of Type 1 to Type M-1 in the order-preserving interval. That is, the first message is the message with the lowest priority. Therefore, the execution of the first message is restricted by the messages that are ranked before it and have a higher priority. Since the specific judgment principle is the same as the judgment principle in the above that the first message is the k-th message and 2≤k≤M-1, it will not be repeated here.
下面,以图7为例对上述过程进行说明。图7中的多个报文中的5种报文的优先级从高到低的排列顺序为:报文a>报文b>报文c>报文d>报文e,即第一类报文包括报文a,第二类报文包括报文b,第三类报文包括报文c,第四类报文包括报文d,第五类报文包括报文e。Hereinafter, the above process will be described by taking FIG. 7 as an example. The priority order of the five types of messages in the multiple messages in Figure 7 from high to low is: message a>message b>message c>message d>message e, that is, the first type The message includes message a, the second type message includes message b, the third type message includes message c, the fourth type message includes message d, and the fifth type message includes message e.
若第一报文为图7中的报文a10,由于第一报文为报文a,且报文a的优先级最高,即报文a为第1类报文,因此可直接执行报文a。If the first message is message a10 in Figure 7, since the first message is message a, and message a has the highest priority, that is, message a is a type 1 message, so the message can be executed directly a.
若第一报文为图7中的d6,由于第一报文的编号为(1,2,4),因此,若第一编号为0的且优先级高于报文d6的优先级的报文(即报文c1(0,0,1))均已执行完成,以及第一编号等于1且位于第一报文之前且优先级高于报文d6的优先级的报文(即报文c3(1,0,1)和报文a5(1,3)的执行数量等于2时,则执行第一报文。If the first message is d6 in Figure 7, since the number of the first message is (1,2,4), if the first number is 0 and the priority is higher than the priority of message d6 The message (ie message c1(0,0,1)) has been executed, and the first number is equal to 1 and is located before the first message and has a priority higher than that of message d6 (ie message When the execution number of c3(1,0,1) and message a5(1,3) is equal to 2, the first message is executed.
在第三种方式的基础上,若M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系报文进行保序,则根据第一报文的编码确定是否执行第一报文的过程如下:On the basis of the third method, if at least one type of message in the M type message includes multiple types of messages, one of the k+1 type messages directly depends on the k type message In order to preserve the order of the messages with the order-preserving relationship, one of the messages in the k+1 class indirectly depends on the order-preserving relations between the class 1 messages and the k-1 messages. To preserve the order, the process of determining whether to execute the first message according to the encoding of the first message is as follows:
根据第一报文的种类确定第一报文属于哪一类报文,然后,根据第一报文所属的报文的类和第一报文的编码确定是否执行第一报文的过程如下:Determine which type of message the first message belongs to according to the type of the first message, and then determine whether to execute the first message according to the message class to which the first message belongs and the encoding of the first message:
若第一报文为第k类报文中的第s种报文且k=1,则执行第一报文;If the first message is the s-th message in the k-th message and k=1, the first message is executed;
若第一报文为第k类报文中的第t种报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行所述第一报文,其中,第一目标报文包括第一报文所属的保序区间内位于第一报文之前的第1类报文至第k-1类报文中与第一报文存在保序关系(直接保序关系和间接保序关系)的报文和位于第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文中与第一报文存在保序关系(直接保序关系和间接保序关系)的报文;If the first message is the t-th message in the k-th message and 2≤k≤M-1, and the first target message is determined according to the first code, first number, and second number of the first message After the execution of the message is completed, the first message is executed, where the first target message includes the first message to the k-1th message in the sequence preservation interval to which the first message belongs. Messages that have an order-preserving relationship with the first message (direct order-preserving relationship and indirect order-preserving relationship) and the first type of message in the order-preserving interval before the order-preserving interval to which the first message belongs to Messages that have an order-preserving relationship (direct order-preserving relationship and indirect order-preserving relationship) with the first message among the k-1 messages;
若第一报文为第M类报文中的第q种报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行第一报文,其中,第二目标报文包括第一报文所属的保序区间内位于第一报文之前的第1类报文至第M-1类报文中与第一报文存在保序关系(直接保序关系和间接保序关系)的报文和位于第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文中与第一报文存在保序关系(直接保序关系和间接保序关系)的报文。If the first message is the q-th message in the M-th class message, and the second target message is determined to have been executed according to the first code, first number, and second number of the first message, then execute the first message A message, where the second target message includes the type 1 message before the first message in the order-preserving interval to which the first message belongs to the M-1 type message. The order relationship (direct order preservation relationship and indirect order preservation relationship) and the first message in the order preservation interval before the order preservation interval to which the first message belongs. A message that has an order-preserving relationship (direct order-preserving relationship and indirect order-preserving relationship).
需要说明的是上述原理与每类报文中仅包括一种报文的原理相同,因此此处不再进行赘述。It should be noted that the foregoing principle is the same as the principle that each type of message includes only one type of message, so it will not be repeated here.
下面,以图8为例对上述过程进行说明。图8中的多个报文中包括六种报文,分别为:报文A、报文B、报文C、报文D、报文E、报文F,其中,报文C直接依赖于报文A进行保序,报文D直接依赖于报文B进行保序,报文E直接依赖于报文C进行保序,报文F直接依赖于报文C进行保序,报文E间接依赖于报文A进行保序,报文F间接依赖于报文A进行保序。基于此,上述六种报文可以划分为三类报文,三类报文按照优先级由高到低的顺序依次为:第一类报文、第二类报文、第三类报文。其中,第一类报文包括报文A和报文B,第二类报文包括报文C和报文D,第三类报文包括报文F和报文F。Hereinafter, the above process will be described by taking FIG. 8 as an example. The multiple messages in Figure 8 include six types of messages, namely: message A, message B, message C, message D, message E, and message F. Among them, message C directly depends on Message A is in order, message D is directly dependent on message B for order protection, message E is directly dependent on message C for order protection, message F is directly dependent on message C for order protection, and message E is indirectly Rely on message A for order preservation, and message F indirectly depends on message A for order preservation. Based on this, the above-mentioned six types of messages can be divided into three types of messages, and the three types of messages are in descending order of priority: the first type of message, the second type of message, and the third type of message. Among them, the first type of message includes message A and message B, the second type of message includes message C and message D, and the third type of message includes message F and message F.
若第一报文为图8中的报文A8,由于第一报文为报文A,且报文A的优先级最高,因此可直接执行第一报文。If the first message is message A8 in FIG. 8, since the first message is message A, and message A has the highest priority, the first message can be executed directly.
若第一报文为图8中的报文D10,由于第一报文的编码为(1,1,5),因此,若第一编号为0的且优先级高于报文D10的优先级的报文(即报文B2(0,2))均已执行完成,且第一编号等于1且位于报文D10之前且优先级高于报文D10的优先级的报文(即报文B9(1,4))的执行数量等于1时,则执行第一报文。If the first message is message D10 in Figure 8, since the code of the first message is (1,1,5), if the first number is 0 and the priority is higher than the priority of message D10 The message (ie message B2(0,2)) has been executed, and the first number is equal to 1 and is located before message D10 and has a priority higher than that of message D10 (ie message B9 When the execution quantity of (1,4)) is equal to 1, the first message is executed.
若第一报文为图8中的报文E14,由于第一报文的编号为(2,1,2),因此,若第一编号为0的且优先级高于报文E14的优先级的报文(即报文C1(0,0,1)、报文A3(0,3))均已执行完成,且第一编号为1的且优先级高于报文E14的优先级的报文(报文C7(1,0,2)、报文A8(1,3)、报文A11(1,6))均已执行完成,且第一编号为2且位于报文E14之前且优先级高于报文E14的优先级的报文(即报文C13(2,0,1))的执行数量等于1时,则执行第一报文。If the first message is message E14 in Figure 8, since the number of the first message is (2,1,2), if the first number is 0 and the priority is higher than the priority of message E14 The message (ie message C1(0,0,1), message A3(0,3)) has been executed, and the first number is 1 and the priority is higher than the priority of message E14. Messages (message C7 (1,0,2), message A8 (1,3), message A11 (1,6)) have all been executed, and the first number is 2 and is before message E14 and has priority When the number of executions of messages with a priority level higher than that of message E14 (ie, message C13(2,0,1)) is equal to 1, the first message is executed.
需要说明的是,在第二模块执行第一报文之前,还可以判断第二模块是否为第一报文的终点模块,若是,则第二模块执行第一报文,若否,则将第一报文及其编码传输至下一个模块。判断第二模块是否为第一报文的终点模块的方式可以包括:在第一报文中携带终 点模块的标识信息(例如ip地址等),在第二模块接收到第一报文及其编码后,判断第一报文携带的终点模块的标识信息是否与第二模块的标识信息相同,若是,则第二模块为终点模块,若否,则第二模块不是终点模块。It should be noted that before the second module executes the first message, it can also be judged whether the second module is the end module of the first message. If it is, the second module executes the first message. A message and its code are transmitted to the next module. The method for determining whether the second module is the end module of the first message may include: carrying the identification information (such as ip address, etc.) of the end module in the first message, and receiving the first message and its code in the second module Then, it is judged whether the identification information of the end module carried in the first message is the same as the identification information of the second module, if so, the second module is the end module, and if not, the second module is not the end module.
由上可知,第二模块在接收到第一报文后,根据第一报文的编码即可快速的确定第一报文与多个报文中的其他报文的执行关系(即确定排在第一报文之前且限制第一报文执行的报文),实现了报文的保序传输,以及第二模块根据排在第一报文之前且限制第一报文执行的报文更加快速准确的确定是否执行第一报文,提高了报文执行的效率。It can be seen from the above that after receiving the first message, the second module can quickly determine the execution relationship between the first message and other messages in the multiple messages according to the encoding of the first message (that is, determine the Before the first message and restrict the execution of the first message), the order-preserving transmission of the message is realized, and the second module is faster according to the message that is ranked before the first message and restricts the execution of the first message Accurately determine whether to execute the first message, which improves the efficiency of message execution.
下面,将对本申请的应用场景进行说明。上述报文保序方法可以应用于数据传输系统,该数据传输系统可以包括多个服务器,其中服务器之间可以实现数据传输。其中,第一模块和第二模块可以为多个服务器中的一个服务器。数据传输系统还可以为基于SOC芯片的数据传输系统,其中,基于SOC芯片的数据传输系统可以包括多个模块,模块之间可以实现数据传输,第一模块和第二模块可以为多个模块中的一个模块。上述SOC芯片例如可以为:采用PCIe接口的服务器芯片、具备PCIe接口形态的存储芯片、具备PCIe接口的终端芯片以及具备PCIe接口的AI芯片等,此处不作特殊限定。Below, the application scenarios of this application will be described. The foregoing message sequence preservation method can be applied to a data transmission system, and the data transmission system may include multiple servers, among which data transmission can be realized between the servers. Wherein, the first module and the second module may be one server among multiple servers. The data transmission system can also be a data transmission system based on an SOC chip. The data transmission system based on an SOC chip can include multiple modules, and data transmission can be realized between the modules. The first module and the second module can be multiple modules. Of a module. The above-mentioned SOC chip may be, for example, a server chip with a PCIe interface, a memory chip with a PCIe interface form, a terminal chip with a PCIe interface, and an AI chip with a PCIe interface, etc., which are not specifically limited here.
下面,举例对采用PCIe的SOC芯片的数据传输系统的结构进行说明。图9示出了一种基于SOC芯片的数据传输系统的结构示意图。如图9所示,采用PCIe的SOC芯片的数据传输系统包括模块A、模块B、模块C、模块D、模块E、模块F等,该数据传输系统中传输的报文包括三种,分别为P报文、CPL报文、NP报文;其中,P报文和CPL报文为第一组保序关系,且CPL报文依赖于P报文进行保序;P报文和NP报文为第二组保序关系,且NP报文依赖于P报文进行保序。基于此,可以将该三种报文划分为两类报文,其中第一类报文包括P报文,第二类报文包括CPL报文和NP报文,第一类报文的优先级高于第二类报文,其中,P报文和CPL报文的保序关系为直接保序关系,P报文和NP报文的保序关系为直接保序关系。Hereinafter, the structure of the data transmission system using the PCIe SOC chip is described as an example. Figure 9 shows a schematic structural diagram of a data transmission system based on an SOC chip. As shown in Figure 9, the data transmission system using PCIe SOC chip includes module A, module B, module C, module D, module E, module F, etc. The data transmission system transmits three types of messages, namely P messages, CPL messages, and NP messages; among them, P messages and CPL messages are the first group of sequence preservation relationships, and CPL messages rely on P messages for sequence preservation; P messages and NP messages are The second group of order-preserving relationships, and NP messages rely on P messages for order-preserving. Based on this, the three types of messages can be divided into two types of messages. The first type of messages includes P messages, and the second type of messages includes CPL messages and NP messages. The priority of the first type of messages is It is higher than the second type of message, in which the order-preserving relationship between the P message and the CPL message is a direct order-preserving relationship, and the order-preserving relationship between the P message and the NP message is a direct order-preserving relationship.
在向采用PCIe的SOC芯片的数据传输系统输入报文的方向上,报文发送模块Serdes1按序向模块A发送第一报文,模块A对第一报文进行编码,具体的,模块A采用上述第一模块对报文的编码方式为第一报文设置编码,以及将第一报文及其编码发送至模块B。其中,模块A为数据输入方向上的起始模块。模块B接收第一报文及其编码,判断模块B是否为第一报文的终点模块,若是,则根据第一报文的编码确定是否执行第一报文,以及若确定执行第一报文,则基于第一报文并按照保序规则操作模块B中的存储器;若模块B不是第一报文的终点模块,则将第一报文及其编码发送至模块C,并在模块C中重复上述模块B的操作。需要说明的是,第一报文可以为P报文或CPL报文或NP报文。P报文、CPL报文以及NP报文在模块之间采用分道乱序传输的方式。In the direction of inputting the message to the data transmission system using PCIe SOC chip, the message sending module Serdes1 sends the first message to module A in order, and module A encodes the first message. Specifically, module A uses The above-mentioned first module encodes the message by setting the encoding for the first message, and sending the first message and its encoding to module B. Among them, module A is the initial module in the data input direction. Module B receives the first message and its code, determines whether module B is the end module of the first message, if so, determines whether to execute the first message according to the encoding of the first message, and if it is determined to execute the first message , Then operate the memory in module B based on the first message and in accordance with the order-preserving rules; if module B is not the end module of the first message, send the first message and its code to module C and store it in module C Repeat the operation of module B above. It should be noted that the first message may be a P message, a CPL message, or an NP message. P messages, CPL messages, and NP messages are transmitted in lanes and out of order between modules.
在采用PCIe的SOC芯片的数据传输系统输出报文的方向上,模块D对第一报文进行编码,具体的,模块D采用上述第一模块对报文的编码方式为第一报文设置编码,以及将第一报文及其编码发送至模块E。其中,模块D为数据输出方向上的起始模块。模块E接收第一报文及其编码,并将第一报文及其编码传输至模块F;模块F解析第一报文的编码,以恢复原始排列信息,并根据原始排列信息向报文接收模块Serdes2发送第一报文。In the direction of the output message of the data transmission system adopting the PCIe SOC chip, module D encodes the first message. Specifically, module D uses the encoding method of the first module to set the encoding for the first message. , And send the first message and its code to module E. Among them, module D is the initial module in the data output direction. Module E receives the first message and its code, and transmits the first message and its code to module F; Module F parses the code of the first message to restore the original arrangement information, and receives the message according to the original arrangement information The module Serdes2 sends the first message.
需要说明的是,第一报文可以为P报文或CPL报文或NP报文,以及采用分道乱序传输的方式在模块之间传输P报文、CPL报文以及NP报文。It should be noted that the first message can be a P message, a CPL message, or an NP message, and the P message, CPL message, and NP message are transmitted between modules in a lane-dividing and out-of-sequence transmission manner.
下面,举例对采用PCIe的SOC芯片的数据传输系统中的报文进行编码的方式进行说明。图10示出了对多个报文进行编码的示意图八,图11示出了对多个报文进行编码的示意图九。In the following, an example is given to describe the manner of encoding a message in a data transmission system using a PCIe SOC chip. FIG. 10 shows a schematic diagram eight of encoding multiple messages, and FIG. 11 shows a schematic diagram nine of encoding multiple messages.
模块A和模块D采用第一模块中的第一种方式为多种报文中的每个报文设置的编码如图10所示,其中,基于第一组保序关系对多个报文进行编码时,以CPL报文切换为P报文的节点作为划分节点对多个报文划分保序区间;基于第二组保序关系对多个报文进行编码时,以NP报文切换为P报文的节点作为划分节点对多个报文划分保序区间;具体的编码原理已经在上文中进行了说明,因此此处不再进行赘述。模块B、模块C、模块E、模块F等模块根据第一报文的编码确定是否执行第一报文的原理已经在上文中进行了说明,因此此处不再进行赘述。Module A and Module D use the first method in the first module to set the encoding for each of the multiple messages as shown in Figure 10. Among them, the multiple messages are performed based on the first set of order-preserving relationships. When encoding, the node where the CPL message is switched to the P message is used as the dividing node to divide the sequence preservation interval for multiple messages; when multiple messages are encoded based on the second set of sequence preservation relations, the NP message is switched to P The message node is used as a dividing node to divide the order-preserving interval for multiple messages; the specific coding principle has been explained above, so it will not be repeated here. The principle for modules such as module B, module C, module E, and module F to determine whether to execute the first message according to the encoding of the first message has been explained above, so it will not be repeated here.
模块A和模块D采用第一模块中的第二种方式为多种报文中的每个报文设置的编码如图11所示,其中,以CPL报文切换为P报文的节点作为划分节点对多个报文划分保序区间。模块B、模块C、模块E、模块F等模块根据第一报文的编码确定是否执行第一报文的原理已经在上文中进行了说明,因此此处不再进行赘述。Module A and Module D use the second method in the first module to set the encoding for each of the multiple messages as shown in Figure 11. Among them, the node where the CPL message is switched to the P message is used as the division The node divides the order-preserving interval for multiple messages. The principle for modules such as module B, module C, module E, and module F to determine whether to execute the first message according to the encoding of the first message has been explained above, so it will not be repeated here.
实验证明,本申请可以在没有保序通道且采用PCIe的SOC芯片的数据传输系统中实现报文的保序传输,并且最大效率的利用传输带宽。具体的,采用现有的保序机制,跑读写混合需要保序的场景比单跑读的性能下降25%左右,而采用本申请的保序机制,在芯片上实测的结果表明,跑读写混合需要保序的场景与单跑读的性能一样,无性能损失。Experiments have proved that this application can realize sequence-preserving transmission of messages in a data transmission system that does not have a sequence-preserving channel and adopts PCIe SOC chips, and utilizes the transmission bandwidth with the greatest efficiency. Specifically, using the existing order-preserving mechanism, the performance of a scene that requires order-preserving when running read-write mixing is about 25% lower than the performance of a single-run reading, while using the order-preserving mechanism of this application, the results of the actual measurement on the chip show that running reading Scenarios where write mixing needs to be sequenced have the same performance as single-run reads, with no performance loss.
图12为本申请实施例提供的一种报文保序装置的结构示意图一,如图12所示,该装置1200可以包括:第一接收模块1201、编码模块1202、发送模块1203,其中:第一接收模块1201,用于接收第一报文,其中,所述第一报文为多个报文中的任意一个;编码模块1202,用于根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码以得到所述第一报文的编码;发送模块1203,用于向第二模块发送所述第一报文及其编码;其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。Fig. 12 is a structural schematic diagram 1 of a message sequence preserving apparatus provided by an embodiment of the application. As shown in Fig. 12, the apparatus 1200 may include: a first receiving module 1201, an encoding module 1202, and a sending module 1203, where: A receiving module 1201, configured to receive a first message, where the first message is any one of a plurality of messages; an encoding module 1202, configured to receive the first message in the plurality of messages according to the The transmission sequence in the text and the order-preserving relationship between the first message and other messages in the plurality of messages encode the first message to obtain the encoding of the first message; sending module 1203, configured to send the first message and its code to the second module; wherein the code of the first message is used to indicate the first message and other messages in the plurality of messages The execution relationship.
在一种可能的实施方式中,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序。In a possible implementation, the multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first group of order-preserving relations. A message and a second message, and the second message depends on the first message for order preservation.
在一种可能的实施方式中,所述编码模块1202包括:第一编码单元,用于若所述第一报文为第i组保序关系中的第一种报文或第二种报文,则为所述第一报文设置基于所述第i组保序关系的第一编码,其中,所述第一编码用于指示所述第一报文所属的基于所述第i组保序关系的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为所述第i组保序关系中的第二种报文切换为第一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;以及第二编码单元,用于若所述第一报文为第i组保序关系中的第二种报文,则为所述第一报文设置基于所述第i组保序关系的第二编码,其中,所述第二编码用于指示所述第一报文所属的基于第i组保序关系的保序区间内的第一种报文的数量;其中,1≤i≤N且i为整数。In a possible implementation manner, the encoding module 1202 includes: a first encoding unit, configured to, if the first message is the first type of message or the second type of message in the i-th group of order-preserving relations , A first code based on the i-th group of order-preserving relationship is set for the first message, where the first code is used to indicate to which the first message belongs based on the i-th group of preserving The order-preserving interval of the relationship, the order-preserving interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is that the second type of message in the i-th group of order-preserving relations is switched to the first type of message The node of the message, the plurality of messages are sorted according to the sending order of each message of the plurality of messages; and the second coding unit is used to if the first message is the i-th group of order-preserving relations For the second type of message in the first message, a second code based on the i-th group of order-preserving relationship is set for the first message, where the second code is used to indicate the base-based code to which the first message belongs. The number of messages of the first type in the order-preserving interval of the i-th group of order-preserving relations; among them, 1≤i≤N and i is an integer.
在一种可能的实施方式中,所述N组保序关系中的每组保序关系均为直接保序关系;或者所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保 序关系。In a possible implementation, each of the N groups of order preserving relations is a direct preserving relationship; or a part of the N groups of preserving relations is a direct preserving relationship, The other part of the order-preserving relationship is the indirect order-preserving relationship.
在一种可能的实施方式中,所述多个报文包括3种报文,分别为P报文、NP报文、CPL报文,所述多个报文包括2组保序关系,所述2组保序关系均为直接保序关系;其中,第一组直接保序关系中的第一种报文为P报文,第一组直接保序关系中的第二种报文为CPL报文;第二组直接保序关系中的第一种报文为P报文,第二组直接保序关系中的第二种报文为NP报文。In a possible implementation manner, the multiple messages include three types of messages, which are P messages, NP messages, and CPL messages, respectively, and the multiple messages include two sets of order-preserving relationships. The two groups of order-preserving relations are all direct order-preserving relations; among them, the first type of message in the first group of direct order-preserving relations is a P message, and the second type of message in the first group of direct order-preserving relations is a CPL message. The first type of message in the second group of direct preserving relations is a P message, and the second type of message in the second group of direct preserving relations is an NP message.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;In a possible implementation manner, the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1≤k≤M- 1 and both k and M are integers;
所述编码模块1202包括:第一编码单元,用于为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文切换为所述第1类报文至第M-1类报文中的任意一类报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;第二编码单元,用于若所述第一报文为所述第k类报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第三编码单元,用于若所述第一报文为所述第k类报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第四编码单元,用于若所述第一报文为所述第M类报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。The encoding module 1202 includes: a first encoding unit, configured to set a first encoding for the first message, where the first encoding is used to indicate the order-preserving interval to which the first message belongs, and the order-preserving The interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is a node for switching from the M-th type of message to any one of the type 1 message to the M-1 type message , The multiple messages are sorted according to the transmission order of each of the multiple messages; the second coding unit is used to if the first message is the k-th message and k= 1. Set a second code for the first message, where the second code is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs; the third code Unit, configured to set a second code for the first message if the first message is the k-th message and 2≤k≤M-1, and the second code includes the first number And a second number, where the first number is used to indicate the number of type 1 messages to type k-1 messages before the first message in the order-preserving interval to which the first message belongs, so The second number is used to indicate the sequence number of the first message in the message in the order-preserving interval to which it belongs; the fourth coding unit is used to indicate if the first message is the M-th type message Message, a second code is set for the first message. The second code includes a first number and a second number. The number of Type 1 messages to Type M-1 messages before the first message, and the second number is used to indicate the number of messages in the sequence-preserving interval to which the first message belongs Arrange the serial number.
在一种可能的实施方式中,所述多个报文包括M类报文,所述M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系报文进行保序,1≤k≤M-1且k和M均为整数;In a possible implementation manner, the multiple messages include type M messages, and at least one type of messages in the M type messages includes multiple types of messages, and among them, the k+1 type messages A type of message directly depends on the order-preserving relationship between the k-th type of message and the order-preserving message, and a type of message in the k+1-th type of message indirectly depends on the type 1 message to the k-th type of message. In Type 1 messages, the order is preserved for the messages with the order-preserving relationship, 1≤k≤M-1 and both k and M are integers;
所述编码模块1202包括:第一编码单元,用于为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文中指定的一种报文或者任一种报文切换为第1类报文至第M-1类报文中指定的一种报文或者任一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;第二编码单元,用于若所述第一报文为所述第k类报文中的第s种报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;第三编码单元,用于若所述第一报文为所述第k类报文中的第t种报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文中与其存在保序关系的报文数量;第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列 序号;第四编码单元,用于若所述第一报文为所述第M类报文中的第q种报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文中与其存在保序关系的报文数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。The encoding module 1202 includes: a first encoding unit, configured to set a first encoding for the first message, where the first encoding is used to indicate the order-preserving interval to which the first message belongs, and the order-preserving The interval is obtained by dividing the plurality of messages by a dividing node, and the dividing node is a message specified in the M-th type of message or any type of message is switched to the first type of message to the M-1 type A message or a node of any message specified in the message, the plurality of messages are sorted according to the sending order of each message in the plurality of messages; the second coding unit is used if If the first message is the s-th message in the k-th message and k=1, then a second code is set for the first message, where the second code is used to indicate all The sequence number of the first message in the messages in the sequence preservation interval to which it belongs; the third coding unit is used if the first message is the t-th message in the k-th message And 2≤k≤M-1, a second code is set for the first message, and the second code includes a first number and a second number, where the first number is used to indicate the first The number of messages in the order-preserving interval to which the message belongs, from the type 1 message to the type k-1 message that precedes the first message; the second number is used to indicate the first message The sequence number of the message in the message in the order-preserving interval to which it belongs; the fourth coding unit is used for if the first message is the q-th message in the M-th type message, it is The first message is provided with a second code, and the second code includes a first number and a second number, wherein the first number is used to indicate that the first message belongs to the sequence preservation interval in the first message. The number of messages with a preserving relationship between the first message to the M-1 class message before a message, and the second number is used to indicate that the first message is in the preserving interval to which it belongs The sequence number in the message within.
在一种可能的实施方式中,所述多个报文包括2类报文,其中,第一类报文包括P报文,第二类报文包括NP报文和CPL报文,所述NP报文依赖于所述P报文进行保序,所述CPL报文依赖于所述P报文进行保序。In a possible implementation manner, the multiple messages include two types of messages, where the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages. The message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
本申请的上述装置,可以用于执行图1中的第一模块所执行的方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The above-mentioned device of the present application can be used to execute the technical solution of the method embodiment executed by the first module in FIG.
图13为本申请实施例提供的一种报文保序装置的结构示意图二,如图13所示,该装置1300可以包括:第二接收模块1301、确定模块1302,其中:第二接收模块1301,用于接收第一模块发送的第一报文及其编码,其中所述第一报文为多个报文中的任意一个报文;确定模块1302,用于根据所述第一报文的编码确定是否执行所述第一报文;其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。FIG. 13 is a second structural diagram of a message sequence preserving device provided by an embodiment of the application. As shown in FIG. 13, the device 1300 may include: a second receiving module 1301, a determining module 1302, wherein: a second receiving module 1301 , For receiving the first message and its code sent by the first module, where the first message is any one of a plurality of messages; the determining module 1302 is for receiving the first message according to the The encoding determines whether to execute the first message; wherein the encoding of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages.
在一种可能的实现方式中,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序;针对第i组保序关系,所述第i组保序关系中的第一种报文和第二种报文基于所述第i组保序关系的第一编码用于指示所述第一种报文和所述第二种报文所属的基于所述第i组保序关系的保序区间;针对第i组保序关系,所述第i组保序关系中的第二种报文基于所述第i组保序关系的第二编码用于指示所述第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量。In a possible implementation manner, the multiple messages include N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of order-preserving relations in the N groups of order-preserving relations includes the first The second type of message and the second type of message, and the second type of message depends on the first type of message for order preservation; for the i-th group of order-preserving relations, the first group of the i-th group of order-preserving relations The first code of one type of message and the second type of message based on the i-th group of preserving relationship is used to indicate to which the first type of message and the second type of message belong based on the i-th group of preserving The order-preserving interval of the order relationship; for the i-th group of order-preserving relations, the second message in the i-th group of order-preserving relations is based on the second code of the i-th group of order-preserving relations to indicate the second The number of the first type of message in the i-th group of order-preserving relations in the order-preserving interval based on the i-th group of order-preserving relations to which this kind of message belongs.
在一种可能的实现方式中,在所述N组保序关系中的每组保序关系均为直接保序关系的条件下,所述确定模块1302包括:第一执行单元,用于若所述第一报文为第x组直接保序关系中的第一种报文,则执行所述第一报文;第二执行单元,用于若所述第一报文为第x组直接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文,其中,第一目标报文包括位于所述第一报文所属的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;其中,1≤x≤N,且x为整数。In a possible implementation manner, under the condition that each of the N groups of order-preserving relations is a direct order-preserving relationship, the determining module 1302 includes: a first execution unit, configured to: If the first message is the first message in the x-th group of direct order-preserving relationship, then the first message is executed; the second execution unit is configured to if the first message is the x-th group of direct preserving For the second type of message in the sequence relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the x-th group of direct sequence preservation relationship, the execution The first message, where the first target message includes the first type of message in the x-th group of direct sequence preserving relationships in the sequence preserving interval to which the first message belongs, and the first message in the first message belonging to The first type of message in the x-th group of direct order-preserving relations in the order-preserving interval before the order-preserving interval; where 1≤x≤N, and x is an integer.
在一种可能的实现方式中,在所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系的条件下,所述确定模块1302包括:第一执行单元,用于若所述第一报文仅为第x组直接保序关系中的第一种报文,或者若所述第一报文为第x组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第一种报文,则执行所述第一报文;第二执行单元,用于若所述第一报文仅为第x组直接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文;第三执行单元,用于若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j 组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第q组间接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据所述第一报文基于第q组间接保序关系的第一编码和第二编码确定第二目标报文均已执行完成时,执行所述第一报文;其中,第一目标报文包括位于所述第一报文所属的基于第x组直接保序关系的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的基于第x组直接保序关系的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;第二目标报文包括位于所述第一报文所属的基于第q组间接保序关系的保序区间内的第q组间接保序关系中的第一种报文和位于所述第一报文所属的基于第q组间接保序关系的保序区间之前的保序区间内的第q组间接保序关系中的第一种报文。In a possible implementation manner, under the condition that a part of the N groups of order-preserving relations is a direct order-preserving relationship, and the other part of the order-preserving relations is an indirect order-preserving relationship, the determining module 1302 includes: The first execution unit is configured to: if the first message is only the first message in the x-th group of direct order-preserving relations, or if the first message is the first message in the x-th group of direct order-preserving relations A message and the first message is the first message in the q-th group of indirect order-preserving relations, then the first message is executed; the second execution unit is configured to execute the first message if the first message Only the second type of message in the x-th group of direct order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the jth group For the first type of message in the group direct preserving relationship, when it is determined that the first target message has been executed according to the first message based on the first code and the second code of the x-th group direct preserving relationship, Execute the first message; a third execution unit, configured to: if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the j-th group of direct-preserving messages The first message in the sequence relationship and the first message is the second message in the q-th group of indirect sequence-preserving relationships, or if the first message is the x-th group of direct sequence-preserving messages The second type of message and the first message is the second type of message in the q-th group of indirect order-preserving relations, then according to the first message based on the first code and the x-th group of direct order-preserving relations When the second code determines that the execution of the first target message has been completed, and the execution of the second target message has been completed according to the first code and the second code of the first message based on the q-th group of indirect sequence preservation relationship, Execute the first message; wherein, the first target message includes the first group of the x-th group of direct order-preserving relations located in the x-th group of direct-order preserving interval to which the first message belongs A message and a message of the first type in the x-th group of direct-order-preserving relationship located in the preserving interval based on the x-th group of direct-order preserving interval to which the first message belongs; the second target The message includes the first message in the q-th group of indirect order-preserving relations in the q-th group of indirect order-preserving interval to which the first message belongs and the first message in the qth group of indirect order-preserving relations. The first message in the q-th group of indirect order-preserving relations in the order-preserving interval before the order-preserving interval based on the q-th group of indirect order-preserving relations.
在一种可能的实现方式中,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;针对所述M类报文中的每类报文,所述每类报文的第一编码均用于指示所述报文所属的保序区间;在k=1的条件下,第1类报文的第二编码用于指示所述第1类报文在其所属的保序区间内的报文中的排列序号;在2≤k≤M-1的条件下,每个第k类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第k类报文所属的保序区间内在所述第k类报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第k类报文在其所属的保序区间内的报文中的排列序号;针对第M类报文,所述第M类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第M类报文所属的保序区间内在所述第M类报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第M类报文在其所属的保序区间内的报文中的排列序号。In a possible implementation manner, the multiple messages include type M messages, and each type of message in the M type messages includes one type of message, wherein the k+1 type message directly Rely on the k-th message for order preservation, the k+1 message indirectly depends on each type of message from the 1st message to the k-1 message for order preservation, 1≤k≤M- 1 and k and M are integers; for each type of message in the M type of message, the first code of each type of message is used to indicate the order-preserving interval to which the message belongs; where k= Under the condition of 1, the second code of the type 1 message is used to indicate the sequence number of the type 1 message in the message in the sequence preservation interval to which it belongs; under the condition of 2≤k≤M-1 Below, the second code of each k-th message includes a first number and a second number, and the first number is used to indicate that the k-th message belongs in the order-preserving interval to which the k-th message belongs. The number of type 1 messages to type k-1 messages before the message, where the second number is used to indicate the sequence number of the type k message in the message in the sequence preservation interval to which it belongs; For the M-th message, the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval. The number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
在一种可能的实现方式中,所述确定模块1302包括:第一执行单元,用于若所述第一报文为所述第k类报文且k=1,则执行所述第一报文;第二执行单元,用于若所述第一报文为所述第k类报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行所述第一报文,其中,所述第一目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第k-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文;第三执行单元,用于若所述第一报文为第M类报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行所述第一报文,其中,所述第二目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第M-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文。In a possible implementation manner, the determining module 1302 includes: a first executing unit, configured to execute the first message if the first message is the k-th message and k=1 The second execution unit, if the first message is the k-th message and 2≤k≤M-1, and according to the first code, first number and second If the number determines that the execution of the first target message has been completed, the first message is executed, where the first target message includes the sequence preserving interval to which the first message belongs and is located before the first message Type 1 messages to type k-1 messages, and type 1 messages to type k-1 messages in the order-preserving interval before the order-preserving interval to which the first message belongs; third The execution unit is configured to: if the first message is an M-th message, and it is determined that the execution of the second target message has been completed according to the first code, the first number, and the second number of the first message, then execute all The first message, wherein the second target message includes the type 1 message to the M-1 type message that are located before the first message in the order-preserving interval to which the first message belongs And the first message to the M-1th message in the sequence preserving interval before the sequence preserving interval to which the first message belongs.
本申请的上述装置,可以用于执行图1中的第二模块所执行的方法实施例的技术方案,其实现原理和技术效果类似,此处不再赘述。The above-mentioned device of the present application can be used to execute the technical solution of the method embodiment executed by the second module in FIG.
本申请还提供一种计算机可读存储介质,包括计算机程序,所述计算机程序在计算机上被执行时,使得所述计算机执行图1中的第一模块所执行的任一项方法或者图1中的第二模块所执行的任一项方法。The present application also provides a computer-readable storage medium, including a computer program, which when executed on a computer, causes the computer to execute any one of the methods executed by the first module in FIG. 1 or the method in FIG. 1 Any method performed by the second module.
本申请还提供一种计算机程序,当所述计算机程序被计算机执行时,用于执行图1中 的第一模块所执行的任一项方法或者图1中的第二模块所执行的任一项方法。This application also provides a computer program, when the computer program is executed by a computer, it is used to execute any one of the methods executed by the first module in FIG. 1 or any one executed by the second module in FIG. 1 method.
本申请还提供一种芯片,包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于调用并运行所述存储器中存储的计算机程序,以执行图1中的第一模块所执行的任一项方法或者图1中的第二模块所执行的任一项方法。The present application also provides a chip including a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the first module in FIG. 1 Any method executed or any method executed by the second module in FIG. 1.
进一步地,所述芯片还可以包括存储器和通信接口。所述通信接口可以是输入/输出接口、管脚或输入/输出电路等。Further, the chip may also include a memory and a communication interface. The communication interface may be an input/output interface, a pin, an input/output circuit, or the like.
在实现过程中,上述方法实施例的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。处理器可以是通用处理器、数字信号处理器(digital signal processor,DSP)、特定应用集成电路(application-specific integrated circuit,ASIC)、现场可编程门阵列(field programmable gate array,FPGA)或其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等。本申请实施例公开的方法的步骤可以直接体现为硬件编码处理器执行完成,或者用编码处理器中的硬件及软件模块组合执行完成。软件模块可以位于随机存储器,闪存、只读存储器,可编程只读存储器或者电可擦写可编程存储器、寄存器等本领域成熟的存储介质中。该存储介质位于存储器,处理器读取存储器中的信息,结合其硬件完成上述方法的步骤。In the implementation process, the steps of the foregoing method embodiments may be completed by hardware integrated logic circuits in the processor or instructions in the form of software. The processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA), or other Programming logic devices, discrete gates or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application may be directly embodied as being executed and completed by a hardware encoding processor, or executed and completed by a combination of hardware and software modules in the encoding processor. The software module can be located in a mature storage medium in the field, such as random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, registers. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
上述各实施例中提及的存储器可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(dynamic RAM,DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data rate SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。应注意,本文描述的系统和方法的存储器旨在包括但不限于这些和任意其它适合类型的存储器。The memory mentioned in the above embodiments may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory can be read-only memory (ROM), programmable read-only memory (programmable ROM, PROM), erasable programmable read-only memory (erasable PROM, EPROM), and electrically available Erase programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), and synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM) ) And direct memory bus random access memory (direct rambus RAM, DR RAM). It should be noted that the memories of the systems and methods described herein are intended to include, but are not limited to, these and any other suitable types of memories.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions are executed by hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the system, device and unit described above can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显 示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method can be implemented in other ways. For example, the device embodiments described above are merely illustrative, for example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components may be combined or It can be integrated into another system, or some features can be ignored or not implemented. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, the functional units in the various embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(个人计算机,服务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(read-only memory,ROM)、随机存取存储器(random access memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of 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 technical solution of the present application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (personal computer, server, or network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (read-only memory, ROM), random access memory (random access memory, RAM), magnetic disks or optical disks and other media that can store program codes. .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (31)

  1. 一种报文保序方法,其特征在于,包括:A method for preserving message sequence, which is characterized in that it includes:
    接收第一报文,其中,所述第一报文为多个报文中的任意一个;Receiving a first message, where the first message is any one of a plurality of messages;
    根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码以得到所述第一报文的编码;Encoding the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages To obtain the encoding of the first message;
    向第二模块发送所述第一报文及其编码;Sending the first message and its code to the second module;
    其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。Wherein, the code of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages.
  2. 如权利要求1所述的方法,其特征在于,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序。The method of claim 1, wherein the plurality of messages comprise N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of the N groups of order-preserving relations Both include the first type of message and the second type of message, and the second type of message depends on the first type of message for order preservation.
  3. 如权利要求2所述的方法,其特征在于,所述根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码包括:The method according to claim 2, characterized in that, according to the sending order of the first message in the plurality of messages and the first message and the other of the plurality of messages Encoding the first message with the message sequence preservation relationship includes:
    若所述第一报文为第i组保序关系中的第一种报文或第二种报文,则为所述第一报文设置基于所述第i组保序关系的第一编码,其中,所述第一编码用于指示所述第一报文所属的基于所述第i组保序关系的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为所述第i组保序关系中的第二种报文切换为第一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;以及If the first message is the first message or the second message in the i-th group of order-preserving relations, set a first code based on the i-th group of order-preserving relations for the first message , Wherein the first code is used to indicate the order-preserving interval based on the i-th group of order-preserving relationship to which the first message belongs, and the order-preserving interval is obtained by dividing the plurality of messages by a dividing node , The division node is a node where the second type of message in the i-th group of order-preserving relationship is switched to the first type of message, and the plurality of messages are based on each of the plurality of messages The order of sending; and
    若所述第一报文为第i组保序关系中的第二种报文,则为所述第一报文设置基于所述第i组保序关系的第二编码,其中,所述第二编码用于指示所述第一报文所属的基于第i组保序关系的保序区间内的第一种报文的数量;If the first message is the second type of message in the i-th group of order-preserving relations, then a second code based on the i-th group of order-preserving relations is set for the first message, wherein the The second code is used to indicate the number of messages of the first type in the sequence-preserving interval based on the i-th group sequence-preserving relationship to which the first message belongs;
    其中,1≤i≤N且i为整数。Wherein, 1≤i≤N and i is an integer.
  4. 如权利要求2或3所述的方法,其特征在于,所述N组保序关系中的每组保序关系均为直接保序关系;或者所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系。The method according to claim 2 or 3, wherein each of the N groups of order-preserving relations is a direct order-preserving relationship; or a part of the order-preserving relations in the N groups of order-preserving relations It is a direct order-preserving relationship, and the other part of the order-preserving relationship is an indirect order-preserving relationship.
  5. 如权利要求2~4中任一项所述的方法,其特征在于,所述多个报文包括3种报文,分别为P报文、NP报文、CPL报文,所述多个报文包括2组保序关系,所述2组保序关系均为直接保序关系;The method according to any one of claims 2 to 4, wherein the multiple messages include three types of messages, namely, a P message, an NP message, and a CPL message, and the multiple messages The article includes two sets of order-preserving relations, and the two sets of order-preserving relations are all direct-order preserving relations;
    其中,第一组直接保序关系中的第一种报文为P报文,第一组直接保序关系中的第二种报文为CPL报文;第二组直接保序关系中的第一种报文为P报文,第二组直接保序关系中的第二种报文为NP报文。Among them, the first type of message in the first group of direct order preserving relations is a P message, and the second type of message in the first group of direct preserving relations is a CPL message; the second group of direct order preserving relations is the first message. One type of message is a P message, and the second type of message in the second group of direct sequence preservation relationships is an NP message.
  6. 如权利要求1所述的方法,其特征在于,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;The method according to claim 1, wherein the plurality of messages comprise type M messages, and each type of message in the M type messages includes a type of message, wherein the k+1th message Class messages directly depend on the k-th message for order protection, and the k+1 messages indirectly depend on each type of message from the first message to the k-1 message for order protection, 1≤ k≤M-1 and both k and M are integers;
    所述根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码包括:Said processing the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding includes:
    为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文切换为所述第1类报文至第M-1类报文中的任意一类报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;Setting a first code for the first message, where the first code is used to indicate the sequence-preserving interval to which the first message belongs, and the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, The dividing node is a node where the M-th message is switched to any one of the first message to the M-1 message, and the multiple messages are in accordance with the multiple messages. The sending order of each message in
    若所述第一报文为所述第k类报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;If the first message is the k-th message and k=1, then a second code is set for the first message, where the second code is used to indicate that the first message is The sequence number in the message in the order-preserving interval to which it belongs;
    若所述第一报文为所述第k类报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;If the first message is the k-th message and 2≤k≤M-1, a second code is set for the first message, and the second code includes a first number and a second number The first number is used to indicate the number of type 1 messages to type k-1 messages before the first message in the order-preserving interval to which the first message belongs, and the second number Used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs;
    若所述第一报文为所述第M类报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。If the first message is the M-th message, a second code is set for the first message. The second code includes a first number and a second number, and the first number is used for Indicates the number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the first message belongs, and the second number is used to indicate the first message The sequence number of the message in the message in the preserving interval to which it belongs.
  7. 如权利要求1所述的方法,其特征在于,所述多个报文包括M类报文,所述M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系的报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系的报文进行保序,1≤k≤M-1且k和M均为整数;The method according to claim 1, wherein the plurality of messages comprise type M messages, and at least one type of message in the type M messages comprises multiple types of messages, wherein the k+1th message A kind of message in the class of messages directly depends on the messages in the k-th class of messages with which it has an order-preserving relationship for order preservation, and a kind of messages in the k+1 class of messages indirectly depends on the first class of messages. From the message to the k-1th type of message, the order is preserved with the message with which it has an order-preserving relationship, 1≤k≤M-1 and both k and M are integers;
    所述根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码包括:Said processing the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding includes:
    为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文中指定的一种报文或者任一种报文切换为第1类报文至第M-1类报文中指定的一种报文或者任一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;Setting a first code for the first message, where the first code is used to indicate the sequence-preserving interval to which the first message belongs, and the sequence-preserving interval is obtained by dividing the plurality of messages by a dividing node, The dividing node is a type of message or any type of message designated in the M-th type of message is switched to a type of message or any type of message designated in the M-1 type of message. The node of the message, the plurality of messages are sorted according to the sending order of each message of the plurality of messages;
    若所述第一报文为所述第k类报文中的第s种报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;If the first message is the s-th message in the k-th message and k=1, then a second code is set for the first message, where the second code is used to indicate The sequence number of the first message in the message in the sequence preservation interval to which it belongs;
    若所述第一报文为所述第k类报文中的第t种报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文中与其存在保序关系的报文数量;第二编号用于指示所述第一报文在其所属的保序区间内的报文中 的排列序号;If the first message is a t-th message in the k-th message and 2≤k≤M-1, then a second code is set for the first message, and the second code includes The first number and the second number, where the first number is used to indicate the type 1 message to the k-1 type message before the first message in the sequence preservation interval to which the first message belongs The number of messages in the text with which there is a sequence-preserving relationship; the second number is used to indicate the sequence number of the first message in the message within the sequence-preserving interval to which it belongs;
    若所述第一报文为所述第M类报文中的第q种报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文中与其存在保序关系的报文数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。If the first message is the q-th message in the M-th message, a second code is set for the first message, and the second code includes a first number and a second number, Wherein, the first number is used to indicate the sequence-preserving relationship between the first message to the M-1th message in the sequence-preserving interval to which the first message belongs The number of messages, where the second number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs.
  8. 如权利要求6或7所述的方法,其特征在于,所述多个报文包括2类报文,其中,第一类报文包括P报文,第二类报文包括NP报文和CPL报文,所述NP报文依赖于所述P报文进行保序,所述CPL报文依赖于所述P报文进行保序。The method according to claim 6 or 7, wherein the multiple messages include two types of messages, wherein the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages. Message, the NP message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
  9. 一种报文保序方法,其特征在于,包括:A method for preserving message sequence, which is characterized in that it includes:
    接收第一模块发送的第一报文及其编码,其中所述第一报文为多个报文中的任意一个报文;Receiving a first message and its code sent by the first module, where the first message is any one of a plurality of messages;
    根据所述第一报文的编码确定是否执行所述第一报文;Determining whether to execute the first message according to the encoding of the first message;
    其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。Wherein, the code of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages.
  10. 如权利要求9所述的方法,其特征在于,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序;The method according to claim 9, wherein the plurality of messages comprise N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of the N groups of order-preserving relations Both include the first type of message and the second type of message, and the second type of message depends on the first type of message for order preservation;
    针对第i组保序关系,所述第i组保序关系中的第一种报文和第二种报文基于所述第i组保序关系的第一编码用于指示所述第一种报文和所述第二种报文所属的基于所述第i组保序关系的保序区间;For the i-th group of order-preserving relations, the first type of message and the second type of messages in the i-th group of order-preserving relations are based on the first code of the i-th group of order-preserving relations to indicate the first type The message and the sequence-preserving interval based on the i-th group sequence-preserving relationship to which the second-type message belongs;
    针对第i组保序关系,所述第i组保序关系中的第二种报文基于所述第i组保序关系的第二编码用于指示所述第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量。Regarding the i-th group of order-preserving relations, the second type of message in the i-th group of order-preserving relations based on the second code of the i-th group of order-preserving relations is used to indicate to which the second type of message belongs based on the The number of messages of the first type in the i-th group of order-preserving relations in the order-preserving interval of the i group of order-preserving relations.
  11. 如权利要求10所述的方法,其特征在于,在所述N组保序关系中的每组保序关系均为直接保序关系的条件下,所述根据所述第一报文的编码确定是否执行所述第一报文包括:The method according to claim 10, characterized in that, under the condition that each of the N groups of order-preserving relations is a direct order-preserving relation, the determining according to the encoding of the first message Whether to execute the first message includes:
    若所述第一报文为第x组直接保序关系中的第一种报文,则执行所述第一报文;If the first message is the first message in the x-th group of direct sequence preservation relations, execute the first message;
    若所述第一报文为第x组直接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文,其中,第一目标报文包括位于所述第一报文所属的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;If the first message is the second type of message in the x-th group of direct preserving relations, the first message is determined based on the first code and the second code of the x-th group of direct preserving relations. When a target message has been executed, the first message is executed, where the first target message includes the first message in the xth group of direct sequence preserving relationships within the sequence preserving interval to which the first message belongs One type of message and the first type of message in the x-th group of direct order-preserving relations located in the order-preserving interval before the order-preserving interval to which the first message belongs;
    其中,1≤x≤N,且x为整数。Among them, 1≤x≤N, and x is an integer.
  12. 如权利要求10所述的方法,其特征在于,在所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系的条件下,所述根据所述第一报文的编码确定是否执行所述第一报文包括:The method according to claim 10, characterized in that, under the condition that a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relation, and the other part of the order-preserving relations is an indirect order-preserving relation, the basis The encoding of the first message to determine whether to execute the first message includes:
    若所述第一报文仅为第x组直接保序关系中的第一种报文,或者若所述第一报文为第x组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第一种报文,则执行所述第一报文;If the first message is only the first message in the x-th group of direct order-preserving relations, or if the first message is the first message in the x-th group of direct preserving relations and the If the first message is the first message in the q-th group of indirect order-preserving relations, the first message is executed;
    若所述第一报文仅为第x组直接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文;If the first message is only the second type of message in the x-th group of direct order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the The first message is the first message in the j-th group of direct order-preserving relations, and the first target message is determined based on the first code and the second code of the x-th group of direct-order preserving relations according to the first message. When the execution of the text has been completed, execute the first message;
    若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第q组间接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据所述第一报文基于第q组间接保序关系的第一编码和第二编码确定第二目标报文均已执行完成时,执行所述第一报文;If the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the first type of message in the j-th group of direct order-preserving relations, and the first message is The message is the second type of message in the qth group of indirect order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the qth group For the second type of message in the group indirect order preserving relationship, it is determined that the first target message has been executed according to the first code and the second code of the x-th group of direct preserving relationship based on the first message, and Executing the first message when it is determined that the execution of the second target message has been completed according to the first code and the second code of the q-th group of indirect order-preserving relationship of the first message;
    其中,第一目标报文包括位于所述第一报文所属的基于第x组直接保序关系的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的基于第x组直接保序关系的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;Wherein, the first target message includes the first message in the x-th group of direct order-preserving relations in the x-th group of direct-order preserving interval to which the first message belongs, and the first type of messages in the xth group of direct order preserving relations. The first type of message in the xth group of direct preserving relations in the preserving interval before the preserving interval based on the xth group of direct preserving relations to which a message belongs;
    第二目标报文包括位于所述第一报文所属的基于第q组间接保序关系的保序区间内的第q组间接保序关系中的第一种报文和位于所述第一报文所属的基于第q组间接保序关系的保序区间之前的保序区间内的第q组间接保序关系中的第一种报文。The second target message includes the first message in the q-th group of indirect sequence-preserving relations in the q-th group of indirect sequence-preserving interval to which the first message belongs, and the first message in the first message. The first type of message in the q-th group of indirect order-preserving relations in the order-preserving interval before the order-preserving interval based on the q-th group of indirect order-preserving relations to which the text belongs.
  13. 如权利要求9所述的方法,其特征在于,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;The method according to claim 9, wherein the plurality of messages comprise M messages, and each of the M messages includes one kind of message, wherein the k+1th message Class messages directly depend on the k-th message for order protection, and the k+1 messages indirectly depend on each type of message from the first message to the k-1 message for order protection, 1≤ k≤M-1 and both k and M are integers;
    针对所述M类报文中的每类报文,所述每类报文的第一编码均用于指示所述报文所属的保序区间;For each type of message in the M type of message, the first code of each type of message is used to indicate the order-preserving interval to which the message belongs;
    在k=1的条件下,第1类报文的第二编码用于指示所述第1类报文在其所属的保序区间内的报文中的排列序号;Under the condition of k=1, the second code of the type 1 message is used to indicate the sequence number of the type 1 message in the message in the sequence preservation interval to which it belongs;
    在2≤k≤M-1的条件下,每个第k类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第k类报文所属的保序区间内在所述第k类报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第k类报文在其所属的保序区间内的报文中的排列序号;Under the condition of 2≤k≤M-1, the second code of each k-th message includes a first number and a second number, and the first number is used to indicate to which the k-th message belongs The number of type 1 messages to type k-1 messages before the k-th message in the order-preserving interval, and the second number is used to indicate the order-preserving to which the k-th message belongs The sequence number of the packets in the interval;
    针对第M类报文,所述第M类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第M类报文所属的保序区间内在所述第M类报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第M类报文在其所属的保序区间内的报文中的排列序号。For the M-th message, the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval. The number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
  14. 如权利要求13所述的方法,其特征在于,所述根据所述第一报文的编码确定是否执行所述第一报文包括:The method of claim 13, wherein the determining whether to execute the first message according to the encoding of the first message comprises:
    若所述第一报文为所述第k类报文且k=1,则执行所述第一报文;If the first message is the k-th type message and k=1, execute the first message;
    若所述第一报文为所述第k类报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行所述第一报文,其中,所述第一目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第k-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文;If the first message is the k-th message and 2≤k≤M-1, and it is determined that the first target message has been executed according to the first code, first number, and second number of the first message When completed, execute the first message, where the first target message includes the type 1 message to the kth message that are located before the first message in the sequence preservation interval to which the first message belongs. -1 type messages and type 1 messages to k-1 type messages in the order preserving interval before the order preserving interval to which the first message belongs;
    若所述第一报文为第M类报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行所述第一报文,其中,所述第二目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第M-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文。If the first message is an M-th message, and it is determined that the execution of the second target message has been completed according to the first code, first number, and second number of the first message, then execute the first message , Wherein the second target message includes the type 1 message to the M-1 type message that are located before the first message in the order-preserving interval to which the first message belongs, and the message that is located in the first message. Messages of type 1 to type M-1 in the order-preserving interval before the order-preserving interval to which a message belongs.
  15. 一种报文保序装置,其特征在于,包括:A message sequence preserving device, which is characterized in that it comprises:
    第一接收模块,用于接收第一报文,其中,所述第一报文为多个报文中的任意一个;The first receiving module is configured to receive a first message, where the first message is any one of a plurality of messages;
    编码模块,用于根据所述第一报文在所述多个报文中的发送顺序和所述第一报文与所述多个报文中的其他报文的保序关系对所述第一报文进行编码以得到所述第一报文的编码;An encoding module, configured to compare the first message according to the order in which the first message is sent in the plurality of messages and the order-preserving relationship between the first message and other messages in the plurality of messages Encoding a message to obtain the encoding of the first message;
    发送模块,用于向第二模块发送所述第一报文及其编码;A sending module, configured to send the first message and its code to the second module;
    其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。Wherein, the code of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages.
  16. 如权利要求15所述的装置,其特征在于,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序。The device according to claim 15, wherein the plurality of messages comprise N groups of order-preserving relations, 1≤N and N is an integer, wherein each group of the N groups of order-preserving relations Both include the first type of message and the second type of message, and the second type of message depends on the first type of message for order preservation.
  17. 如权利要求16所述的装置,其特征在于,所述编码模块包括:The device of claim 16, wherein the encoding module comprises:
    第一编码单元,用于若所述第一报文为第i组保序关系中的第一种报文或第二种报文,则为所述第一报文设置基于所述第i组保序关系的第一编码,其中,所述第一编码用于指示所述第一报文所属的基于所述第i组保序关系的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为所述第i组保序关系中的第二种报文切换为第一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;以及The first encoding unit is configured to, if the first message is the first message or the second message in the i-th group of order-preserving relationship, set the first message based on the i-th group The first code of the order-preserving relationship, wherein the first code is used to indicate the order-preserving interval based on the i-th group of order-preserving relationship to which the first message belongs, and the order-preserving interval is defined by a partition node pair The multiple messages are divided, the division node is the node where the second type of message in the i-th group of order-preserving relationship is switched to the first type of message, and the multiple messages are based on the multiple messages. The order in which each message in the text is sent; and
    第二编码单元,用于若所述第一报文为第i组保序关系中的第二种报文,则为所述第一报文设置基于所述第i组保序关系的第二编码,其中,所述第二编码用于指示所述第一报文所属的基于第i组保序关系的保序区间内的第一种报文的数量;The second coding unit is configured to, if the first message is the second type of message in the i-th group of order-preserving relations, set a second message based on the i-th group of order-preserving relations for the first message Encoding, wherein the second encoding is used to indicate the number of messages of the first type in the sequence-preserving interval based on the i-th group of sequence-preserving relationships to which the first message belongs;
    其中,1≤i≤N且i为整数。Wherein, 1≤i≤N and i is an integer.
  18. 如权利要求16或17所述的装置,其特征在于,所述N组保序关系中的每组保序 关系均为直接保序关系;或者所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系。The device according to claim 16 or 17, wherein each of the N groups of preserving relations is a direct preserving relationship; or a part of the N groups of preserving relations It is a direct order-preserving relationship, and the other part of the order-preserving relationship is an indirect order-preserving relationship.
  19. 如权利要求16~18中任一项所述的装置,其特征在于,所述多个报文包括3种报文,分别为P报文、NP报文、CPL报文,所述多个报文包括2组保序关系,所述2组保序关系均为直接保序关系;The device according to any one of claims 16 to 18, wherein the plurality of messages include three types of messages, which are respectively P messages, NP messages, and CPL messages, and the plurality of messages The article includes two sets of order-preserving relations, and the two sets of order-preserving relations are all direct-order preserving relations;
    其中,第一组直接保序关系中的第一种报文为P报文,第一组直接保序关系中的第二种报文为CPL报文;第二组直接保序关系中的第一种报文为P报文,第二组直接保序关系中的第二种报文为NP报文。Among them, the first type of message in the first group of direct order preserving relations is a P message, and the second type of message in the first group of direct preserving relations is a CPL message; the second group of direct order preserving relations is the first message. One type of message is a P message, and the second type of message in the second group of direct sequence preservation relationships is an NP message.
  20. 如权利要求15所述的装置,其特征在于,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;The device according to claim 15, wherein the plurality of messages comprise M type messages, and each type of message in the M type messages includes a type of message, wherein the k+1th message Class messages directly depend on the k-th message for order protection, and the k+1 messages indirectly depend on each type of message from the first message to the k-1 message for order protection, 1≤ k≤M-1 and both k and M are integers;
    所述编码模块包括:The encoding module includes:
    第一编码单元,用于为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点为第M类报文切换为所述第1类报文至第M-1类报文中的任意一类报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;The first coding unit is configured to set a first code for the first message, where the first code is used to indicate the order-preserving interval to which the first message belongs, and the order-preserving interval is determined by a partitioning node. A plurality of messages are divided, and the division node is a node where the M-th message is switched to any one of the first message to the M-1 message, and the plurality of messages Sort according to the sending order of each of the multiple messages;
    第二编码单元,用于若所述第一报文为所述第k类报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;The second encoding unit is configured to set a second encoding for the first message if the first message is the k-th message and k=1, where the second encoding is used to indicate The sequence number of the first message in the message in the sequence preservation interval to which it belongs;
    第三编码单元,用于若所述第一报文为所述第k类报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;The third coding unit is configured to, if the first message is the k-th message and 2≤k≤M-1, set a second code for the first message, and the second code includes A first number and a second number, where the first number is used to indicate the number of type 1 messages to type k-1 messages before the first message in the order-preserving interval to which the first message belongs Quantity, the second number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs;
    第四编码单元,用于若所述第一报文为所述第M类报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。A fourth encoding unit, configured to set a second encoding for the first message if the first message is the M-th message, and the second encoding includes a first number and a second number, The first number is used to indicate the number of Type 1 messages to Type M-1 messages before the first message in the order-preserving interval to which the first message belongs, and the second number is used It indicates the sequence number of the first message in the message in the preserving interval to which it belongs.
  21. 如权利要求15所述的装置,其特征在于,所述多个报文包括M类报文,所述M类报文中的至少一类报文包括多种报文,其中,第k+1类报文中的一种报文直接依赖于第k类报文中与其存在保序关系的报文进行保序,第k+1类报文中的一种报文间接依赖于第1类报文至第k-1类报文中与其存在保序关系的报文进行保序,1≤k≤M-1且k和M均为整数;The apparatus according to claim 15, wherein the plurality of messages comprise M messages, and at least one message in the M messages comprises multiple messages, wherein the k+1th message A kind of message in the class of messages directly depends on the messages in the k-th class of messages with which it has an order-preserving relationship for order preservation, and a kind of messages in the k+1 class of messages indirectly depends on the first class of messages. From the message to the k-1th type of message, the order is preserved with the message with which it has an order-preserving relationship, 1≤k≤M-1 and both k and M are integers;
    所述编码模块包括:The encoding module includes:
    第一编码单元,用于为所述第一报文设置第一编码,所述第一编码用于指示所述第一报文所属的保序区间,所述保序区间由划分节点对所述多个报文划分得到,所述划分节点 为第M类报文中指定的一种报文或者任一种报文切换为第1类报文至第M-1类报文中指定的一种报文或者任一种报文的节点,所述多个报文按照所述多个报文中的每个报文的发送顺序排序;The first coding unit is configured to set a first code for the first message, where the first code is used to indicate the order-preserving interval to which the first message belongs, and the order-preserving interval is determined by a partitioning node. A plurality of messages are divided, and the division node is a message specified in the M-th type of message or any kind of messages is switched to a specified one of the first-type messages to the M-1 type of messages A message or a node of any kind of message, the multiple messages are sorted according to the sending order of each of the multiple messages;
    第二编码单元,用于若所述第一报文为所述第k类报文中的第s种报文且k=1,则为所述第一报文设置第二编码,其中,所述第二编码用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;The second encoding unit is configured to set a second encoding for the first message if the first message is the s-th message in the k-th message and k=1, where: The second code is used to indicate the sequence number of the first message in the message in the preserving interval to which it belongs;
    第三编码单元,用于若所述第一报文为所述第k类报文中的第t种报文且2≤k≤M-1,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第k-1类报文中与其存在保序关系的报文数量;第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号;The third encoding unit is configured to set a second encoding for the first message if the first message is the t-th message in the k-th message and 2≤k≤M-1 , The second code includes a first number and a second number, wherein the first number is used to indicate the type 1 message before the first message in the sequence preservation interval to which the first message belongs The number of messages that have a sequence preservation relationship with the k-1th message; the second number is used to indicate the sequence number of the first message in the message in the sequence preservation interval to which it belongs;
    第四编码单元,用于若所述第一报文为所述第M类报文中的第q种报文,则为所述第一报文设置第二编码,所述第二编码包括第一编号和第二编号,其中,所述第一编号用于指示所述第一报文所属的保序区间内在所述第一报文之前的第1类报文至第M-1类报文中与其存在保序关系的报文数量,所述第二编号用于指示所述第一报文在其所属的保序区间内的报文中的排列序号。The fourth encoding unit is configured to set a second encoding for the first message if the first message is the q-th message in the M-th type message, and the second encoding includes the first message A number and a second number, wherein the first number is used to indicate the type 1 message to the M-1 type message before the first message in the sequence preservation interval to which the first message belongs The second number is used to indicate the sequence number of the first message in the message in the preserving interval to which it belongs.
  22. 如权利要求20或21所述的装置,其特征在于,所述多个报文包括2类报文,其中,第一类报文包括P报文,第二类报文包括NP报文和CPL报文,所述NP报文依赖于所述P报文进行保序,所述CPL报文依赖于所述P报文进行保序。The device according to claim 20 or 21, wherein the plurality of messages include two types of messages, wherein the first type of messages includes P messages, and the second type of messages includes NP messages and CPL messages. Message, the NP message depends on the P message for order preservation, and the CPL message depends on the P message for order preservation.
  23. 一种报文保序装置,其特征在于,包括:A message sequence preserving device, which is characterized in that it comprises:
    第二接收模块,用于接收第一模块发送的第一报文及其编码,其中所述第一报文为多个报文中的任意一个报文;The second receiving module is configured to receive the first message and its code sent by the first module, wherein the first message is any one of a plurality of messages;
    确定模块,用于根据所述第一报文的编码确定是否执行所述第一报文;A determining module, configured to determine whether to execute the first message according to the encoding of the first message;
    其中,所述第一报文的编码用于指示所述第一报文与所述多个报文中的其他报文的执行关系。Wherein, the code of the first message is used to indicate the execution relationship between the first message and other messages in the plurality of messages.
  24. 如权利要求23所述的装置,其特征在于,所述多个报文包括N组保序关系,1≤N且N为整数,其中,所述N组保序关系中的每组保序关系均包括第一种报文和第二种报文,且所述第二种报文依赖于所述第一种报文进行保序;The device according to claim 23, wherein the plurality of messages comprise N sets of order-preserving relations, 1≤N and N is an integer, wherein each of the N sets of order-preserving relations Both include the first type of message and the second type of message, and the second type of message depends on the first type of message for order preservation;
    针对第i组保序关系,所述第i组保序关系中的第一种报文和第二种报文基于所述第i组保序关系的第一编码用于指示所述第一种报文和所述第二种报文所属的基于所述第i组保序关系的保序区间;For the i-th group of order-preserving relations, the first type of message and the second type of messages in the i-th group of order-preserving relations are based on the first code of the i-th group of order-preserving relations to indicate the first type The message and the sequence-preserving interval based on the i-th group sequence-preserving relationship to which the second-type message belongs;
    针对第i组保序关系,所述第i组保序关系中的第二种报文基于所述第i组保序关系的第二编码用于指示所述第二种报文所属的基于第i组保序关系的保序区间内的第i组保序关系中的第一种报文的数量。Regarding the i-th group of order-preserving relations, the second type of message in the i-th group of order-preserving relations based on the second code of the i-th group of order-preserving relations is used to indicate to which the second type of message belongs based on the The number of messages of the first type in the i-th group of order-preserving relations in the order-preserving interval of the i group of order-preserving relations.
  25. 如权利要求24所述的装置,其特征在于,在所述N组保序关系中的每组保序关 系均为直接保序关系的条件下,所述确定模块包括:The device according to claim 24, wherein, under the condition that each of the N groups of order-preserving relations is a direct order-preserving relationship, the determining module comprises:
    第一执行单元,用于若所述第一报文为第x组直接保序关系中的第一种报文,则执行所述第一报文;A first execution unit, configured to execute the first message if the first message is the first message in the x-th group of direct order-preserving relations;
    第二执行单元,用于若所述第一报文为第x组直接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文,其中,第一目标报文包括位于所述第一报文所属的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;The second execution unit is configured to, if the first message is the second type of message in the x-th group of direct order-preserving relations, perform the first message based on the x-th group of direct order-preserving relations according to the first message. When the encoding and the second encoding determine that the execution of the first target message has been completed, the first message is executed, where the first target message includes the x-th group located in the order-preserving interval to which the first message belongs The first message in the direct preserving relationship and the first message in the x-th group of direct preserving relationship in the preserving interval before the preserving interval to which the first message belongs;
    其中,1≤x≤N,且x为整数。Among them, 1≤x≤N, and x is an integer.
  26. 如权利要求24所述的装置,其特征在于,在所述N组保序关系中的一部分保序关系为直接保序关系,另一部分保序关系为间接保序关系的条件下,所述确定模块包括:The device according to claim 24, wherein, under the condition that a part of the order-preserving relations in the N groups of order-preserving relations is a direct order-preserving relation, and the other part of the order-preserving relations is an indirect order-preserving relation, the determining The modules include:
    第一执行单元,用于若所述第一报文仅为第x组直接保序关系中的第一种报文,或者若所述第一报文为第x组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第一种报文,则执行所述第一报文;The first execution unit is configured to: if the first message is only the first message in the x-th group of direct order-preserving relations, or if the first message is the first message in the x-th group of direct order-preserving relations A message and the first message is the first message in the q-th group of indirect order-preserving relations, then the first message is executed;
    第二执行单元,用于若所述第一报文仅为第x组直接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成时,执行所述第一报文;The second execution unit is configured to: if the first message is only the second type of message in the x-th group of direct preserving relations, or if the first message is the first message in the x-th group of direct preserving relations Two types of messages and the first message is the first message in the j-th group of direct order-preserving relations, then according to the first message based on the first code and the first message in the x-th group of direct order-preserving relations When the second code determines that the execution of the first target message has been completed, execute the first message;
    第三执行单元,用于若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第j组直接保序关系中的第一种报文且所述第一报文为第q组间接保序关系中的第二种报文,或者若所述第一报文为第x组直接保序关系中的第二种报文且所述第一报文为第q组间接保序关系中的第二种报文,则在根据所述第一报文基于第x组直接保序关系的第一编码和第二编码确定第一目标报文均已执行完成,且根据所述第一报文基于第q组间接保序关系的第一编码和第二编码确定第二目标报文均已执行完成时,执行所述第一报文;The third execution unit is configured to: if the first message is the second type of message in the x-th group of direct order-preserving relations and the first message is the first type of message in the j-th group of direct order-preserving relations And the first message is the second type of message in the q-th group of indirect order-preserving relations, or if the first message is the second type of message in the x-th group of direct order-preserving relations and the The first message is the second type of message in the q-th group of indirect order-preserving relations, and the first target message is determined based on the first code and the second code of the x-th group of direct order-preserving relations according to the first message. Execution of the first message is completed, and when it is determined that the execution of the second target message is completed according to the first code and the second code of the q-th group of indirect order-preserving relationship of the first message, execute the first message;
    其中,第一目标报文包括位于所述第一报文所属的基于第x组直接保序关系的保序区间内的第x组直接保序关系中的第一种报文和位于所述第一报文所属的基于第x组直接保序关系的保序区间之前的保序区间内的第x组直接保序关系中的第一种报文;Wherein, the first target message includes the first type of message in the x-th group of direct order-preserving relations in the x-th group of direct-order preserving interval to which the first message belongs and the first type of message in the xth group of direct order preserving relations. The first type of message in the xth group of direct preserving relations in the preserving interval before the preserving interval based on the xth group of direct preserving relations to which a message belongs;
    第二目标报文包括位于所述第一报文所属的基于第q组间接保序关系的保序区间内的第q组间接保序关系中的第一种报文和位于所述第一报文所属的基于第q组间接保序关系的保序区间之前的保序区间内的第q组间接保序关系中的第一种报文。The second target message includes the first message in the q-th group of indirect sequence-preserving relations in the q-th group of indirect sequence-preserving interval to which the first message belongs, and the first message in the first message. The first type of message in the q-th group of indirect order-preserving relations in the order-preserving interval before the order-preserving interval based on the q-th group of indirect order-preserving relations to which the text belongs.
  27. 如权利要求23所述的装置,其特征在于,所述多个报文包括M类报文,所述M类报文中的每类报文均包括一种报文,其中,第k+1类报文直接依赖于第k类报文进行保序,第k+1类报文间接依赖于第1类报文至第k-1类报文中的每类报文进行保序,1≤k≤M-1且k和M均为整数;The device according to claim 23, wherein the plurality of messages comprise M type messages, and each type of message in the M type messages comprises a type of message, wherein the k+1th message Class messages directly depend on the k-th message for order protection, and the k+1 messages indirectly depend on each type of message from the first message to the k-1 message for order protection, 1≤ k≤M-1 and both k and M are integers;
    针对所述M类报文中的每类报文,所述每类报文的第一编码均用于指示所述报文所属的保序区间;For each type of message in the M type of message, the first code of each type of message is used to indicate the order-preserving interval to which the message belongs;
    在k=1的条件下,第1类报文的第二编码用于指示所述第1类报文在其所属的保序区间内的报文中的排列序号;Under the condition of k=1, the second code of the type 1 message is used to indicate the sequence number of the type 1 message in the message in the sequence preservation interval to which it belongs;
    在2≤k≤M-1的条件下,每个第k类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第k类报文所属的保序区间内在所述第k类报文之前的第1类报文至第k-1类报文的数量,所述第二编号用于指示所述第k类报文在其所属的保序区间内的报文中的排列序号;Under the condition of 2≤k≤M-1, the second code of each k-th message includes a first number and a second number, and the first number is used to indicate to which the k-th message belongs The number of type 1 messages to type k-1 messages before the k-th message in the order-preserving interval, and the second number is used to indicate the order-preserving to which the k-th message belongs The sequence number of the packets in the interval;
    针对第M类报文,所述第M类报文的第二编码均包括第一编号和第二编号,所述第一编号用于指示所述第M类报文所属的保序区间内在所述第M类报文之前的第1类报文至第M-1类报文的数量,所述第二编号用于指示所述第M类报文在其所属的保序区间内的报文中的排列序号。For the M-th message, the second code of the M-th message includes a first number and a second number, and the first number is used to indicate that the M-th message belongs to the order-preserving interval. The number of type 1 messages to type M-1 messages before the M-th type message, and the second number is used to indicate the messages of the M-th type message in the order-preserving interval to which it belongs The sequence number in.
  28. 如权利要求27所述的装置,其特征在于,所述确定模块包括:The device of claim 27, wherein the determining module comprises:
    第一执行单元,用于若所述第一报文为所述第k类报文且k=1,则执行所述第一报文;A first execution unit, configured to execute the first message if the first message is the k-th message and k=1;
    第二执行单元,用于若所述第一报文为所述第k类报文且2≤k≤M-1,且根据第一报文的第一编码、第一编号和第二编号确定第一目标报文已执行完成,则执行所述第一报文,其中,所述第一目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第k-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第k-1类报文;The second execution unit is configured to determine if the first message is the k-th message and 2≤k≤M-1, and is determined according to the first code, first number, and second number of the first message If the execution of the first target message is completed, the first message is executed, where the first target message includes the first message that is located before the first message in the sequence preservation interval to which the first message belongs. Type 1 messages to type k-1 messages and Type 1 messages to type k-1 messages in the order-preserving interval before the order-preserving interval to which the first message belongs;
    第三执行单元,用于若所述第一报文为第M类报文,且根据第一报文的第一编码、第一编号和第二编号确定第二目标报文已执行完成,则执行所述第一报文,其中,所述第二目标报文包括所述第一报文所属的保序区间内位于所述第一报文之前的第1类报文至第M-1类报文和位于所述第一报文所属的保序区间之前的保序区间内的第1类报文至第M-1类报文。The third execution unit is configured to: if the first message is an M-th message, and it is determined that the second target message has been executed according to the first code, first number, and second number of the first message, then Execute the first message, wherein the second target message includes the first message to the M-1th message in the order-preserving interval to which the first message belongs. Messages and messages of type 1 to type M-1 in the order-preserving interval before the order-preserving interval to which the first message belongs.
  29. 一种计算机可读存储介质,包括计算机程序,所述计算机程序在计算机上被执行时,使得所述计算机执行权利要求1~8中任一项所述的方法或者权利要求9~14中任一项所述方法。A computer-readable storage medium, comprising a computer program, which when executed on a computer, causes the computer to execute the method according to any one of claims 1 to 8 or any one of claims 9 to 14 The method described in the item.
  30. 一种计算机程序,当所述计算机程序被计算机执行时,用于执行权利要求1~8中任一项所述的方法或者权利要求9~14中任一项所述方法。A computer program, when the computer program is executed by a computer, it is used to execute the method according to any one of claims 1 to 8 or the method according to any one of claims 9 to 14.
  31. 一种芯片,包括处理器和存储器,所述存储器用于存储计算机程序,所述处理器用于调用并运行所述存储器中存储的计算机程序,以执行权利要求1~8中任一项所述的方法或者权利要求9~14中任一项所述方法。A chip comprising a processor and a memory, the memory is used to store a computer program, and the processor is used to call and run the computer program stored in the memory to execute the computer program described in any one of claims 1-8 The method or the method of any one of claims 9-14.
PCT/CN2020/075305 2020-02-14 2020-02-14 Message order preservation method and apparatus WO2021159478A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2020/075305 WO2021159478A1 (en) 2020-02-14 2020-02-14 Message order preservation method and apparatus
CN202080083313.1A CN114731334B (en) 2020-02-14 2020-02-14 Message order preserving method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2020/075305 WO2021159478A1 (en) 2020-02-14 2020-02-14 Message order preservation method and apparatus

Publications (1)

Publication Number Publication Date
WO2021159478A1 true WO2021159478A1 (en) 2021-08-19

Family

ID=77291932

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/075305 WO2021159478A1 (en) 2020-02-14 2020-02-14 Message order preservation method and apparatus

Country Status (2)

Country Link
CN (1) CN114731334B (en)
WO (1) WO2021159478A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114124854A (en) * 2021-11-29 2022-03-01 北京天融信网络安全技术有限公司 Message processing method and device, electronic equipment and readable storage medium
CN114448573A (en) * 2022-03-02 2022-05-06 新华三半导体技术有限公司 Message processing method and device

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117692535B (en) * 2024-02-04 2024-04-23 北京数渡信息科技有限公司 PCIe protocol message order preserving device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102158408A (en) * 2011-04-01 2011-08-17 华为技术有限公司 Method for processing data stream and device thereof
CN104901829A (en) * 2015-04-09 2015-09-09 清华大学 Method and device for verifying consistency of router data forwarding behaviors based on action codes
CN105704137A (en) * 2016-03-11 2016-06-22 北京邮电大学 Method and system for transmitting voices based on TCP in VoIP
CN105933342A (en) * 2016-06-24 2016-09-07 浙江宇视科技有限公司 Video monitoring data transmission method and device
WO2017219216A1 (en) * 2016-06-20 2017-12-28 华为技术有限公司 Data transmission method, and related device and system

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100579065C (en) * 2006-09-30 2010-01-06 华为技术有限公司 Transmission method and device for high speed data flow and data exchange device
CN100531142C (en) * 2006-12-30 2009-08-19 华为技术有限公司 Method and device for guaranteeing message sequence
CN101170563A (en) * 2007-11-30 2008-04-30 杭州华三通信技术有限公司 A method and device for matching message rule
CN101662461B (en) * 2008-08-27 2012-08-08 华为技术有限公司 Method, device and system for recombining multilink protocol fragment data
CN101795236B (en) * 2010-03-31 2012-08-08 成都市华为赛门铁克科技有限公司 Report sequence preservation method and device
WO2011120467A2 (en) * 2011-05-09 2011-10-06 华为技术有限公司 Message order-preserving processing method, order-preserving coprocessor and network equipment
CN102546424B (en) * 2012-01-20 2015-03-18 华为技术有限公司 Message order-preserving method and device adopting same
CN102710524B (en) * 2012-06-15 2015-01-21 大连梯耐德网络技术有限公司 Implementing method for multi-protocol network message transmission order preserving system
CN102868635B (en) * 2012-08-24 2016-02-17 汉柏科技有限公司 The message order-preserving method of Multi-core and system
CN102891809B (en) * 2012-09-25 2015-09-16 汉柏科技有限公司 Multi-core network device message presses interface order-preserving method and system
CN104618253B (en) * 2015-01-22 2018-08-07 大唐移动通信设备有限公司 A kind of transmitting message treating method and apparatus of dynamic change
CN107222427A (en) * 2016-03-22 2017-09-29 华为技术有限公司 The method and relevant device of a kind of Message processing
CN107404446A (en) * 2016-05-19 2017-11-28 中兴通讯股份有限公司 A kind of method and device for handling fragment message
CN106713144B (en) * 2016-12-27 2020-01-21 锐捷网络股份有限公司 Reading and writing method of message outlet information and forwarding engine
CN109428801A (en) * 2017-08-23 2019-03-05 北京华为数字技术有限公司 File transmitting method and device
CN107769875B (en) * 2017-10-18 2019-10-25 北京华力创通科技股份有限公司 The voice broadcast method of satellite communication, device and system
CN109981470A (en) * 2017-12-27 2019-07-05 华为技术有限公司 Message transmission control method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102158408A (en) * 2011-04-01 2011-08-17 华为技术有限公司 Method for processing data stream and device thereof
CN104901829A (en) * 2015-04-09 2015-09-09 清华大学 Method and device for verifying consistency of router data forwarding behaviors based on action codes
CN105704137A (en) * 2016-03-11 2016-06-22 北京邮电大学 Method and system for transmitting voices based on TCP in VoIP
WO2017219216A1 (en) * 2016-06-20 2017-12-28 华为技术有限公司 Data transmission method, and related device and system
CN105933342A (en) * 2016-06-24 2016-09-07 浙江宇视科技有限公司 Video monitoring data transmission method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114124854A (en) * 2021-11-29 2022-03-01 北京天融信网络安全技术有限公司 Message processing method and device, electronic equipment and readable storage medium
CN114124854B (en) * 2021-11-29 2024-02-09 天融信雄安网络安全技术有限公司 Message processing method and device, electronic equipment and readable storage medium
CN114448573A (en) * 2022-03-02 2022-05-06 新华三半导体技术有限公司 Message processing method and device
CN114448573B (en) * 2022-03-02 2024-02-23 新华三半导体技术有限公司 Message processing method and device

Also Published As

Publication number Publication date
CN114731334A (en) 2022-07-08
CN114731334B (en) 2023-10-20

Similar Documents

Publication Publication Date Title
WO2021159478A1 (en) Message order preservation method and apparatus
US9191027B2 (en) Data compression devices, operating methods thereof, and data processing apparatuses including the same
US20040095885A1 (en) Priority queuing method and apparatus
CN1980198A (en) Method and apparatus for striping message payload data over a network
CN113660351B (en) Data communication method, device, communication terminal and computer readable storage medium
CN111522775A (en) Network-on-chip routing device and control method thereof
CN115756780A (en) Quantum computing task scheduling method and device, computer equipment and storage medium
CN105097005B (en) Memory matrix
US20230367735A1 (en) Data transmission method, module and apparatus, device, and storage medium
US8196082B1 (en) Signal routing and pin placement
KR100363580B1 (en) Error protecting method and error protective device
KR100800487B1 (en) Method of data coding in initial action and semiconductor memory device using the method
CN103647729A (en) Delaying request processing method and apparatus based on token bucket
US8854852B2 (en) Multi-priority encoder
EP4236254A1 (en) Message processing method and device
US6658584B1 (en) Method and structure for managing large counter arrays
CN108090025A (en) The neutral net SOC chip of dynamic multichannel and its channel resource distribution method
CN109165322B (en) Network feature extraction system and method based on path relation
CN111291792B (en) Flow data type integrated classification method and device based on double evolution
CN104678815A (en) Interface structure and configuration method of FPGA (field programmable gate array) chip
CN115904488A (en) Data transmission method, system, device and equipment
JPS6030231A (en) Data buffer device
US11528164B2 (en) Method for operating a network subscriber and network subscriber
CN1914605B (en) Rate computations of particular use in scheduling
RU105487U1 (en) ADAPTIVE DATA PROCESSING SYSTEM

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20918557

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20918557

Country of ref document: EP

Kind code of ref document: A1