Commit 3e4d0dd7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bc16d2ee
...@@ -32,8 +32,9 @@ package neo ...@@ -32,8 +32,9 @@ package neo
// The order of message definitions is significant - messages are assigned // The order of message definitions is significant - messages are assigned
// message IDs in the same order they are defined. // message IDs in the same order they are defined.
// //
// For compatibility with neo/py is a message should have its ID assigned with // For compatibility with neo/py a message has its ID assigned with "answer"
// "answer" bit set its definition is prefixed with `//neo:proto answer` comment. // bit set if either message name starts with "Answer" or message definition is
// prefixed with `//neo:proto answer` comment.
// TODO regroup messages definitions to stay more close to 1 communication topic // TODO regroup messages definitions to stay more close to 1 communication topic
// TODO document protocol itself better (who sends who what with which semantic) // TODO document protocol itself better (who sends who what with which semantic)
...@@ -291,7 +292,8 @@ type RowInfo struct { ...@@ -291,7 +292,8 @@ type RowInfo struct {
// Error is a special type of message, because this can be sent against // Error is a special type of message, because this can be sent against
// any other message, even if such a message does not expect a reply // any other message, even if such a message does not expect a reply
// usually. Any -> Any. // usually. Any -> Any.
// FIXME -> |RESPONSE_MASK //
//neo:proto answer
type Error struct { type Error struct {
Code ErrorCode // PNumber Code ErrorCode // PNumber
Message string Message string
...@@ -317,9 +319,10 @@ type AcceptIdentification struct { ...@@ -317,9 +319,10 @@ type AcceptIdentification struct {
} }
// Check if a peer is still alive. Any -> Any. // Check if a peer is still alive. Any -> Any.
type Ping struct { type Ping struct {}
// TODO _answer = PFEmpty
} //neo:proto answer
type Pong struct {}
// Tell peer it can close the connection if it has finished with us. Any -> Any // Tell peer it can close the connection if it has finished with us. Any -> Any
type CloseClient struct { type CloseClient struct {
...@@ -341,6 +344,13 @@ type NotPrimaryMaster struct { ...@@ -341,6 +344,13 @@ type NotPrimaryMaster struct {
} }
} }
// Notify information about one or more nodes. PM -> Any.
type NotifyNodeInformation struct {
// XXX in py this is monotonic_time() of call to broadcastNodesInformation() & friends
IdTimestamp float64
NodeList []NodeInfo
}
// Ask all data needed by master to recover. PM -> S, S -> PM. // Ask all data needed by master to recover. PM -> S, S -> PM.
type Recovery struct { type Recovery struct {
} }
...@@ -722,13 +732,6 @@ type TweakPartitionTable struct { ...@@ -722,13 +732,6 @@ type TweakPartitionTable struct {
// XXX _answer = Error // XXX _answer = Error
} }
// Notify information about one or more nodes. PM -> Any.
type NotifyNodeInformation struct {
// XXX in py this is monotonic_time() of call to broadcastNodesInformation() & friends
IdTimestamp float64
NodeList []NodeInfo
}
// Ask node information // Ask node information
type NodeInformation struct { type NodeInformation struct {
// XXX _answer = PFEmpty // XXX _answer = PFEmpty
......
...@@ -293,7 +293,10 @@ import ( ...@@ -293,7 +293,10 @@ import (
} }
// generate code for this type to implement neo.Msg // generate code for this type to implement neo.Msg
msgCode := MsgCode{msgSerial, specAnnotation.answer} msgCode := MsgCode{
msgSerial: msgSerial,
answer: specAnnotation.answer || strings.HasPrefix(typename, "Answer"),
}
fmt.Fprintf(&buf, "// %d. %s", msgSerial, typename) fmt.Fprintf(&buf, "// %d. %s", msgSerial, typename)
if specAnnotation.answer { if specAnnotation.answer {
......
...@@ -14,10 +14,10 @@ import ( ...@@ -14,10 +14,10 @@ import (
// messages marshalling // messages marshalling
// 0. Error // 0. Error (answer)
func (*Error) neoMsgCode() uint16 { func (*Error) neoMsgCode() uint16 {
return 0 return 0 | answerBit
} }
func (p *Error) neoMsgEncodedLen() int { func (p *Error) neoMsgEncodedLen() int {
...@@ -173,10 +173,27 @@ func (p *Ping) neoMsgDecode(data []byte) (int, error) { ...@@ -173,10 +173,27 @@ func (p *Ping) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 4. CloseClient // 4. Pong (answer)
func (*Pong) neoMsgCode() uint16 {
return 4 | answerBit
}
func (p *Pong) neoMsgEncodedLen() int {
return 0
}
func (p *Pong) neoMsgEncode(data []byte) {
}
func (p *Pong) neoMsgDecode(data []byte) (int, error) {
return 0, nil
}
// 5. CloseClient
func (*CloseClient) neoMsgCode() uint16 { func (*CloseClient) neoMsgCode() uint16 {
return 4 return 5
} }
func (p *CloseClient) neoMsgEncodedLen() int { func (p *CloseClient) neoMsgEncodedLen() int {
...@@ -190,10 +207,10 @@ func (p *CloseClient) neoMsgDecode(data []byte) (int, error) { ...@@ -190,10 +207,10 @@ func (p *CloseClient) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 5. PrimaryMaster // 6. PrimaryMaster
func (*PrimaryMaster) neoMsgCode() uint16 { func (*PrimaryMaster) neoMsgCode() uint16 {
return 5 return 6
} }
func (p *PrimaryMaster) neoMsgEncodedLen() int { func (p *PrimaryMaster) neoMsgEncodedLen() int {
...@@ -207,10 +224,10 @@ func (p *PrimaryMaster) neoMsgDecode(data []byte) (int, error) { ...@@ -207,10 +224,10 @@ func (p *PrimaryMaster) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 6. AnswerPrimary // 7. AnswerPrimary
func (*AnswerPrimary) neoMsgCode() uint16 { func (*AnswerPrimary) neoMsgCode() uint16 {
return 6 return 7 | answerBit
} }
func (p *AnswerPrimary) neoMsgEncodedLen() int { func (p *AnswerPrimary) neoMsgEncodedLen() int {
...@@ -232,10 +249,10 @@ overflow: ...@@ -232,10 +249,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 7. NotPrimaryMaster // 8. NotPrimaryMaster
func (*NotPrimaryMaster) neoMsgCode() uint16 { func (*NotPrimaryMaster) neoMsgCode() uint16 {
return 7 return 8
} }
func (p *NotPrimaryMaster) neoMsgEncodedLen() int { func (p *NotPrimaryMaster) neoMsgEncodedLen() int {
...@@ -304,10 +321,90 @@ overflow: ...@@ -304,10 +321,90 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 8. Recovery // 9. NotifyNodeInformation
func (*NotifyNodeInformation) neoMsgCode() uint16 {
return 9
}
func (p *NotifyNodeInformation) neoMsgEncodedLen() int {
var size int
for i := 0; i < len(p.NodeList); i++ {
a := &p.NodeList[i]
size += len((*a).Addr.Host)
}
return 12 + len(p.NodeList)*26 + size
}
func (p *NotifyNodeInformation) neoMsgEncode(data []byte) {
float64_NEOEncode(data[0:], p.IdTimestamp)
{
l := uint32(len(p.NodeList))
binary.BigEndian.PutUint32(data[8:], l)
data = data[12:]
for i := 0; uint32(i) < l; i++ {
a := &p.NodeList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).Type)))
{
l := uint32(len((*a).Addr.Host))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
copy(data, (*a).Addr.Host)
data = data[l:]
}
binary.BigEndian.PutUint16(data[0:], (*a).Addr.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[6:], uint32(int32((*a).State)))
float64_NEOEncode(data[10:], (*a).IdTimestamp)
data = data[18:]
}
}
}
func (p *NotifyNodeInformation) neoMsgDecode(data []byte) (int, error) {
var nread uint32
if uint32(len(data)) < 12 {
goto overflow
}
p.IdTimestamp = float64_NEODecode(data[0:])
{
l := binary.BigEndian.Uint32(data[8:])
data = data[12:]
p.NodeList = make([]NodeInfo, l)
for i := 0; uint32(i) < l; i++ {
a := &p.NodeList[i]
if uint32(len(data)) < 8 {
goto overflow
}
(*a).Type = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
{
l := binary.BigEndian.Uint32(data[4:])
data = data[8:]
if uint32(len(data)) < 18+l {
goto overflow
}
nread += 18 + l
(*a).Addr.Host = string(data[:l])
data = data[l:]
}
(*a).Addr.Port = binary.BigEndian.Uint16(data[0:])
(*a).UUID = NodeUUID(int32(binary.BigEndian.Uint32(data[2:])))
(*a).State = NodeState(int32(binary.BigEndian.Uint32(data[6:])))
(*a).IdTimestamp = float64_NEODecode(data[10:])
data = data[18:]
}
nread += l * 8
}
return 12 + int(nread), nil
overflow:
return 0, ErrDecodeOverflow
}
// 10. Recovery
func (*Recovery) neoMsgCode() uint16 { func (*Recovery) neoMsgCode() uint16 {
return 8 return 10
} }
func (p *Recovery) neoMsgEncodedLen() int { func (p *Recovery) neoMsgEncodedLen() int {
...@@ -321,10 +418,10 @@ func (p *Recovery) neoMsgDecode(data []byte) (int, error) { ...@@ -321,10 +418,10 @@ func (p *Recovery) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 9. AnswerRecovery // 11. AnswerRecovery
func (*AnswerRecovery) neoMsgCode() uint16 { func (*AnswerRecovery) neoMsgCode() uint16 {
return 9 return 11 | answerBit
} }
func (p *AnswerRecovery) neoMsgEncodedLen() int { func (p *AnswerRecovery) neoMsgEncodedLen() int {
...@@ -350,10 +447,10 @@ overflow: ...@@ -350,10 +447,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 10. LastIDs // 12. LastIDs
func (*LastIDs) neoMsgCode() uint16 { func (*LastIDs) neoMsgCode() uint16 {
return 10 return 12
} }
func (p *LastIDs) neoMsgEncodedLen() int { func (p *LastIDs) neoMsgEncodedLen() int {
...@@ -367,10 +464,10 @@ func (p *LastIDs) neoMsgDecode(data []byte) (int, error) { ...@@ -367,10 +464,10 @@ func (p *LastIDs) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 11. AnswerLastIDs // 13. AnswerLastIDs
func (*AnswerLastIDs) neoMsgCode() uint16 { func (*AnswerLastIDs) neoMsgCode() uint16 {
return 11 return 13 | answerBit
} }
func (p *AnswerLastIDs) neoMsgEncodedLen() int { func (p *AnswerLastIDs) neoMsgEncodedLen() int {
...@@ -394,10 +491,10 @@ overflow: ...@@ -394,10 +491,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 12. AskPartitionTable // 14. AskPartitionTable
func (*AskPartitionTable) neoMsgCode() uint16 { func (*AskPartitionTable) neoMsgCode() uint16 {
return 12 return 14
} }
func (p *AskPartitionTable) neoMsgEncodedLen() int { func (p *AskPartitionTable) neoMsgEncodedLen() int {
...@@ -411,10 +508,10 @@ func (p *AskPartitionTable) neoMsgDecode(data []byte) (int, error) { ...@@ -411,10 +508,10 @@ func (p *AskPartitionTable) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 13. AnswerPartitionTable // 15. AnswerPartitionTable
func (*AnswerPartitionTable) neoMsgCode() uint16 { func (*AnswerPartitionTable) neoMsgCode() uint16 {
return 13 return 15 | answerBit
} }
func (p *AnswerPartitionTable) neoMsgEncodedLen() int { func (p *AnswerPartitionTable) neoMsgEncodedLen() int {
...@@ -491,10 +588,10 @@ overflow: ...@@ -491,10 +588,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 14. NotifyPartitionTable // 16. NotifyPartitionTable
func (*NotifyPartitionTable) neoMsgCode() uint16 { func (*NotifyPartitionTable) neoMsgCode() uint16 {
return 14 return 16
} }
func (p *NotifyPartitionTable) neoMsgEncodedLen() int { func (p *NotifyPartitionTable) neoMsgEncodedLen() int {
...@@ -571,10 +668,10 @@ overflow: ...@@ -571,10 +668,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 15. NotifyPartitionChanges // 17. NotifyPartitionChanges
func (*NotifyPartitionChanges) neoMsgCode() uint16 { func (*NotifyPartitionChanges) neoMsgCode() uint16 {
return 15 return 17
} }
func (p *NotifyPartitionChanges) neoMsgEncodedLen() int { func (p *NotifyPartitionChanges) neoMsgEncodedLen() int {
...@@ -628,10 +725,10 @@ overflow: ...@@ -628,10 +725,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 16. StartOperation // 18. StartOperation
func (*StartOperation) neoMsgCode() uint16 { func (*StartOperation) neoMsgCode() uint16 {
return 16 return 18
} }
func (p *StartOperation) neoMsgEncodedLen() int { func (p *StartOperation) neoMsgEncodedLen() int {
...@@ -653,10 +750,10 @@ overflow: ...@@ -653,10 +750,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 17. StopOperation // 19. StopOperation
func (*StopOperation) neoMsgCode() uint16 { func (*StopOperation) neoMsgCode() uint16 {
return 17 return 19
} }
func (p *StopOperation) neoMsgEncodedLen() int { func (p *StopOperation) neoMsgEncodedLen() int {
...@@ -670,10 +767,10 @@ func (p *StopOperation) neoMsgDecode(data []byte) (int, error) { ...@@ -670,10 +767,10 @@ func (p *StopOperation) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 18. UnfinishedTransactions // 20. UnfinishedTransactions
func (*UnfinishedTransactions) neoMsgCode() uint16 { func (*UnfinishedTransactions) neoMsgCode() uint16 {
return 18 return 20
} }
func (p *UnfinishedTransactions) neoMsgEncodedLen() int { func (p *UnfinishedTransactions) neoMsgEncodedLen() int {
...@@ -718,10 +815,10 @@ overflow: ...@@ -718,10 +815,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 19. AnswerUnfinishedTransactions // 21. AnswerUnfinishedTransactions
func (*AnswerUnfinishedTransactions) neoMsgCode() uint16 { func (*AnswerUnfinishedTransactions) neoMsgCode() uint16 {
return 19 return 21 | answerBit
} }
func (p *AnswerUnfinishedTransactions) neoMsgEncodedLen() int { func (p *AnswerUnfinishedTransactions) neoMsgEncodedLen() int {
...@@ -768,10 +865,10 @@ overflow: ...@@ -768,10 +865,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 20. LockedTransactions // 22. LockedTransactions
func (*LockedTransactions) neoMsgCode() uint16 { func (*LockedTransactions) neoMsgCode() uint16 {
return 20 return 22
} }
func (p *LockedTransactions) neoMsgEncodedLen() int { func (p *LockedTransactions) neoMsgEncodedLen() int {
...@@ -785,10 +882,10 @@ func (p *LockedTransactions) neoMsgDecode(data []byte) (int, error) { ...@@ -785,10 +882,10 @@ func (p *LockedTransactions) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 21. AnswerLockedTransactions // 23. AnswerLockedTransactions
func (*AnswerLockedTransactions) neoMsgCode() uint16 { func (*AnswerLockedTransactions) neoMsgCode() uint16 {
return 21 return 23 | answerBit
} }
func (p *AnswerLockedTransactions) neoMsgEncodedLen() int { func (p *AnswerLockedTransactions) neoMsgEncodedLen() int {
...@@ -839,10 +936,10 @@ overflow: ...@@ -839,10 +936,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 22. FinalTID // 24. FinalTID
func (*FinalTID) neoMsgCode() uint16 { func (*FinalTID) neoMsgCode() uint16 {
return 22 return 24
} }
func (p *FinalTID) neoMsgEncodedLen() int { func (p *FinalTID) neoMsgEncodedLen() int {
...@@ -864,10 +961,10 @@ overflow: ...@@ -864,10 +961,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 23. AnswerFinalTID // 25. AnswerFinalTID
func (*AnswerFinalTID) neoMsgCode() uint16 { func (*AnswerFinalTID) neoMsgCode() uint16 {
return 23 return 25 | answerBit
} }
func (p *AnswerFinalTID) neoMsgEncodedLen() int { func (p *AnswerFinalTID) neoMsgEncodedLen() int {
...@@ -889,10 +986,10 @@ overflow: ...@@ -889,10 +986,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 24. ValidateTransaction // 26. ValidateTransaction
func (*ValidateTransaction) neoMsgCode() uint16 { func (*ValidateTransaction) neoMsgCode() uint16 {
return 24 return 26
} }
func (p *ValidateTransaction) neoMsgEncodedLen() int { func (p *ValidateTransaction) neoMsgEncodedLen() int {
...@@ -916,10 +1013,10 @@ overflow: ...@@ -916,10 +1013,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 25. BeginTransaction // 27. BeginTransaction
func (*BeginTransaction) neoMsgCode() uint16 { func (*BeginTransaction) neoMsgCode() uint16 {
return 25 return 27
} }
func (p *BeginTransaction) neoMsgEncodedLen() int { func (p *BeginTransaction) neoMsgEncodedLen() int {
...@@ -941,10 +1038,10 @@ overflow: ...@@ -941,10 +1038,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 26. AnswerBeginTransaction // 28. AnswerBeginTransaction
func (*AnswerBeginTransaction) neoMsgCode() uint16 { func (*AnswerBeginTransaction) neoMsgCode() uint16 {
return 26 return 28 | answerBit
} }
func (p *AnswerBeginTransaction) neoMsgEncodedLen() int { func (p *AnswerBeginTransaction) neoMsgEncodedLen() int {
...@@ -966,10 +1063,10 @@ overflow: ...@@ -966,10 +1063,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 27. FailedVote // 29. FailedVote
func (*FailedVote) neoMsgCode() uint16 { func (*FailedVote) neoMsgCode() uint16 {
return 27 return 29
} }
func (p *FailedVote) neoMsgEncodedLen() int { func (p *FailedVote) neoMsgEncodedLen() int {
...@@ -1016,10 +1113,10 @@ overflow: ...@@ -1016,10 +1113,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 28. FinishTransaction // 30. FinishTransaction
func (*FinishTransaction) neoMsgCode() uint16 { func (*FinishTransaction) neoMsgCode() uint16 {
return 28 return 30
} }
func (p *FinishTransaction) neoMsgEncodedLen() int { func (p *FinishTransaction) neoMsgEncodedLen() int {
...@@ -1090,10 +1187,10 @@ overflow: ...@@ -1090,10 +1187,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 29. AnswerFinishTransaction // 31. AnswerFinishTransaction
func (*AnswerFinishTransaction) neoMsgCode() uint16 { func (*AnswerFinishTransaction) neoMsgCode() uint16 {
return 29 return 31 | answerBit
} }
func (p *AnswerFinishTransaction) neoMsgEncodedLen() int { func (p *AnswerFinishTransaction) neoMsgEncodedLen() int {
...@@ -1117,10 +1214,10 @@ overflow: ...@@ -1117,10 +1214,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 30. NotifyTransactionFinished // 32. NotifyTransactionFinished
func (*NotifyTransactionFinished) neoMsgCode() uint16 { func (*NotifyTransactionFinished) neoMsgCode() uint16 {
return 30 return 32
} }
func (p *NotifyTransactionFinished) neoMsgEncodedLen() int { func (p *NotifyTransactionFinished) neoMsgEncodedLen() int {
...@@ -1144,10 +1241,10 @@ overflow: ...@@ -1144,10 +1241,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 31. LockInformation // 33. LockInformation
func (*LockInformation) neoMsgCode() uint16 { func (*LockInformation) neoMsgCode() uint16 {
return 31 return 33
} }
func (p *LockInformation) neoMsgEncodedLen() int { func (p *LockInformation) neoMsgEncodedLen() int {
...@@ -1171,10 +1268,10 @@ overflow: ...@@ -1171,10 +1268,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 32. AnswerLockInformation // 34. AnswerLockInformation
func (*AnswerLockInformation) neoMsgCode() uint16 { func (*AnswerLockInformation) neoMsgCode() uint16 {
return 32 return 34 | answerBit
} }
func (p *AnswerLockInformation) neoMsgEncodedLen() int { func (p *AnswerLockInformation) neoMsgEncodedLen() int {
...@@ -1196,10 +1293,10 @@ overflow: ...@@ -1196,10 +1293,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 33. InvalidateObjects // 35. InvalidateObjects
func (*InvalidateObjects) neoMsgCode() uint16 { func (*InvalidateObjects) neoMsgCode() uint16 {
return 33 return 35
} }
func (p *InvalidateObjects) neoMsgEncodedLen() int { func (p *InvalidateObjects) neoMsgEncodedLen() int {
...@@ -1246,10 +1343,10 @@ overflow: ...@@ -1246,10 +1343,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 34. UnlockInformation // 36. UnlockInformation
func (*UnlockInformation) neoMsgCode() uint16 { func (*UnlockInformation) neoMsgCode() uint16 {
return 34 return 36
} }
func (p *UnlockInformation) neoMsgEncodedLen() int { func (p *UnlockInformation) neoMsgEncodedLen() int {
...@@ -1271,10 +1368,10 @@ overflow: ...@@ -1271,10 +1368,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 35. GenerateOIDs // 37. GenerateOIDs
func (*GenerateOIDs) neoMsgCode() uint16 { func (*GenerateOIDs) neoMsgCode() uint16 {
return 35 return 37
} }
func (p *GenerateOIDs) neoMsgEncodedLen() int { func (p *GenerateOIDs) neoMsgEncodedLen() int {
...@@ -1296,10 +1393,10 @@ overflow: ...@@ -1296,10 +1393,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 36. AnswerGenerateOIDs // 38. AnswerGenerateOIDs
func (*AnswerGenerateOIDs) neoMsgCode() uint16 { func (*AnswerGenerateOIDs) neoMsgCode() uint16 {
return 36 return 38 | answerBit
} }
func (p *AnswerGenerateOIDs) neoMsgEncodedLen() int { func (p *AnswerGenerateOIDs) neoMsgEncodedLen() int {
...@@ -1344,10 +1441,10 @@ overflow: ...@@ -1344,10 +1441,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 37. Deadlock // 39. Deadlock
func (*Deadlock) neoMsgCode() uint16 { func (*Deadlock) neoMsgCode() uint16 {
return 37 return 39
} }
func (p *Deadlock) neoMsgEncodedLen() int { func (p *Deadlock) neoMsgEncodedLen() int {
...@@ -1371,10 +1468,10 @@ overflow: ...@@ -1371,10 +1468,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 38. RebaseTransaction // 40. RebaseTransaction
func (*RebaseTransaction) neoMsgCode() uint16 { func (*RebaseTransaction) neoMsgCode() uint16 {
return 38 return 40
} }
func (p *RebaseTransaction) neoMsgEncodedLen() int { func (p *RebaseTransaction) neoMsgEncodedLen() int {
...@@ -1398,10 +1495,10 @@ overflow: ...@@ -1398,10 +1495,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 39. AnswerRebaseTransaction // 41. AnswerRebaseTransaction
func (*AnswerRebaseTransaction) neoMsgCode() uint16 { func (*AnswerRebaseTransaction) neoMsgCode() uint16 {
return 39 return 41 | answerBit
} }
func (p *AnswerRebaseTransaction) neoMsgEncodedLen() int { func (p *AnswerRebaseTransaction) neoMsgEncodedLen() int {
...@@ -1446,10 +1543,10 @@ overflow: ...@@ -1446,10 +1543,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 40. RebaseObject // 42. RebaseObject
func (*RebaseObject) neoMsgCode() uint16 { func (*RebaseObject) neoMsgCode() uint16 {
return 40 return 42
} }
func (p *RebaseObject) neoMsgEncodedLen() int { func (p *RebaseObject) neoMsgEncodedLen() int {
...@@ -1473,10 +1570,10 @@ overflow: ...@@ -1473,10 +1570,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 41. AnswerRebaseObject // 43. AnswerRebaseObject
func (*AnswerRebaseObject) neoMsgCode() uint16 { func (*AnswerRebaseObject) neoMsgCode() uint16 {
return 41 return 43 | answerBit
} }
func (p *AnswerRebaseObject) neoMsgEncodedLen() int { func (p *AnswerRebaseObject) neoMsgEncodedLen() int {
...@@ -1523,10 +1620,10 @@ overflow: ...@@ -1523,10 +1620,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 42. StoreObject // 44. StoreObject
func (*StoreObject) neoMsgCode() uint16 { func (*StoreObject) neoMsgCode() uint16 {
return 42 return 44
} }
func (p *StoreObject) neoMsgEncodedLen() int { func (p *StoreObject) neoMsgEncodedLen() int {
...@@ -1577,10 +1674,10 @@ overflow: ...@@ -1577,10 +1674,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 43. AnswerStoreObject // 45. AnswerStoreObject
func (*AnswerStoreObject) neoMsgCode() uint16 { func (*AnswerStoreObject) neoMsgCode() uint16 {
return 43 return 45 | answerBit
} }
func (p *AnswerStoreObject) neoMsgEncodedLen() int { func (p *AnswerStoreObject) neoMsgEncodedLen() int {
...@@ -1602,10 +1699,10 @@ overflow: ...@@ -1602,10 +1699,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 44. AbortTransaction // 46. AbortTransaction
func (*AbortTransaction) neoMsgCode() uint16 { func (*AbortTransaction) neoMsgCode() uint16 {
return 44 return 46
} }
func (p *AbortTransaction) neoMsgEncodedLen() int { func (p *AbortTransaction) neoMsgEncodedLen() int {
...@@ -1652,10 +1749,10 @@ overflow: ...@@ -1652,10 +1749,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 45. StoreTransaction // 47. StoreTransaction
func (*StoreTransaction) neoMsgCode() uint16 { func (*StoreTransaction) neoMsgCode() uint16 {
return 45 return 47
} }
func (p *StoreTransaction) neoMsgEncodedLen() int { func (p *StoreTransaction) neoMsgEncodedLen() int {
...@@ -1753,10 +1850,10 @@ overflow: ...@@ -1753,10 +1850,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 46. VoteTransaction // 48. VoteTransaction
func (*VoteTransaction) neoMsgCode() uint16 { func (*VoteTransaction) neoMsgCode() uint16 {
return 46 return 48
} }
func (p *VoteTransaction) neoMsgEncodedLen() int { func (p *VoteTransaction) neoMsgEncodedLen() int {
...@@ -1778,10 +1875,10 @@ overflow: ...@@ -1778,10 +1875,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 47. GetObject // 49. GetObject
func (*GetObject) neoMsgCode() uint16 { func (*GetObject) neoMsgCode() uint16 {
return 47 return 49
} }
func (p *GetObject) neoMsgEncodedLen() int { func (p *GetObject) neoMsgEncodedLen() int {
...@@ -1807,10 +1904,10 @@ overflow: ...@@ -1807,10 +1904,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 48. AnswerGetObject // 50. AnswerGetObject
func (*AnswerGetObject) neoMsgCode() uint16 { func (*AnswerGetObject) neoMsgCode() uint16 {
return 48 return 50 | answerBit
} }
func (p *AnswerGetObject) neoMsgEncodedLen() int { func (p *AnswerGetObject) neoMsgEncodedLen() int {
...@@ -1861,10 +1958,10 @@ overflow: ...@@ -1861,10 +1958,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 49. TIDList // 51. TIDList
func (*TIDList) neoMsgCode() uint16 { func (*TIDList) neoMsgCode() uint16 {
return 49 return 51
} }
func (p *TIDList) neoMsgEncodedLen() int { func (p *TIDList) neoMsgEncodedLen() int {
...@@ -1890,10 +1987,10 @@ overflow: ...@@ -1890,10 +1987,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 50. AnswerTIDList // 52. AnswerTIDList
func (*AnswerTIDList) neoMsgCode() uint16 { func (*AnswerTIDList) neoMsgCode() uint16 {
return 50 return 52 | answerBit
} }
func (p *AnswerTIDList) neoMsgEncodedLen() int { func (p *AnswerTIDList) neoMsgEncodedLen() int {
...@@ -1938,10 +2035,10 @@ overflow: ...@@ -1938,10 +2035,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 51. TIDListFrom // 53. TIDListFrom
func (*TIDListFrom) neoMsgCode() uint16 { func (*TIDListFrom) neoMsgCode() uint16 {
return 51 return 53
} }
func (p *TIDListFrom) neoMsgEncodedLen() int { func (p *TIDListFrom) neoMsgEncodedLen() int {
...@@ -1969,10 +2066,10 @@ overflow: ...@@ -1969,10 +2066,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 52. AnswerTIDListFrom // 54. AnswerTIDListFrom
func (*AnswerTIDListFrom) neoMsgCode() uint16 { func (*AnswerTIDListFrom) neoMsgCode() uint16 {
return 52 return 54 | answerBit
} }
func (p *AnswerTIDListFrom) neoMsgEncodedLen() int { func (p *AnswerTIDListFrom) neoMsgEncodedLen() int {
...@@ -2017,10 +2114,10 @@ overflow: ...@@ -2017,10 +2114,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 53. TransactionInformation // 55. TransactionInformation
func (*TransactionInformation) neoMsgCode() uint16 { func (*TransactionInformation) neoMsgCode() uint16 {
return 53 return 55
} }
func (p *TransactionInformation) neoMsgEncodedLen() int { func (p *TransactionInformation) neoMsgEncodedLen() int {
...@@ -2042,10 +2139,10 @@ overflow: ...@@ -2042,10 +2139,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 54. AnswerTransactionInformation // 56. AnswerTransactionInformation
func (*AnswerTransactionInformation) neoMsgCode() uint16 { func (*AnswerTransactionInformation) neoMsgCode() uint16 {
return 54 return 56 | answerBit
} }
func (p *AnswerTransactionInformation) neoMsgEncodedLen() int { func (p *AnswerTransactionInformation) neoMsgEncodedLen() int {
...@@ -2145,10 +2242,10 @@ overflow: ...@@ -2145,10 +2242,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 55. ObjectHistory // 57. ObjectHistory
func (*ObjectHistory) neoMsgCode() uint16 { func (*ObjectHistory) neoMsgCode() uint16 {
return 55 return 57
} }
func (p *ObjectHistory) neoMsgEncodedLen() int { func (p *ObjectHistory) neoMsgEncodedLen() int {
...@@ -2174,10 +2271,10 @@ overflow: ...@@ -2174,10 +2271,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 56. AnswerObjectHistory // 58. AnswerObjectHistory
func (*AnswerObjectHistory) neoMsgCode() uint16 { func (*AnswerObjectHistory) neoMsgCode() uint16 {
return 56 return 58 | answerBit
} }
func (p *AnswerObjectHistory) neoMsgEncodedLen() int { func (p *AnswerObjectHistory) neoMsgEncodedLen() int {
...@@ -2229,10 +2326,10 @@ overflow: ...@@ -2229,10 +2326,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 57. PartitionList // 59. PartitionList
func (*PartitionList) neoMsgCode() uint16 { func (*PartitionList) neoMsgCode() uint16 {
return 57 return 59
} }
func (p *PartitionList) neoMsgEncodedLen() int { func (p *PartitionList) neoMsgEncodedLen() int {
...@@ -2258,10 +2355,10 @@ overflow: ...@@ -2258,10 +2355,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 58. AnswerPartitionList // 60. AnswerPartitionList
func (*AnswerPartitionList) neoMsgCode() uint16 { func (*AnswerPartitionList) neoMsgCode() uint16 {
return 58 return 60 | answerBit
} }
func (p *AnswerPartitionList) neoMsgEncodedLen() int { func (p *AnswerPartitionList) neoMsgEncodedLen() int {
...@@ -2338,10 +2435,10 @@ overflow: ...@@ -2338,10 +2435,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 59. NodeList // 61. NodeList
func (*NodeList) neoMsgCode() uint16 { func (*NodeList) neoMsgCode() uint16 {
return 59 return 61
} }
func (p *NodeList) neoMsgEncodedLen() int { func (p *NodeList) neoMsgEncodedLen() int {
...@@ -2363,10 +2460,10 @@ overflow: ...@@ -2363,10 +2460,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 60. AnswerNodeList // 62. AnswerNodeList
func (*AnswerNodeList) neoMsgCode() uint16 { func (*AnswerNodeList) neoMsgCode() uint16 {
return 60 return 62 | answerBit
} }
func (p *AnswerNodeList) neoMsgEncodedLen() int { func (p *AnswerNodeList) neoMsgEncodedLen() int {
...@@ -2441,10 +2538,10 @@ overflow: ...@@ -2441,10 +2538,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 61. SetNodeState // 63. SetNodeState
func (*SetNodeState) neoMsgCode() uint16 { func (*SetNodeState) neoMsgCode() uint16 {
return 61 return 63
} }
func (p *SetNodeState) neoMsgEncodedLen() int { func (p *SetNodeState) neoMsgEncodedLen() int {
...@@ -2468,10 +2565,10 @@ overflow: ...@@ -2468,10 +2565,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 62. AddPendingNodes // 64. AddPendingNodes
func (*AddPendingNodes) neoMsgCode() uint16 { func (*AddPendingNodes) neoMsgCode() uint16 {
return 62 return 64
} }
func (p *AddPendingNodes) neoMsgEncodedLen() int { func (p *AddPendingNodes) neoMsgEncodedLen() int {
...@@ -2516,10 +2613,10 @@ overflow: ...@@ -2516,10 +2613,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 63. TweakPartitionTable // 65. TweakPartitionTable
func (*TweakPartitionTable) neoMsgCode() uint16 { func (*TweakPartitionTable) neoMsgCode() uint16 {
return 63 return 65
} }
func (p *TweakPartitionTable) neoMsgEncodedLen() int { func (p *TweakPartitionTable) neoMsgEncodedLen() int {
...@@ -2564,90 +2661,10 @@ overflow: ...@@ -2564,90 +2661,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 64. NotifyNodeInformation // 66. NodeInformation
func (*NotifyNodeInformation) neoMsgCode() uint16 {
return 64
}
func (p *NotifyNodeInformation) neoMsgEncodedLen() int {
var size int
for i := 0; i < len(p.NodeList); i++ {
a := &p.NodeList[i]
size += len((*a).Addr.Host)
}
return 12 + len(p.NodeList)*26 + size
}
func (p *NotifyNodeInformation) neoMsgEncode(data []byte) {
float64_NEOEncode(data[0:], p.IdTimestamp)
{
l := uint32(len(p.NodeList))
binary.BigEndian.PutUint32(data[8:], l)
data = data[12:]
for i := 0; uint32(i) < l; i++ {
a := &p.NodeList[i]
binary.BigEndian.PutUint32(data[0:], uint32(int32((*a).Type)))
{
l := uint32(len((*a).Addr.Host))
binary.BigEndian.PutUint32(data[4:], l)
data = data[8:]
copy(data, (*a).Addr.Host)
data = data[l:]
}
binary.BigEndian.PutUint16(data[0:], (*a).Addr.Port)
binary.BigEndian.PutUint32(data[2:], uint32(int32((*a).UUID)))
binary.BigEndian.PutUint32(data[6:], uint32(int32((*a).State)))
float64_NEOEncode(data[10:], (*a).IdTimestamp)
data = data[18:]
}
}
}
func (p *NotifyNodeInformation) neoMsgDecode(data []byte) (int, error) {
var nread uint32
if uint32(len(data)) < 12 {
goto overflow
}
p.IdTimestamp = float64_NEODecode(data[0:])
{
l := binary.BigEndian.Uint32(data[8:])
data = data[12:]
p.NodeList = make([]NodeInfo, l)
for i := 0; uint32(i) < l; i++ {
a := &p.NodeList[i]
if uint32(len(data)) < 8 {
goto overflow
}
(*a).Type = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
{
l := binary.BigEndian.Uint32(data[4:])
data = data[8:]
if uint32(len(data)) < 18+l {
goto overflow
}
nread += 18 + l
(*a).Addr.Host = string(data[:l])
data = data[l:]
}
(*a).Addr.Port = binary.BigEndian.Uint16(data[0:])
(*a).UUID = NodeUUID(int32(binary.BigEndian.Uint32(data[2:])))
(*a).State = NodeState(int32(binary.BigEndian.Uint32(data[6:])))
(*a).IdTimestamp = float64_NEODecode(data[10:])
data = data[18:]
}
nread += l * 8
}
return 12 + int(nread), nil
overflow:
return 0, ErrDecodeOverflow
}
// 65. NodeInformation
func (*NodeInformation) neoMsgCode() uint16 { func (*NodeInformation) neoMsgCode() uint16 {
return 65 return 66
} }
func (p *NodeInformation) neoMsgEncodedLen() int { func (p *NodeInformation) neoMsgEncodedLen() int {
...@@ -2661,10 +2678,10 @@ func (p *NodeInformation) neoMsgDecode(data []byte) (int, error) { ...@@ -2661,10 +2678,10 @@ func (p *NodeInformation) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 66. SetClusterState // 67. SetClusterState
func (*SetClusterState) neoMsgCode() uint16 { func (*SetClusterState) neoMsgCode() uint16 {
return 66 return 67
} }
func (p *SetClusterState) neoMsgEncodedLen() int { func (p *SetClusterState) neoMsgEncodedLen() int {
...@@ -2686,10 +2703,10 @@ overflow: ...@@ -2686,10 +2703,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 67. repairFlags // 68. repairFlags
func (*repairFlags) neoMsgCode() uint16 { func (*repairFlags) neoMsgCode() uint16 {
return 67 return 68
} }
func (p *repairFlags) neoMsgEncodedLen() int { func (p *repairFlags) neoMsgEncodedLen() int {
...@@ -2711,10 +2728,10 @@ overflow: ...@@ -2711,10 +2728,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 68. Repair // 69. Repair
func (*Repair) neoMsgCode() uint16 { func (*Repair) neoMsgCode() uint16 {
return 68 return 69
} }
func (p *Repair) neoMsgEncodedLen() int { func (p *Repair) neoMsgEncodedLen() int {
...@@ -2761,10 +2778,10 @@ overflow: ...@@ -2761,10 +2778,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 69. RepairOne // 70. RepairOne
func (*RepairOne) neoMsgCode() uint16 { func (*RepairOne) neoMsgCode() uint16 {
return 69 return 70
} }
func (p *RepairOne) neoMsgEncodedLen() int { func (p *RepairOne) neoMsgEncodedLen() int {
...@@ -2786,10 +2803,10 @@ overflow: ...@@ -2786,10 +2803,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 70. NotifyClusterState // 71. NotifyClusterState
func (*NotifyClusterState) neoMsgCode() uint16 { func (*NotifyClusterState) neoMsgCode() uint16 {
return 70 return 71
} }
func (p *NotifyClusterState) neoMsgEncodedLen() int { func (p *NotifyClusterState) neoMsgEncodedLen() int {
...@@ -2811,10 +2828,10 @@ overflow: ...@@ -2811,10 +2828,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 71. AskClusterState // 72. AskClusterState
func (*AskClusterState) neoMsgCode() uint16 { func (*AskClusterState) neoMsgCode() uint16 {
return 71 return 72
} }
func (p *AskClusterState) neoMsgEncodedLen() int { func (p *AskClusterState) neoMsgEncodedLen() int {
...@@ -2828,10 +2845,10 @@ func (p *AskClusterState) neoMsgDecode(data []byte) (int, error) { ...@@ -2828,10 +2845,10 @@ func (p *AskClusterState) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 72. AnswerClusterState // 73. AnswerClusterState
func (*AnswerClusterState) neoMsgCode() uint16 { func (*AnswerClusterState) neoMsgCode() uint16 {
return 72 return 73 | answerBit
} }
func (p *AnswerClusterState) neoMsgEncodedLen() int { func (p *AnswerClusterState) neoMsgEncodedLen() int {
...@@ -2853,10 +2870,10 @@ overflow: ...@@ -2853,10 +2870,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 73. ObjectUndoSerial // 74. ObjectUndoSerial
func (*ObjectUndoSerial) neoMsgCode() uint16 { func (*ObjectUndoSerial) neoMsgCode() uint16 {
return 73 return 74
} }
func (p *ObjectUndoSerial) neoMsgEncodedLen() int { func (p *ObjectUndoSerial) neoMsgEncodedLen() int {
...@@ -2907,10 +2924,10 @@ overflow: ...@@ -2907,10 +2924,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 74. AnswerObjectUndoSerial // 75. AnswerObjectUndoSerial
func (*AnswerObjectUndoSerial) neoMsgCode() uint16 { func (*AnswerObjectUndoSerial) neoMsgCode() uint16 {
return 74 return 75 | answerBit
} }
func (p *AnswerObjectUndoSerial) neoMsgEncodedLen() int { func (p *AnswerObjectUndoSerial) neoMsgEncodedLen() int {
...@@ -2975,10 +2992,10 @@ overflow: ...@@ -2975,10 +2992,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 75. CheckCurrentSerial // 76. CheckCurrentSerial
func (*CheckCurrentSerial) neoMsgCode() uint16 { func (*CheckCurrentSerial) neoMsgCode() uint16 {
return 75 return 76
} }
func (p *CheckCurrentSerial) neoMsgEncodedLen() int { func (p *CheckCurrentSerial) neoMsgEncodedLen() int {
...@@ -3004,10 +3021,10 @@ overflow: ...@@ -3004,10 +3021,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 76. Pack // 77. Pack
func (*Pack) neoMsgCode() uint16 { func (*Pack) neoMsgCode() uint16 {
return 76 return 77
} }
func (p *Pack) neoMsgEncodedLen() int { func (p *Pack) neoMsgEncodedLen() int {
...@@ -3029,10 +3046,10 @@ overflow: ...@@ -3029,10 +3046,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 77. AnswerPack // 78. AnswerPack
func (*AnswerPack) neoMsgCode() uint16 { func (*AnswerPack) neoMsgCode() uint16 {
return 77 return 78 | answerBit
} }
func (p *AnswerPack) neoMsgEncodedLen() int { func (p *AnswerPack) neoMsgEncodedLen() int {
...@@ -3054,10 +3071,10 @@ overflow: ...@@ -3054,10 +3071,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 78. CheckReplicas // 79. CheckReplicas
func (*CheckReplicas) neoMsgCode() uint16 { func (*CheckReplicas) neoMsgCode() uint16 {
return 78 return 79
} }
func (p *CheckReplicas) neoMsgEncodedLen() int { func (p *CheckReplicas) neoMsgEncodedLen() int {
...@@ -3112,10 +3129,10 @@ overflow: ...@@ -3112,10 +3129,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 79. CheckPartition // 80. CheckPartition
func (*CheckPartition) neoMsgCode() uint16 { func (*CheckPartition) neoMsgCode() uint16 {
return 79 return 80
} }
func (p *CheckPartition) neoMsgEncodedLen() int { func (p *CheckPartition) neoMsgEncodedLen() int {
...@@ -3178,10 +3195,10 @@ overflow: ...@@ -3178,10 +3195,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 80. CheckTIDRange // 81. CheckTIDRange
func (*CheckTIDRange) neoMsgCode() uint16 { func (*CheckTIDRange) neoMsgCode() uint16 {
return 80 return 81
} }
func (p *CheckTIDRange) neoMsgEncodedLen() int { func (p *CheckTIDRange) neoMsgEncodedLen() int {
...@@ -3209,10 +3226,10 @@ overflow: ...@@ -3209,10 +3226,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 81. AnswerCheckTIDRange // 82. AnswerCheckTIDRange
func (*AnswerCheckTIDRange) neoMsgCode() uint16 { func (*AnswerCheckTIDRange) neoMsgCode() uint16 {
return 81 return 82 | answerBit
} }
func (p *AnswerCheckTIDRange) neoMsgEncodedLen() int { func (p *AnswerCheckTIDRange) neoMsgEncodedLen() int {
...@@ -3238,10 +3255,10 @@ overflow: ...@@ -3238,10 +3255,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 82. CheckSerialRange // 83. CheckSerialRange
func (*CheckSerialRange) neoMsgCode() uint16 { func (*CheckSerialRange) neoMsgCode() uint16 {
return 82 return 83
} }
func (p *CheckSerialRange) neoMsgEncodedLen() int { func (p *CheckSerialRange) neoMsgEncodedLen() int {
...@@ -3271,10 +3288,10 @@ overflow: ...@@ -3271,10 +3288,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 83. AnswerCheckSerialRange // 84. AnswerCheckSerialRange
func (*AnswerCheckSerialRange) neoMsgCode() uint16 { func (*AnswerCheckSerialRange) neoMsgCode() uint16 {
return 83 return 84 | answerBit
} }
func (p *AnswerCheckSerialRange) neoMsgEncodedLen() int { func (p *AnswerCheckSerialRange) neoMsgEncodedLen() int {
...@@ -3304,10 +3321,10 @@ overflow: ...@@ -3304,10 +3321,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 84. PartitionCorrupted // 85. PartitionCorrupted
func (*PartitionCorrupted) neoMsgCode() uint16 { func (*PartitionCorrupted) neoMsgCode() uint16 {
return 84 return 85
} }
func (p *PartitionCorrupted) neoMsgEncodedLen() int { func (p *PartitionCorrupted) neoMsgEncodedLen() int {
...@@ -3354,10 +3371,10 @@ overflow: ...@@ -3354,10 +3371,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 85. LastTransaction // 86. LastTransaction
func (*LastTransaction) neoMsgCode() uint16 { func (*LastTransaction) neoMsgCode() uint16 {
return 85 return 86
} }
func (p *LastTransaction) neoMsgEncodedLen() int { func (p *LastTransaction) neoMsgEncodedLen() int {
...@@ -3371,10 +3388,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) { ...@@ -3371,10 +3388,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
return 0, nil return 0, nil
} }
// 86. AnswerLastTransaction // 87. AnswerLastTransaction
func (*AnswerLastTransaction) neoMsgCode() uint16 { func (*AnswerLastTransaction) neoMsgCode() uint16 {
return 86 return 87 | answerBit
} }
func (p *AnswerLastTransaction) neoMsgEncodedLen() int { func (p *AnswerLastTransaction) neoMsgEncodedLen() int {
...@@ -3396,10 +3413,10 @@ overflow: ...@@ -3396,10 +3413,10 @@ overflow:
return 0, ErrDecodeOverflow return 0, ErrDecodeOverflow
} }
// 87. NotifyReady // 88. NotifyReady
func (*NotifyReady) neoMsgCode() uint16 { func (*NotifyReady) neoMsgCode() uint16 {
return 87 return 88
} }
func (p *NotifyReady) neoMsgEncodedLen() int { func (p *NotifyReady) neoMsgEncodedLen() int {
...@@ -3415,92 +3432,93 @@ func (p *NotifyReady) neoMsgDecode(data []byte) (int, error) { ...@@ -3415,92 +3432,93 @@ func (p *NotifyReady) neoMsgDecode(data []byte) (int, error) {
// registry of message types // registry of message types
var msgTypeRegistry = map[uint16]reflect.Type{ var msgTypeRegistry = map[uint16]reflect.Type{
0: reflect.TypeOf(Error{}), 0 | answerBit: reflect.TypeOf(Error{}),
1: reflect.TypeOf(RequestIdentification{}), 1: reflect.TypeOf(RequestIdentification{}),
2 | answerBit: reflect.TypeOf(AcceptIdentification{}), 2 | answerBit: reflect.TypeOf(AcceptIdentification{}),
3: reflect.TypeOf(Ping{}), 3: reflect.TypeOf(Ping{}),
4: reflect.TypeOf(CloseClient{}), 4 | answerBit: reflect.TypeOf(Pong{}),
5: reflect.TypeOf(PrimaryMaster{}), 5: reflect.TypeOf(CloseClient{}),
6: reflect.TypeOf(AnswerPrimary{}), 6: reflect.TypeOf(PrimaryMaster{}),
7: reflect.TypeOf(NotPrimaryMaster{}), 7 | answerBit: reflect.TypeOf(AnswerPrimary{}),
8: reflect.TypeOf(Recovery{}), 8: reflect.TypeOf(NotPrimaryMaster{}),
9: reflect.TypeOf(AnswerRecovery{}), 9: reflect.TypeOf(NotifyNodeInformation{}),
10: reflect.TypeOf(LastIDs{}), 10: reflect.TypeOf(Recovery{}),
11: reflect.TypeOf(AnswerLastIDs{}), 11 | answerBit: reflect.TypeOf(AnswerRecovery{}),
12: reflect.TypeOf(AskPartitionTable{}), 12: reflect.TypeOf(LastIDs{}),
13: reflect.TypeOf(AnswerPartitionTable{}), 13 | answerBit: reflect.TypeOf(AnswerLastIDs{}),
14: reflect.TypeOf(NotifyPartitionTable{}), 14: reflect.TypeOf(AskPartitionTable{}),
15: reflect.TypeOf(NotifyPartitionChanges{}), 15 | answerBit: reflect.TypeOf(AnswerPartitionTable{}),
16: reflect.TypeOf(StartOperation{}), 16: reflect.TypeOf(NotifyPartitionTable{}),
17: reflect.TypeOf(StopOperation{}), 17: reflect.TypeOf(NotifyPartitionChanges{}),
18: reflect.TypeOf(UnfinishedTransactions{}), 18: reflect.TypeOf(StartOperation{}),
19: reflect.TypeOf(AnswerUnfinishedTransactions{}), 19: reflect.TypeOf(StopOperation{}),
20: reflect.TypeOf(LockedTransactions{}), 20: reflect.TypeOf(UnfinishedTransactions{}),
21: reflect.TypeOf(AnswerLockedTransactions{}), 21 | answerBit: reflect.TypeOf(AnswerUnfinishedTransactions{}),
22: reflect.TypeOf(FinalTID{}), 22: reflect.TypeOf(LockedTransactions{}),
23: reflect.TypeOf(AnswerFinalTID{}), 23 | answerBit: reflect.TypeOf(AnswerLockedTransactions{}),
24: reflect.TypeOf(ValidateTransaction{}), 24: reflect.TypeOf(FinalTID{}),
25: reflect.TypeOf(BeginTransaction{}), 25 | answerBit: reflect.TypeOf(AnswerFinalTID{}),
26: reflect.TypeOf(AnswerBeginTransaction{}), 26: reflect.TypeOf(ValidateTransaction{}),
27: reflect.TypeOf(FailedVote{}), 27: reflect.TypeOf(BeginTransaction{}),
28: reflect.TypeOf(FinishTransaction{}), 28 | answerBit: reflect.TypeOf(AnswerBeginTransaction{}),
29: reflect.TypeOf(AnswerFinishTransaction{}), 29: reflect.TypeOf(FailedVote{}),
30: reflect.TypeOf(NotifyTransactionFinished{}), 30: reflect.TypeOf(FinishTransaction{}),
31: reflect.TypeOf(LockInformation{}), 31 | answerBit: reflect.TypeOf(AnswerFinishTransaction{}),
32: reflect.TypeOf(AnswerLockInformation{}), 32: reflect.TypeOf(NotifyTransactionFinished{}),
33: reflect.TypeOf(InvalidateObjects{}), 33: reflect.TypeOf(LockInformation{}),
34: reflect.TypeOf(UnlockInformation{}), 34 | answerBit: reflect.TypeOf(AnswerLockInformation{}),
35: reflect.TypeOf(GenerateOIDs{}), 35: reflect.TypeOf(InvalidateObjects{}),
36: reflect.TypeOf(AnswerGenerateOIDs{}), 36: reflect.TypeOf(UnlockInformation{}),
37: reflect.TypeOf(Deadlock{}), 37: reflect.TypeOf(GenerateOIDs{}),
38: reflect.TypeOf(RebaseTransaction{}), 38 | answerBit: reflect.TypeOf(AnswerGenerateOIDs{}),
39: reflect.TypeOf(AnswerRebaseTransaction{}), 39: reflect.TypeOf(Deadlock{}),
40: reflect.TypeOf(RebaseObject{}), 40: reflect.TypeOf(RebaseTransaction{}),
41: reflect.TypeOf(AnswerRebaseObject{}), 41 | answerBit: reflect.TypeOf(AnswerRebaseTransaction{}),
42: reflect.TypeOf(StoreObject{}), 42: reflect.TypeOf(RebaseObject{}),
43: reflect.TypeOf(AnswerStoreObject{}), 43 | answerBit: reflect.TypeOf(AnswerRebaseObject{}),
44: reflect.TypeOf(AbortTransaction{}), 44: reflect.TypeOf(StoreObject{}),
45: reflect.TypeOf(StoreTransaction{}), 45 | answerBit: reflect.TypeOf(AnswerStoreObject{}),
46: reflect.TypeOf(VoteTransaction{}), 46: reflect.TypeOf(AbortTransaction{}),
47: reflect.TypeOf(GetObject{}), 47: reflect.TypeOf(StoreTransaction{}),
48: reflect.TypeOf(AnswerGetObject{}), 48: reflect.TypeOf(VoteTransaction{}),
49: reflect.TypeOf(TIDList{}), 49: reflect.TypeOf(GetObject{}),
50: reflect.TypeOf(AnswerTIDList{}), 50 | answerBit: reflect.TypeOf(AnswerGetObject{}),
51: reflect.TypeOf(TIDListFrom{}), 51: reflect.TypeOf(TIDList{}),
52: reflect.TypeOf(AnswerTIDListFrom{}), 52 | answerBit: reflect.TypeOf(AnswerTIDList{}),
53: reflect.TypeOf(TransactionInformation{}), 53: reflect.TypeOf(TIDListFrom{}),
54: reflect.TypeOf(AnswerTransactionInformation{}), 54 | answerBit: reflect.TypeOf(AnswerTIDListFrom{}),
55: reflect.TypeOf(ObjectHistory{}), 55: reflect.TypeOf(TransactionInformation{}),
56: reflect.TypeOf(AnswerObjectHistory{}), 56 | answerBit: reflect.TypeOf(AnswerTransactionInformation{}),
57: reflect.TypeOf(PartitionList{}), 57: reflect.TypeOf(ObjectHistory{}),
58: reflect.TypeOf(AnswerPartitionList{}), 58 | answerBit: reflect.TypeOf(AnswerObjectHistory{}),
59: reflect.TypeOf(NodeList{}), 59: reflect.TypeOf(PartitionList{}),
60: reflect.TypeOf(AnswerNodeList{}), 60 | answerBit: reflect.TypeOf(AnswerPartitionList{}),
61: reflect.TypeOf(SetNodeState{}), 61: reflect.TypeOf(NodeList{}),
62: reflect.TypeOf(AddPendingNodes{}), 62 | answerBit: reflect.TypeOf(AnswerNodeList{}),
63: reflect.TypeOf(TweakPartitionTable{}), 63: reflect.TypeOf(SetNodeState{}),
64: reflect.TypeOf(NotifyNodeInformation{}), 64: reflect.TypeOf(AddPendingNodes{}),
65: reflect.TypeOf(NodeInformation{}), 65: reflect.TypeOf(TweakPartitionTable{}),
66: reflect.TypeOf(SetClusterState{}), 66: reflect.TypeOf(NodeInformation{}),
67: reflect.TypeOf(repairFlags{}), 67: reflect.TypeOf(SetClusterState{}),
68: reflect.TypeOf(Repair{}), 68: reflect.TypeOf(repairFlags{}),
69: reflect.TypeOf(RepairOne{}), 69: reflect.TypeOf(Repair{}),
70: reflect.TypeOf(NotifyClusterState{}), 70: reflect.TypeOf(RepairOne{}),
71: reflect.TypeOf(AskClusterState{}), 71: reflect.TypeOf(NotifyClusterState{}),
72: reflect.TypeOf(AnswerClusterState{}), 72: reflect.TypeOf(AskClusterState{}),
73: reflect.TypeOf(ObjectUndoSerial{}), 73 | answerBit: reflect.TypeOf(AnswerClusterState{}),
74: reflect.TypeOf(AnswerObjectUndoSerial{}), 74: reflect.TypeOf(ObjectUndoSerial{}),
75: reflect.TypeOf(CheckCurrentSerial{}), 75 | answerBit: reflect.TypeOf(AnswerObjectUndoSerial{}),
76: reflect.TypeOf(Pack{}), 76: reflect.TypeOf(CheckCurrentSerial{}),
77: reflect.TypeOf(AnswerPack{}), 77: reflect.TypeOf(Pack{}),
78: reflect.TypeOf(CheckReplicas{}), 78 | answerBit: reflect.TypeOf(AnswerPack{}),
79: reflect.TypeOf(CheckPartition{}), 79: reflect.TypeOf(CheckReplicas{}),
80: reflect.TypeOf(CheckTIDRange{}), 80: reflect.TypeOf(CheckPartition{}),
81: reflect.TypeOf(AnswerCheckTIDRange{}), 81: reflect.TypeOf(CheckTIDRange{}),
82: reflect.TypeOf(CheckSerialRange{}), 82 | answerBit: reflect.TypeOf(AnswerCheckTIDRange{}),
83: reflect.TypeOf(AnswerCheckSerialRange{}), 83: reflect.TypeOf(CheckSerialRange{}),
84: reflect.TypeOf(PartitionCorrupted{}), 84 | answerBit: reflect.TypeOf(AnswerCheckSerialRange{}),
85: reflect.TypeOf(LastTransaction{}), 85: reflect.TypeOf(PartitionCorrupted{}),
86: reflect.TypeOf(AnswerLastTransaction{}), 86: reflect.TypeOf(LastTransaction{}),
87: reflect.TypeOf(NotifyReady{}), 87 | answerBit: reflect.TypeOf(AnswerLastTransaction{}),
88: reflect.TypeOf(NotifyReady{}),
} }
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