Commit 653a4785 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c1eed395
...@@ -6,6 +6,8 @@ import ( ...@@ -6,6 +6,8 @@ import (
"encoding/binary" "encoding/binary"
) )
// 0. Address
func (p *Address) NEODecode(data []byte) (int, error) { func (p *Address) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -22,6 +24,8 @@ func (p *Address) NEODecode(data []byte) (int, error) { ...@@ -22,6 +24,8 @@ func (p *Address) NEODecode(data []byte) (int, error) {
return int(nread) + 2, nil return int(nread) + 2, nil
} }
// 1. NodeInfo
func (p *NodeInfo) NEODecode(data []byte) (int, error) { func (p *NodeInfo) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:]))) p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
...@@ -42,6 +46,8 @@ func (p *NodeInfo) NEODecode(data []byte) (int, error) { ...@@ -42,6 +46,8 @@ func (p *NodeInfo) NEODecode(data []byte) (int, error) {
return int(nread) + 18, nil return int(nread) + 18, nil
} }
// 2. CellInfo
func (p *CellInfo) NEODecode(data []byte) (int, error) { func (p *CellInfo) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.UUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) p.UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
...@@ -49,6 +55,8 @@ func (p *CellInfo) NEODecode(data []byte) (int, error) { ...@@ -49,6 +55,8 @@ func (p *CellInfo) NEODecode(data []byte) (int, error) {
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 3. RowInfo
func (p *RowInfo) NEODecode(data []byte) (int, error) { func (p *RowInfo) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Offset = binary.BigEndian.Uint32(data[0:]) p.Offset = binary.BigEndian.Uint32(data[0:])
...@@ -68,6 +76,8 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) { ...@@ -68,6 +76,8 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 4. Notify
func (p *Notify) NEODecode(data []byte) (int, error) { func (p *Notify) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -83,6 +93,8 @@ func (p *Notify) NEODecode(data []byte) (int, error) { ...@@ -83,6 +93,8 @@ func (p *Notify) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 5. Error
func (p *Error) NEODecode(data []byte) (int, error) { func (p *Error) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Code = binary.BigEndian.Uint32(data[0:]) p.Code = binary.BigEndian.Uint32(data[0:])
...@@ -99,16 +111,22 @@ func (p *Error) NEODecode(data []byte) (int, error) { ...@@ -99,16 +111,22 @@ func (p *Error) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 6. Ping
func (p *Ping) NEODecode(data []byte) (int, error) { func (p *Ping) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 7. CloseClient
func (p *CloseClient) NEODecode(data []byte) (int, error) { func (p *CloseClient) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 8. RequestIdentification
func (p *RequestIdentification) NEODecode(data []byte) (int, error) { func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.ProtocolVersion = binary.BigEndian.Uint32(data[0:]) p.ProtocolVersion = binary.BigEndian.Uint32(data[0:])
...@@ -139,6 +157,8 @@ func (p *RequestIdentification) NEODecode(data []byte) (int, error) { ...@@ -139,6 +157,8 @@ func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 9. AcceptIdentification
func (p *AcceptIdentification) NEODecode(data []byte) (int, error) { func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:]))) p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
...@@ -186,32 +206,44 @@ func (p *AcceptIdentification) NEODecode(data []byte) (int, error) { ...@@ -186,32 +206,44 @@ func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 10. PrimaryMaster
func (p *PrimaryMaster) NEODecode(data []byte) (int, error) { func (p *PrimaryMaster) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 11. AnswerPrimary
func (p *AnswerPrimary) NEODecode(data []byte) (int, error) { func (p *AnswerPrimary) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.PrimaryUUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) p.PrimaryUUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
return int(nread) + 4, nil return int(nread) + 4, nil
} }
// 12. AnnouncePrimary
func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) { func (p *AnnouncePrimary) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 13. ReelectPrimary
func (p *ReelectPrimary) NEODecode(data []byte) (int, error) { func (p *ReelectPrimary) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 14. Recovery
func (p *Recovery) NEODecode(data []byte) (int, error) { func (p *Recovery) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 15. AnswerRecovery
func (p *AnswerRecovery) NEODecode(data []byte) (int, error) { func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.PTid = PTid(binary.BigEndian.Uint64(data[0:])) p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
...@@ -220,11 +252,15 @@ func (p *AnswerRecovery) NEODecode(data []byte) (int, error) { ...@@ -220,11 +252,15 @@ func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
return int(nread) + 24, nil return int(nread) + 24, nil
} }
// 16. LastIDs
func (p *LastIDs) NEODecode(data []byte) (int, error) { func (p *LastIDs) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 17. AnswerLastIDs
func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) { func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.LastOID = Oid(binary.BigEndian.Uint64(data[0:])) p.LastOID = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -232,11 +268,15 @@ func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) { ...@@ -232,11 +268,15 @@ func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 18. PartitionTable
func (p *PartitionTable) NEODecode(data []byte) (int, error) { func (p *PartitionTable) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 19. AnswerPartitionTable
func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) { func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.PTid = PTid(binary.BigEndian.Uint64(data[0:])) p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
...@@ -268,6 +308,8 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) { ...@@ -268,6 +308,8 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 20. NotifyPartitionTable
func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) { func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.PTid = PTid(binary.BigEndian.Uint64(data[0:])) p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
...@@ -299,6 +341,8 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) { ...@@ -299,6 +341,8 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 21. PartitionChanges
func (p *PartitionChanges) NEODecode(data []byte) (int, error) { func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.PTid = PTid(binary.BigEndian.Uint64(data[0:])) p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
...@@ -323,22 +367,30 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) { ...@@ -323,22 +367,30 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 22. StartOperation
func (p *StartOperation) NEODecode(data []byte) (int, error) { func (p *StartOperation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Backup = byte2bool((data[0:])[0]) p.Backup = byte2bool((data[0:])[0])
return int(nread) + 1, nil return int(nread) + 1, nil
} }
// 23. StopOperation
func (p *StopOperation) NEODecode(data []byte) (int, error) { func (p *StopOperation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 24. UnfinishedTransactions
func (p *UnfinishedTransactions) NEODecode(data []byte) (int, error) { func (p *UnfinishedTransactions) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 25. AnswerUnfinishedTransactions
func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) { func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.MaxTID = Tid(binary.BigEndian.Uint64(data[0:])) p.MaxTID = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -357,11 +409,15 @@ func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) { ...@@ -357,11 +409,15 @@ func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 26. LockedTransactions
func (p *LockedTransactions) NEODecode(data []byte) (int, error) { func (p *LockedTransactions) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 27. AnswerLockedTransactions
func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) { func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -380,18 +436,24 @@ func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) { ...@@ -380,18 +436,24 @@ func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 28. FinalTID
func (p *FinalTID) NEODecode(data []byte) (int, error) { func (p *FinalTID) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.TTID = Tid(binary.BigEndian.Uint64(data[0:])) p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 29. AnswerFinalTID
func (p *AnswerFinalTID) NEODecode(data []byte) (int, error) { func (p *AnswerFinalTID) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 30. ValidateTransaction
func (p *ValidateTransaction) NEODecode(data []byte) (int, error) { func (p *ValidateTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.TTID = Tid(binary.BigEndian.Uint64(data[0:])) p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -399,18 +461,24 @@ func (p *ValidateTransaction) NEODecode(data []byte) (int, error) { ...@@ -399,18 +461,24 @@ func (p *ValidateTransaction) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 31. BeginTransaction
func (p *BeginTransaction) NEODecode(data []byte) (int, error) { func (p *BeginTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 32. AnswerBeginTransaction
func (p *AnswerBeginTransaction) NEODecode(data []byte) (int, error) { func (p *AnswerBeginTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 33. FinishTransaction
func (p *FinishTransaction) NEODecode(data []byte) (int, error) { func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -441,6 +509,8 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) { ...@@ -441,6 +509,8 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 34. AnswerFinishTransaction
func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) { func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.TTID = Tid(binary.BigEndian.Uint64(data[0:])) p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -448,6 +518,8 @@ func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) { ...@@ -448,6 +518,8 @@ func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 35. NotifyTransactionFinished
func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) { func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.TTID = Tid(binary.BigEndian.Uint64(data[0:])) p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -455,6 +527,8 @@ func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) { ...@@ -455,6 +527,8 @@ func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 36. LockInformation
func (p *LockInformation) NEODecode(data []byte) (int, error) { func (p *LockInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Ttid = Tid(binary.BigEndian.Uint64(data[0:])) p.Ttid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -462,12 +536,16 @@ func (p *LockInformation) NEODecode(data []byte) (int, error) { ...@@ -462,12 +536,16 @@ func (p *LockInformation) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 37. AnswerLockInformation
func (p *AnswerLockInformation) NEODecode(data []byte) (int, error) { func (p *AnswerLockInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Ttid = Tid(binary.BigEndian.Uint64(data[0:])) p.Ttid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 38. InvalidateObjects
func (p *InvalidateObjects) NEODecode(data []byte) (int, error) { func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -486,18 +564,24 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) { ...@@ -486,18 +564,24 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 39. UnlockInformation
func (p *UnlockInformation) NEODecode(data []byte) (int, error) { func (p *UnlockInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.TTID = Tid(binary.BigEndian.Uint64(data[0:])) p.TTID = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 40. GenerateOIDs
func (p *GenerateOIDs) NEODecode(data []byte) (int, error) { func (p *GenerateOIDs) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.NumOIDs = binary.BigEndian.Uint32(data[0:]) p.NumOIDs = binary.BigEndian.Uint32(data[0:])
return int(nread) + 4, nil return int(nread) + 4, nil
} }
// 41. AnswerGenerateOIDs
func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) { func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -515,6 +599,8 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) { ...@@ -515,6 +599,8 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 42. StoreObject
func (p *StoreObject) NEODecode(data []byte) (int, error) { func (p *StoreObject) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Oid = Oid(binary.BigEndian.Uint64(data[0:])) p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -558,6 +644,8 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) { ...@@ -558,6 +644,8 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) {
return int(nread) + 17, nil return int(nread) + 17, nil
} }
// 43. AnswerStoreObject
func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) { func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Conflicting = byte2bool((data[0:])[0]) p.Conflicting = byte2bool((data[0:])[0])
...@@ -566,12 +654,16 @@ func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) { ...@@ -566,12 +654,16 @@ func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) {
return int(nread) + 17, nil return int(nread) + 17, nil
} }
// 44. AbortTransaction
func (p *AbortTransaction) NEODecode(data []byte) (int, error) { func (p *AbortTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 45. StoreTransaction
func (p *StoreTransaction) NEODecode(data []byte) (int, error) { func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -620,12 +712,16 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) { ...@@ -620,12 +712,16 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 46. VoteTransaction
func (p *VoteTransaction) NEODecode(data []byte) (int, error) { func (p *VoteTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 47. GetObject
func (p *GetObject) NEODecode(data []byte) (int, error) { func (p *GetObject) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Oid = Oid(binary.BigEndian.Uint64(data[0:])) p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -634,6 +730,8 @@ func (p *GetObject) NEODecode(data []byte) (int, error) { ...@@ -634,6 +730,8 @@ func (p *GetObject) NEODecode(data []byte) (int, error) {
return int(nread) + 24, nil return int(nread) + 24, nil
} }
// 48. AnswerGetObject
func (p *AnswerGetObject) NEODecode(data []byte) (int, error) { func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Oid = Oid(binary.BigEndian.Uint64(data[0:])) p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -676,6 +774,8 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) { ...@@ -676,6 +774,8 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 49. TIDList
func (p *TIDList) NEODecode(data []byte) (int, error) { func (p *TIDList) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.First = binary.BigEndian.Uint64(data[0:]) p.First = binary.BigEndian.Uint64(data[0:])
...@@ -684,6 +784,8 @@ func (p *TIDList) NEODecode(data []byte) (int, error) { ...@@ -684,6 +784,8 @@ func (p *TIDList) NEODecode(data []byte) (int, error) {
return int(nread) + 20, nil return int(nread) + 20, nil
} }
// 50. AnswerTIDList
func (p *AnswerTIDList) NEODecode(data []byte) (int, error) { func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -701,6 +803,8 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) { ...@@ -701,6 +803,8 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 51. TIDListFrom
func (p *TIDListFrom) NEODecode(data []byte) (int, error) { func (p *TIDListFrom) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.MinTID = Tid(binary.BigEndian.Uint64(data[0:])) p.MinTID = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -710,6 +814,8 @@ func (p *TIDListFrom) NEODecode(data []byte) (int, error) { ...@@ -710,6 +814,8 @@ func (p *TIDListFrom) NEODecode(data []byte) (int, error) {
return int(nread) + 24, nil return int(nread) + 24, nil
} }
// 52. AnswerTIDListFrom
func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) { func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -727,12 +833,16 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) { ...@@ -727,12 +833,16 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 53. TransactionInformation
func (p *TransactionInformation) NEODecode(data []byte) (int, error) { func (p *TransactionInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 54. AnswerTransactionInformation
func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) { func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -782,6 +892,8 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) { ...@@ -782,6 +892,8 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 55. ObjectHistory
func (p *ObjectHistory) NEODecode(data []byte) (int, error) { func (p *ObjectHistory) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Oid = Oid(binary.BigEndian.Uint64(data[0:])) p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -790,6 +902,8 @@ func (p *ObjectHistory) NEODecode(data []byte) (int, error) { ...@@ -790,6 +902,8 @@ func (p *ObjectHistory) NEODecode(data []byte) (int, error) {
return int(nread) + 24, nil return int(nread) + 24, nil
} }
// 56. AnswerObjectHistory
func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) { func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Oid = Oid(binary.BigEndian.Uint64(data[0:])) p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -812,6 +926,8 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) { ...@@ -812,6 +926,8 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 57. PartitionList
func (p *PartitionList) NEODecode(data []byte) (int, error) { func (p *PartitionList) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.MinOffset = binary.BigEndian.Uint32(data[0:]) p.MinOffset = binary.BigEndian.Uint32(data[0:])
...@@ -820,6 +936,8 @@ func (p *PartitionList) NEODecode(data []byte) (int, error) { ...@@ -820,6 +936,8 @@ func (p *PartitionList) NEODecode(data []byte) (int, error) {
return int(nread) + 12, nil return int(nread) + 12, nil
} }
// 58. AnswerPartitionList
func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) { func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.PTid = PTid(binary.BigEndian.Uint64(data[0:])) p.PTid = PTid(binary.BigEndian.Uint64(data[0:]))
...@@ -851,12 +969,16 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) { ...@@ -851,12 +969,16 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 59. X_NodeList
func (p *X_NodeList) NEODecode(data []byte) (int, error) { func (p *X_NodeList) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:]))) p.NodeType = NodeType(int32(binary.BigEndian.Uint32(data[0:])))
return int(nread) + 4, nil return int(nread) + 4, nil
} }
// 60. AnswerNodeList
func (p *AnswerNodeList) NEODecode(data []byte) (int, error) { func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -888,6 +1010,8 @@ func (p *AnswerNodeList) NEODecode(data []byte) (int, error) { ...@@ -888,6 +1010,8 @@ func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 61. SetNodeState
func (p *SetNodeState) NEODecode(data []byte) (int, error) { func (p *SetNodeState) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.UUID = UUID(int32(binary.BigEndian.Uint32(data[0:]))) p.UUID = UUID(int32(binary.BigEndian.Uint32(data[0:])))
...@@ -895,6 +1019,8 @@ func (p *SetNodeState) NEODecode(data []byte) (int, error) { ...@@ -895,6 +1019,8 @@ func (p *SetNodeState) NEODecode(data []byte) (int, error) {
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 62. AddPendingNodes
func (p *AddPendingNodes) NEODecode(data []byte) (int, error) { func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -912,6 +1038,8 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) { ...@@ -912,6 +1038,8 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 63. TweakPartitionTable
func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) { func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -929,6 +1057,8 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) { ...@@ -929,6 +1057,8 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 64. NotifyNodeInformation
func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) { func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -960,29 +1090,39 @@ func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) { ...@@ -960,29 +1090,39 @@ func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 65. NodeInformation
func (p *NodeInformation) NEODecode(data []byte) (int, error) { func (p *NodeInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 66. SetClusterState
func (p *SetClusterState) NEODecode(data []byte) (int, error) { func (p *SetClusterState) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:]))) p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:])))
return int(nread) + 4, nil return int(nread) + 4, nil
} }
// 67. ClusterInformation
func (p *ClusterInformation) NEODecode(data []byte) (int, error) { func (p *ClusterInformation) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:]))) p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:])))
return int(nread) + 4, nil return int(nread) + 4, nil
} }
// 68. X_ClusterState
func (p *X_ClusterState) NEODecode(data []byte) (int, error) { func (p *X_ClusterState) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:]))) p.State = ClusterState(int32(binary.BigEndian.Uint32(data[0:])))
return int(nread) + 4, nil return int(nread) + 4, nil
} }
// 69. ObjectUndoSerial
func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) { func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -1003,6 +1143,8 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) { ...@@ -1003,6 +1143,8 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 70. AnswerObjectUndoSerial
func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) { func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -1033,6 +1175,8 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) { ...@@ -1033,6 +1175,8 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 71. HasLock
func (p *HasLock) NEODecode(data []byte) (int, error) { func (p *HasLock) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -1040,6 +1184,8 @@ func (p *HasLock) NEODecode(data []byte) (int, error) { ...@@ -1040,6 +1184,8 @@ func (p *HasLock) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 72. AnswerHasLock
func (p *AnswerHasLock) NEODecode(data []byte) (int, error) { func (p *AnswerHasLock) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Oid = Oid(binary.BigEndian.Uint64(data[0:])) p.Oid = Oid(binary.BigEndian.Uint64(data[0:]))
...@@ -1047,6 +1193,8 @@ func (p *AnswerHasLock) NEODecode(data []byte) (int, error) { ...@@ -1047,6 +1193,8 @@ func (p *AnswerHasLock) NEODecode(data []byte) (int, error) {
return int(nread) + 12, nil return int(nread) + 12, nil
} }
// 73. CheckCurrentSerial
func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) { func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
...@@ -1055,6 +1203,8 @@ func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) { ...@@ -1055,6 +1203,8 @@ func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) {
return int(nread) + 24, nil return int(nread) + 24, nil
} }
// 74. AnswerCheckCurrentSerial
func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) { func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Conflicting = byte2bool((data[0:])[0]) p.Conflicting = byte2bool((data[0:])[0])
...@@ -1063,18 +1213,24 @@ func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) { ...@@ -1063,18 +1213,24 @@ func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) {
return int(nread) + 17, nil return int(nread) + 17, nil
} }
// 75. Pack
func (p *Pack) NEODecode(data []byte) (int, error) { func (p *Pack) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 76. AnswerPack
func (p *AnswerPack) NEODecode(data []byte) (int, error) { func (p *AnswerPack) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Status = byte2bool((data[0:])[0]) p.Status = byte2bool((data[0:])[0])
return int(nread) + 1, nil return int(nread) + 1, nil
} }
// 77. CheckReplicas
func (p *CheckReplicas) NEODecode(data []byte) (int, error) { func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
{ {
...@@ -1095,6 +1251,8 @@ func (p *CheckReplicas) NEODecode(data []byte) (int, error) { ...@@ -1095,6 +1251,8 @@ func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
return int(nread) + 16, nil return int(nread) + 16, nil
} }
// 78. CheckPartition
func (p *CheckPartition) NEODecode(data []byte) (int, error) { func (p *CheckPartition) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Partition = binary.BigEndian.Uint32(data[0:]) p.Partition = binary.BigEndian.Uint32(data[0:])
...@@ -1124,6 +1282,8 @@ func (p *CheckPartition) NEODecode(data []byte) (int, error) { ...@@ -1124,6 +1282,8 @@ func (p *CheckPartition) NEODecode(data []byte) (int, error) {
return int(nread) + 18, nil return int(nread) + 18, nil
} }
// 79. CheckTIDRange
func (p *CheckTIDRange) NEODecode(data []byte) (int, error) { func (p *CheckTIDRange) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Partition = binary.BigEndian.Uint32(data[0:]) p.Partition = binary.BigEndian.Uint32(data[0:])
...@@ -1133,6 +1293,8 @@ func (p *CheckTIDRange) NEODecode(data []byte) (int, error) { ...@@ -1133,6 +1293,8 @@ func (p *CheckTIDRange) NEODecode(data []byte) (int, error) {
return int(nread) + 24, nil return int(nread) + 24, nil
} }
// 80. AnswerCheckTIDRange
func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) { func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Count = binary.BigEndian.Uint32(data[0:]) p.Count = binary.BigEndian.Uint32(data[0:])
...@@ -1160,6 +1322,8 @@ func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) { ...@@ -1160,6 +1322,8 @@ func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) {
return int(nread) + 32, nil return int(nread) + 32, nil
} }
// 81. CheckSerialRange
func (p *CheckSerialRange) NEODecode(data []byte) (int, error) { func (p *CheckSerialRange) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Partition = binary.BigEndian.Uint32(data[0:]) p.Partition = binary.BigEndian.Uint32(data[0:])
...@@ -1170,6 +1334,8 @@ func (p *CheckSerialRange) NEODecode(data []byte) (int, error) { ...@@ -1170,6 +1334,8 @@ func (p *CheckSerialRange) NEODecode(data []byte) (int, error) {
return int(nread) + 32, nil return int(nread) + 32, nil
} }
// 82. AnswerCheckSerialRange
func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) { func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Count = binary.BigEndian.Uint32(data[0:]) p.Count = binary.BigEndian.Uint32(data[0:])
...@@ -1218,6 +1384,8 @@ func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) { ...@@ -1218,6 +1384,8 @@ func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
return int(nread) + 60, nil return int(nread) + 60, nil
} }
// 83. PartitionCorrupted
func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) { func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Partition = binary.BigEndian.Uint32(data[0:]) p.Partition = binary.BigEndian.Uint32(data[0:])
...@@ -1236,17 +1404,23 @@ func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) { ...@@ -1236,17 +1404,23 @@ func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 84. LastTransaction
func (p *LastTransaction) NEODecode(data []byte) (int, error) { func (p *LastTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
} }
// 85. AnswerLastTransaction
func (p *AnswerLastTransaction) NEODecode(data []byte) (int, error) { func (p *AnswerLastTransaction) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
p.Tid = Tid(binary.BigEndian.Uint64(data[0:])) p.Tid = Tid(binary.BigEndian.Uint64(data[0:]))
return int(nread) + 8, nil return int(nread) + 8, nil
} }
// 86. NotifyReady
func (p *NotifyReady) NEODecode(data []byte) (int, error) { func (p *NotifyReady) NEODecode(data []byte) (int, error) {
var nread uint32 var nread uint32
return int(nread) + 0, nil return int(nread) + 0, nil
......
...@@ -55,16 +55,18 @@ func main() { ...@@ -55,16 +55,18 @@ func main() {
log.SetFlags(0) log.SetFlags(0)
// go through proto.go and collect packets type definitions // go through proto.go and collect packets type definitions
var mode parser.Mode = 0 // parser.Trace
var fv []*ast.File var fv []*ast.File
for _, src := range []string{"proto.go", "neo.go"} { for _, src := range []string{"proto.go", "neo.go"} {
f, err := parser.ParseFile(fset, src, nil, mode) f, err := parser.ParseFile(fset, src, nil, 0)
if err != nil { if err != nil {
log.Fatalf("parse: %v", err) log.Fatalf("parse: %v", err)
} }
fv = append(fv, f) fv = append(fv, f)
} }
//ast.Print(fset, fv[0])
//return
conf := types.Config{Importer: importer.Default()} conf := types.Config{Importer: importer.Default()}
neoPkg, err := conf.Check("neo", fset, fv, info) neoPkg, err := conf.Check("neo", fset, fv, info)
if err != nil { if err != nil {
...@@ -73,11 +75,6 @@ func main() { ...@@ -73,11 +75,6 @@ func main() {
neoQualifier = types.RelativeTo(neoPkg) neoQualifier = types.RelativeTo(neoPkg)
//ncode := 0
//ast.Print(fset, f)
//return
// prologue // prologue
f := fv[0] // proto.go comes first f := fv[0] // proto.go comes first
buf := bytes.Buffer{} buf := bytes.Buffer{}
...@@ -90,6 +87,7 @@ import ( ...@@ -90,6 +87,7 @@ import (
`) `)
// go over packet types declaration and generate marshal code for them // go over packet types declaration and generate marshal code for them
pktCode := 0
for _, decl := range f.Decls { for _, decl := range f.Decls {
// we look for types (which can be only under GenDecl) // we look for types (which can be only under GenDecl)
gendecl, ok := decl.(*ast.GenDecl) gendecl, ok := decl.(*ast.GenDecl)
...@@ -99,7 +97,7 @@ import ( ...@@ -99,7 +97,7 @@ import (
for _, spec := range gendecl.Specs { for _, spec := range gendecl.Specs {
typespec := spec.(*ast.TypeSpec) // must be because tok = TYPE typespec := spec.(*ast.TypeSpec) // must be because tok = TYPE
//typename := typespec.Name.Name typename := typespec.Name.Name
switch typespec.Type.(type) { switch typespec.Type.(type) {
default: default:
...@@ -112,8 +110,12 @@ import ( ...@@ -112,8 +110,12 @@ import (
//fmt.Println(t) //fmt.Println(t)
//ast.Print(fset, t) //ast.Print(fset, t)
fmt.Fprintf(&buf, "// %d. %s\n\n", pktCode, typename)
buf.WriteString(gendecode(typespec)) buf.WriteString(gendecode(typespec))
buf.WriteString("\n") buf.WriteString("\n")
pktCode++
} }
} }
......
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