Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
653a4785
Commit
653a4785
authored
Jan 19, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c1eed395
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
184 additions
and
8 deletions
+184
-8
t/neo/marshal.go
t/neo/marshal.go
+174
-0
t/neo/protogen.go
t/neo/protogen.go
+10
-8
No files found.
t/neo/marshal.go
View file @
653a4785
...
...
@@ -6,6 +6,8 @@ import (
"encoding/binary"
)
// 0. Address
func
(
p
*
Address
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -22,6 +24,8 @@ func (p *Address) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
2
,
nil
}
// 1. NodeInfo
func
(
p
*
NodeInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
...
@@ -42,6 +46,8 @@ func (p *NodeInfo) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
18
,
nil
}
// 2. CellInfo
func
(
p
*
CellInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
...
@@ -49,6 +55,8 @@ func (p *CellInfo) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
8
,
nil
}
// 3. RowInfo
func
(
p
*
RowInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -68,6 +76,8 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 4. Notify
func
(
p
*
Notify
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -83,6 +93,8 @@ func (p *Notify) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 5. Error
func
(
p
*
Error
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Code
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -99,16 +111,22 @@ func (p *Error) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 6. Ping
func
(
p
*
Ping
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 7. CloseClient
func
(
p
*
CloseClient
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 8. RequestIdentification
func
(
p
*
RequestIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
ProtocolVersion
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -139,6 +157,8 @@ func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
8
,
nil
}
// 9. AcceptIdentification
func
(
p
*
AcceptIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
...
@@ -186,32 +206,44 @@ func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 10. PrimaryMaster
func
(
p
*
PrimaryMaster
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 11. AnswerPrimary
func
(
p
*
AnswerPrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
PrimaryUUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
return
int
(
nread
)
+
4
,
nil
}
// 12. AnnouncePrimary
func
(
p
*
AnnouncePrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 13. ReelectPrimary
func
(
p
*
ReelectPrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 14. Recovery
func
(
p
*
Recovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 15. AnswerRecovery
func
(
p
*
AnswerRecovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -220,11 +252,15 @@ func (p *AnswerRecovery) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
24
,
nil
}
// 16. LastIDs
func
(
p
*
LastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 17. AnswerLastIDs
func
(
p
*
AnswerLastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
LastOID
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -232,11 +268,15 @@ func (p *AnswerLastIDs) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 18. PartitionTable
func
(
p
*
PartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 19. AnswerPartitionTable
func
(
p
*
AnswerPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -268,6 +308,8 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 20. NotifyPartitionTable
func
(
p
*
NotifyPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -299,6 +341,8 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 21. PartitionChanges
func
(
p
*
PartitionChanges
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -323,22 +367,30 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 22. StartOperation
func
(
p
*
StartOperation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Backup
=
byte2bool
((
data
[
0
:
])[
0
])
return
int
(
nread
)
+
1
,
nil
}
// 23. StopOperation
func
(
p
*
StopOperation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 24. UnfinishedTransactions
func
(
p
*
UnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 25. AnswerUnfinishedTransactions
func
(
p
*
AnswerUnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
MaxTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -357,11 +409,15 @@ func (p *AnswerUnfinishedTransactions) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 26. LockedTransactions
func
(
p
*
LockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 27. AnswerLockedTransactions
func
(
p
*
AnswerLockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -380,18 +436,24 @@ func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 28. FinalTID
func
(
p
*
FinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 29. AnswerFinalTID
func
(
p
*
AnswerFinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 30. ValidateTransaction
func
(
p
*
ValidateTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -399,18 +461,24 @@ func (p *ValidateTransaction) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 31. BeginTransaction
func
(
p
*
BeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 32. AnswerBeginTransaction
func
(
p
*
AnswerBeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 33. FinishTransaction
func
(
p
*
FinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -441,6 +509,8 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 34. AnswerFinishTransaction
func
(
p
*
AnswerFinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -448,6 +518,8 @@ func (p *AnswerFinishTransaction) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 35. NotifyTransactionFinished
func
(
p
*
NotifyTransactionFinished
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -455,6 +527,8 @@ func (p *NotifyTransactionFinished) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 36. LockInformation
func
(
p
*
LockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Ttid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -462,12 +536,16 @@ func (p *LockInformation) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 37. AnswerLockInformation
func
(
p
*
AnswerLockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Ttid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 38. InvalidateObjects
func
(
p
*
InvalidateObjects
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -486,18 +564,24 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 39. UnlockInformation
func
(
p
*
UnlockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
TTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 40. GenerateOIDs
func
(
p
*
GenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
NumOIDs
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
return
int
(
nread
)
+
4
,
nil
}
// 41. AnswerGenerateOIDs
func
(
p
*
AnswerGenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -515,6 +599,8 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 42. StoreObject
func
(
p
*
StoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -558,6 +644,8 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
17
,
nil
}
// 43. AnswerStoreObject
func
(
p
*
AnswerStoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Conflicting
=
byte2bool
((
data
[
0
:
])[
0
])
...
...
@@ -566,12 +654,16 @@ func (p *AnswerStoreObject) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
17
,
nil
}
// 44. AbortTransaction
func
(
p
*
AbortTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 45. StoreTransaction
func
(
p
*
StoreTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -620,12 +712,16 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 46. VoteTransaction
func
(
p
*
VoteTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 47. GetObject
func
(
p
*
GetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -634,6 +730,8 @@ func (p *GetObject) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
24
,
nil
}
// 48. AnswerGetObject
func
(
p
*
AnswerGetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -676,6 +774,8 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
8
,
nil
}
// 49. TIDList
func
(
p
*
TIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
...
...
@@ -684,6 +784,8 @@ func (p *TIDList) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
20
,
nil
}
// 50. AnswerTIDList
func
(
p
*
AnswerTIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -701,6 +803,8 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 51. TIDListFrom
func
(
p
*
TIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
MinTID
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -710,6 +814,8 @@ func (p *TIDListFrom) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
24
,
nil
}
// 52. AnswerTIDListFrom
func
(
p
*
AnswerTIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -727,12 +833,16 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 53. TransactionInformation
func
(
p
*
TransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 54. AnswerTransactionInformation
func
(
p
*
AnswerTransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -782,6 +892,8 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 55. ObjectHistory
func
(
p
*
ObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -790,6 +902,8 @@ func (p *ObjectHistory) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
24
,
nil
}
// 56. AnswerObjectHistory
func
(
p
*
AnswerObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -812,6 +926,8 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 57. PartitionList
func
(
p
*
PartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
MinOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -820,6 +936,8 @@ func (p *PartitionList) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
12
,
nil
}
// 58. AnswerPartitionList
func
(
p
*
AnswerPartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
PTid
=
PTid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -851,12 +969,16 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 59. X_NodeList
func
(
p
*
X_NodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
NodeType
=
NodeType
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
return
int
(
nread
)
+
4
,
nil
}
// 60. AnswerNodeList
func
(
p
*
AnswerNodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -888,6 +1010,8 @@ func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 61. SetNodeState
func
(
p
*
SetNodeState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
UUID
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
...
...
@@ -895,6 +1019,8 @@ func (p *SetNodeState) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
8
,
nil
}
// 62. AddPendingNodes
func
(
p
*
AddPendingNodes
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -912,6 +1038,8 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 63. TweakPartitionTable
func
(
p
*
TweakPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -929,6 +1057,8 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 64. NotifyNodeInformation
func
(
p
*
NotifyNodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -960,29 +1090,39 @@ func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 65. NodeInformation
func
(
p
*
NodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 66. SetClusterState
func
(
p
*
SetClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
return
int
(
nread
)
+
4
,
nil
}
// 67. ClusterInformation
func
(
p
*
ClusterInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
return
int
(
nread
)
+
4
,
nil
}
// 68. X_ClusterState
func
(
p
*
X_ClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
State
=
ClusterState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
return
int
(
nread
)
+
4
,
nil
}
// 69. ObjectUndoSerial
func
(
p
*
ObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -1003,6 +1143,8 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 70. AnswerObjectUndoSerial
func
(
p
*
AnswerObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -1033,6 +1175,8 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 71. HasLock
func
(
p
*
HasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -1040,6 +1184,8 @@ func (p *HasLock) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 72. AnswerHasLock
func
(
p
*
AnswerHasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Oid
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -1047,6 +1193,8 @@ func (p *AnswerHasLock) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
12
,
nil
}
// 73. CheckCurrentSerial
func
(
p
*
CheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
...
...
@@ -1055,6 +1203,8 @@ func (p *CheckCurrentSerial) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
24
,
nil
}
// 74. AnswerCheckCurrentSerial
func
(
p
*
AnswerCheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Conflicting
=
byte2bool
((
data
[
0
:
])[
0
])
...
...
@@ -1063,18 +1213,24 @@ func (p *AnswerCheckCurrentSerial) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
17
,
nil
}
// 75. Pack
func
(
p
*
Pack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 76. AnswerPack
func
(
p
*
AnswerPack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Status
=
byte2bool
((
data
[
0
:
])[
0
])
return
int
(
nread
)
+
1
,
nil
}
// 77. CheckReplicas
func
(
p
*
CheckReplicas
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
{
...
...
@@ -1095,6 +1251,8 @@ func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
16
,
nil
}
// 78. CheckPartition
func
(
p
*
CheckPartition
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -1124,6 +1282,8 @@ func (p *CheckPartition) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
18
,
nil
}
// 79. CheckTIDRange
func
(
p
*
CheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -1133,6 +1293,8 @@ func (p *CheckTIDRange) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
24
,
nil
}
// 80. AnswerCheckTIDRange
func
(
p
*
AnswerCheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -1160,6 +1322,8 @@ func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
32
,
nil
}
// 81. CheckSerialRange
func
(
p
*
CheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -1170,6 +1334,8 @@ func (p *CheckSerialRange) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
32
,
nil
}
// 82. AnswerCheckSerialRange
func
(
p
*
AnswerCheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -1218,6 +1384,8 @@ func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
60
,
nil
}
// 83. PartitionCorrupted
func
(
p
*
PartitionCorrupted
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
...
...
@@ -1236,17 +1404,23 @@ func (p *PartitionCorrupted) NEODecode(data []byte) (int, error) {
return
int
(
nread
)
+
0
,
nil
}
// 84. LastTransaction
func
(
p
*
LastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
}
// 85. AnswerLastTransaction
func
(
p
*
AnswerLastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
p
.
Tid
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
int
(
nread
)
+
8
,
nil
}
// 86. NotifyReady
func
(
p
*
NotifyReady
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
return
int
(
nread
)
+
0
,
nil
...
...
t/neo/protogen.go
View file @
653a4785
...
...
@@ -55,16 +55,18 @@ func main() {
log
.
SetFlags
(
0
)
// go through proto.go and collect packets type definitions
var
mode
parser
.
Mode
=
0
// parser.Trace
var
fv
[]
*
ast
.
File
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
{
log
.
Fatalf
(
"parse: %v"
,
err
)
}
fv
=
append
(
fv
,
f
)
}
//ast.Print(fset, fv[0])
//return
conf
:=
types
.
Config
{
Importer
:
importer
.
Default
()}
neoPkg
,
err
:=
conf
.
Check
(
"neo"
,
fset
,
fv
,
info
)
if
err
!=
nil
{
...
...
@@ -73,11 +75,6 @@ func main() {
neoQualifier
=
types
.
RelativeTo
(
neoPkg
)
//ncode := 0
//ast.Print(fset, f)
//return
// prologue
f
:=
fv
[
0
]
// proto.go comes first
buf
:=
bytes
.
Buffer
{}
...
...
@@ -90,6 +87,7 @@ import (
`
)
// go over packet types declaration and generate marshal code for them
pktCode
:=
0
for
_
,
decl
:=
range
f
.
Decls
{
// we look for types (which can be only under GenDecl)
gendecl
,
ok
:=
decl
.
(
*
ast
.
GenDecl
)
...
...
@@ -99,7 +97,7 @@ import (
for
_
,
spec
:=
range
gendecl
.
Specs
{
typespec
:=
spec
.
(
*
ast
.
TypeSpec
)
// must be because tok = TYPE
//
typename := typespec.Name.Name
typename
:=
typespec
.
Name
.
Name
switch
typespec
.
Type
.
(
type
)
{
default
:
...
...
@@ -112,8 +110,12 @@ import (
//fmt.Println(t)
//ast.Print(fset, t)
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pktCode
,
typename
)
buf
.
WriteString
(
gendecode
(
typespec
))
buf
.
WriteString
(
"
\n
"
)
pktCode
++
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment