Commit 368f5366 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent cd63c735
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
def main(): def main():
pyprotog = {} pyprotog = {}
execfile('../../neo/lib/protocol.py', pyprotog) execfile('../../neo/lib/protocol.py', pyprotog)
pypacket = pyprotog['Packet']
pypackets = pyprotog['Packets'] pypackets = pyprotog['Packets']
# dump to go what to expect # dump to go what to expect
...@@ -33,11 +34,31 @@ def main(): ...@@ -33,11 +34,31 @@ def main():
emit("package neo") emit("package neo")
emit("\nvar pyMsgRegistry = map[uint16]string{") emit("\nvar pyMsgRegistry = map[uint16]string{")
pycodev = pypackets.keys()
pycodev.sort() # access packet structures by names they are defined under Packets
for pycode in pycodev: # class and thus in neo/py code which uses them.
pymsg = pypackets[pycode] #
emit('\t%d:\t"%s",' % (pycode, pymsg.__name__)) # ( this is not the same as packet class name as e.g. currently
# AcceptIdentification has class name AnswerRequestIdentification )
pypktv = []
for k in dir(pypackets):
v = getattr(pypackets, k)
if isinstance(v, type) and issubclass(v, pypacket):
v._x_use_name = k
pypktv.append(v)
# order by message code
pypktv.sort(key=lambda pkt: pkt._code)
for pypkt in pypktv:
emit('\t%d:\t"%s",' % (pypkt._code, pypkt._x_use_name))
#pycodev = pypackets.keys()
#pycodev.sort()
#for pycode in pycodev:
# pymsg = pypackets[pycode]
# emit('\t%d:\t"%s",' % (pycode, pymsg.__name__))
emit("}") emit("}")
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -5,71 +5,71 @@ var pyMsgRegistry = map[uint16]string{ ...@@ -5,71 +5,71 @@ var pyMsgRegistry = map[uint16]string{
1: "RequestIdentification", 1: "RequestIdentification",
3: "Ping", 3: "Ping",
5: "CloseClient", 5: "CloseClient",
6: "PrimaryMaster", 6: "AskPrimary",
8: "NotPrimaryMaster", 8: "NotPrimaryMaster",
9: "NotifyNodeInformation", 9: "NotifyNodeInformation",
10: "Recovery", 10: "AskRecovery",
12: "LastIDs", 12: "AskLastIDs",
14: "PartitionTable", 14: "AskPartitionTable",
16: "NotifyPartitionTable", 16: "SendPartitionTable",
17: "PartitionChanges", 17: "NotifyPartitionChanges",
18: "StartOperation", 18: "StartOperation",
19: "StopOperation", 19: "StopOperation",
20: "UnfinishedTransactions", 20: "AskUnfinishedTransactions",
22: "LockedTransactions", 22: "AskLockedTransactions",
24: "FinalTID", 24: "AskFinalTID",
26: "ValidateTransaction", 26: "ValidateTransaction",
27: "BeginTransaction", 27: "AskBeginTransaction",
29: "FailedVote", 29: "FailedVote",
30: "FinishTransaction", 30: "AskFinishTransaction",
32: "LockInformation", 32: "AskLockInformation",
34: "InvalidateObjects", 34: "InvalidateObjects",
35: "UnlockInformation", 35: "NotifyUnlockInformation",
36: "GenerateOIDs", 36: "AskNewOIDs",
38: "Deadlock", 38: "NotifyDeadlock",
39: "RebaseTransaction", 39: "AskRebaseTransaction",
41: "RebaseObject", 41: "AskRebaseObject",
43: "StoreObject", 43: "AskStoreObject",
45: "AbortTransaction", 45: "AbortTransaction",
46: "StoreTransaction", 46: "AskStoreTransaction",
48: "VoteTransaction", 48: "AskVoteTransaction",
50: "GetObject", 50: "AskObject",
52: "TIDList", 52: "AskTIDs",
54: "TransactionInformation", 54: "AskTransactionInformation",
56: "ObjectHistory", 56: "AskObjectHistory",
58: "PartitionList", 58: "AskPartitionList",
60: "NodeList", 60: "AskNodeList",
62: "SetNodeState", 62: "SetNodeState",
63: "AddPendingNodes", 63: "AddPendingNodes",
64: "TweakPartitionTable", 64: "TweakPartitionTable",
65: "SetClusterState", 65: "SetClusterState",
66: "Repair", 66: "Repair",
67: "RepairOne", 67: "NotifyRepair",
68: "ClusterInformation", 68: "NotifyClusterInformation",
69: "ClusterState", 69: "AskClusterState",
71: "ObjectUndoSerial", 71: "AskObjectUndoSerial",
73: "TIDListFrom", 73: "AskTIDsFrom",
75: "Pack", 75: "AskPack",
77: "CheckReplicas", 77: "CheckReplicas",
78: "CheckPartition", 78: "CheckPartition",
79: "CheckTIDRange", 79: "AskCheckTIDRange",
81: "CheckSerialRange", 81: "AskCheckSerialRange",
83: "PartitionCorrupted", 83: "NotifyPartitionCorrupted",
84: "NotifyReady", 84: "NotifyReady",
85: "LastTransaction", 85: "AskLastTransaction",
87: "CheckCurrentSerial", 87: "AskCheckCurrentSerial",
89: "NotifyTransactionFinished", 89: "NotifyTransactionFinished",
90: "Replicate", 90: "Replicate",
91: "ReplicationDone", 91: "NotifyReplicationDone",
92: "FetchTransactions", 92: "AskFetchTransactions",
94: "FetchObjects", 94: "AskFetchObjects",
96: "AddTransaction", 96: "AddTransaction",
97: "AddObject", 97: "AddObject",
98: "Truncate", 98: "Truncate",
32768: "Error", 32768: "Error",
32769: "AnswerRequestIdentification", 32769: "AcceptIdentification",
32771: "AnswerPing", 32771: "Pong",
32774: "AnswerPrimaryMaster", 32774: "AnswerPrimary",
32778: "AnswerRecovery", 32778: "AnswerRecovery",
32780: "AnswerLastIDs", 32780: "AnswerLastIDs",
32782: "AnswerPartitionTable", 32782: "AnswerPartitionTable",
...@@ -77,23 +77,23 @@ var pyMsgRegistry = map[uint16]string{ ...@@ -77,23 +77,23 @@ var pyMsgRegistry = map[uint16]string{
32790: "AnswerLockedTransactions", 32790: "AnswerLockedTransactions",
32792: "AnswerFinalTID", 32792: "AnswerFinalTID",
32795: "AnswerBeginTransaction", 32795: "AnswerBeginTransaction",
32798: "AnswerFinishTransaction", 32798: "AnswerTransactionFinished",
32800: "AnswerLockInformation", 32800: "AnswerInformationLocked",
32804: "AnswerGenerateOIDs", 32804: "AnswerNewOIDs",
32807: "AnswerRebaseTransaction", 32807: "AnswerRebaseTransaction",
32809: "AnswerRebaseObject", 32809: "AnswerRebaseObject",
32811: "AnswerStoreObject", 32811: "AnswerStoreObject",
32814: "AnswerStoreTransaction", 32814: "AnswerStoreTransaction",
32816: "AnswerVoteTransaction", 32816: "AnswerVoteTransaction",
32818: "AnswerGetObject", 32818: "AnswerObject",
32820: "AnswerTIDList", 32820: "AnswerTIDs",
32822: "AnswerTransactionInformation", 32822: "AnswerTransactionInformation",
32824: "AnswerObjectHistory", 32824: "AnswerObjectHistory",
32826: "AnswerPartitionList", 32826: "AnswerPartitionList",
32828: "AnswerNodeList", 32828: "AnswerNodeList",
32837: "AnswerClusterState", 32837: "AnswerClusterState",
32839: "AnswerObjectUndoSerial", 32839: "AnswerObjectUndoSerial",
32841: "AnswerTIDListFrom", 32841: "AnswerTIDsFrom",
32843: "AnswerPack", 32843: "AnswerPack",
32847: "AnswerCheckTIDRange", 32847: "AnswerCheckTIDRange",
32849: "AnswerCheckSerialRange", 32849: "AnswerCheckSerialRange",
......
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