Commit fd3d6741 authored by Kirill Smelkov's avatar Kirill Smelkov

go/neo/proto: Sync message type codes with NEO/py

Don't skip a code when going request1->request2 through `Request1
Answer1 Request2`. For example before this patch:

	1		RequestIdentification
	1 | answerBit	AcceptIdentification
	3		Ping
	3 | answerBit	Pong
	...

after this patch:

	1		RequestIdentification
	1 | answerBit	AcceptIdentification
	2		Ping
	2 | answerBit	Pong
	...

This corresponds to NEO/py commit a00ab78b ("protocol: small cleanup in
packet registration").
parent 2f783f3a
......@@ -341,14 +341,12 @@ import (
// generate code for this type to implement neo.Msg
var msgCode MsgCode
msgCode.answer = specAnnotation.answer || strings.HasPrefix(typename, "Answer")
switch {
case !msgCode.answer || typename == "Error":
msgCode.msgSerial = msgSerial
// answer to something
default:
msgCode.msgSerial = msgSerial - 1
// increment msgSerial only by +1 when going from
// request1->request2 in `Request1 Answer1 Request2`.
if msgCode.answer && typename != "Error" {
msgSerial--
}
msgCode.msgSerial = msgSerial
fmt.Fprintf(&buf, "// %s. %s\n\n", msgCode, typename)
......
This diff is collapsed.
......@@ -3,102 +3,102 @@ package proto
var pyMsgRegistry = map[uint16]string{
1: "RequestIdentification",
3: "Ping",
5: "CloseClient",
6: "PrimaryMaster",
8: "NotPrimaryMaster",
9: "NotifyNodeInformation",
10: "Recovery",
12: "LastIDs",
14: "AskPartitionTable",
16: "SendPartitionTable",
17: "NotifyPartitionChanges",
18: "StartOperation",
19: "StopOperation",
20: "UnfinishedTransactions",
22: "LockedTransactions",
24: "FinalTID",
26: "ValidateTransaction",
27: "BeginTransaction",
29: "FailedVote",
30: "FinishTransaction",
32: "LockInformation",
34: "InvalidateObjects",
35: "NotifyUnlockInformation",
36: "AskNewOIDs",
38: "NotifyDeadlock",
39: "RebaseTransaction",
41: "RebaseObject",
43: "StoreObject",
45: "AbortTransaction",
46: "StoreTransaction",
48: "VoteTransaction",
50: "GetObject",
52: "AskTIDs",
54: "TransactionInformation",
56: "ObjectHistory",
58: "PartitionList",
60: "NodeList",
62: "SetNodeState",
63: "AddPendingNodes",
64: "TweakPartitionTable",
65: "SetClusterState",
66: "Repair",
67: "RepairOne",
68: "NotifyClusterState",
69: "AskClusterState",
71: "ObjectUndoSerial",
73: "AskTIDsFrom",
75: "Pack",
77: "CheckReplicas",
78: "CheckPartition",
79: "CheckTIDRange",
81: "CheckSerialRange",
83: "PartitionCorrupted",
84: "NotifyReady",
85: "LastTransaction",
87: "CheckCurrentSerial",
89: "NotifyTransactionFinished",
90: "Replicate",
91: "ReplicationDone",
92: "FetchTransactions",
94: "FetchObjects",
96: "AddTransaction",
97: "AddObject",
98: "Truncate",
2: "Ping",
3: "CloseClient",
4: "PrimaryMaster",
5: "NotPrimaryMaster",
6: "NotifyNodeInformation",
7: "Recovery",
8: "LastIDs",
9: "AskPartitionTable",
10: "SendPartitionTable",
11: "NotifyPartitionChanges",
12: "StartOperation",
13: "StopOperation",
14: "UnfinishedTransactions",
15: "LockedTransactions",
16: "FinalTID",
17: "ValidateTransaction",
18: "BeginTransaction",
19: "FailedVote",
20: "FinishTransaction",
21: "LockInformation",
22: "InvalidateObjects",
23: "NotifyUnlockInformation",
24: "AskNewOIDs",
25: "NotifyDeadlock",
26: "RebaseTransaction",
27: "RebaseObject",
28: "StoreObject",
29: "AbortTransaction",
30: "StoreTransaction",
31: "VoteTransaction",
32: "GetObject",
33: "AskTIDs",
34: "TransactionInformation",
35: "ObjectHistory",
36: "PartitionList",
37: "NodeList",
38: "SetNodeState",
39: "AddPendingNodes",
40: "TweakPartitionTable",
41: "SetClusterState",
42: "Repair",
43: "RepairOne",
44: "NotifyClusterState",
45: "AskClusterState",
46: "ObjectUndoSerial",
47: "AskTIDsFrom",
48: "Pack",
49: "CheckReplicas",
50: "CheckPartition",
51: "CheckTIDRange",
52: "CheckSerialRange",
53: "PartitionCorrupted",
54: "NotifyReady",
55: "LastTransaction",
56: "CheckCurrentSerial",
57: "NotifyTransactionFinished",
58: "Replicate",
59: "ReplicationDone",
60: "FetchTransactions",
61: "FetchObjects",
62: "AddTransaction",
63: "AddObject",
64: "Truncate",
32768: "Error",
32769: "AcceptIdentification",
32771: "Pong",
32774: "AnswerPrimary",
32778: "AnswerRecovery",
32780: "AnswerLastIDs",
32782: "AnswerPartitionTable",
32788: "AnswerUnfinishedTransactions",
32790: "AnswerLockedTransactions",
32792: "AnswerFinalTID",
32795: "AnswerBeginTransaction",
32798: "AnswerTransactionFinished",
32800: "AnswerInformationLocked",
32804: "AnswerNewOIDs",
32807: "AnswerRebaseTransaction",
32809: "AnswerRebaseObject",
32811: "AnswerStoreObject",
32814: "AnswerStoreTransaction",
32816: "AnswerVoteTransaction",
32818: "AnswerObject",
32820: "AnswerTIDs",
32822: "AnswerTransactionInformation",
32824: "AnswerObjectHistory",
32826: "AnswerPartitionList",
32828: "AnswerNodeList",
32837: "AnswerClusterState",
32839: "AnswerObjectUndoSerial",
32841: "AnswerTIDsFrom",
32843: "AnswerPack",
32847: "AnswerCheckTIDRange",
32849: "AnswerCheckSerialRange",
32853: "AnswerLastTransaction",
32855: "AnswerCheckCurrentSerial",
32860: "AnswerFetchTransactions",
32862: "AnswerFetchObjects",
32770: "Pong",
32772: "AnswerPrimary",
32775: "AnswerRecovery",
32776: "AnswerLastIDs",
32777: "AnswerPartitionTable",
32782: "AnswerUnfinishedTransactions",
32783: "AnswerLockedTransactions",
32784: "AnswerFinalTID",
32786: "AnswerBeginTransaction",
32788: "AnswerTransactionFinished",
32789: "AnswerInformationLocked",
32792: "AnswerNewOIDs",
32794: "AnswerRebaseTransaction",
32795: "AnswerRebaseObject",
32796: "AnswerStoreObject",
32798: "AnswerStoreTransaction",
32799: "AnswerVoteTransaction",
32800: "AnswerObject",
32801: "AnswerTIDs",
32802: "AnswerTransactionInformation",
32803: "AnswerObjectHistory",
32804: "AnswerPartitionList",
32805: "AnswerNodeList",
32813: "AnswerClusterState",
32814: "AnswerObjectUndoSerial",
32815: "AnswerTIDsFrom",
32816: "AnswerPack",
32819: "AnswerCheckTIDRange",
32820: "AnswerCheckSerialRange",
32823: "AnswerLastTransaction",
32824: "AnswerCheckCurrentSerial",
32828: "AnswerFetchTransactions",
32829: "AnswerFetchObjects",
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment