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