Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
39ab6e94
Commit
39ab6e94
authored
Dec 28, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
77f2d94f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
241 additions
and
222 deletions
+241
-222
t/neo/marshal.go
t/neo/marshal.go
+220
-214
t/neo/pkt.go
t/neo/pkt.go
+7
-0
t/neo/proto.go
t/neo/proto.go
+1
-1
t/neo/protogen.go
t/neo/protogen.go
+13
-7
No files found.
t/neo/marshal.go
View file @
39ab6e94
// DO NOT EDIT - AUTOGENERATED (by protogen.go)
package
neo
import
(
"encoding/binary"
)
func
(
p
*
Address
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -10,14 +16,14 @@ func (p *Address) NEODecode(data []byte) (int, error) {
p
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
return
2
/* + TODO variable part */
,
nil
}
func
(
p
*
NodeInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
NodeType
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -25,29 +31,29 @@ func (p *NodeInfo) NEODecode(data []byte) (int, error) {
p
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
2
:
]))
p
.
NodeState
=
int32
(
BigEndian
.
Uint32
(
data
[
6
:
]))
p
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
]))
p
.
NodeState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
]))
p
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
return
18
/* + TODO variable part */
,
nil
}
func
(
p
*
CellInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
CellState
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
CellState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
RowInfo
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Offset
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
p
.
CellList
=
make
([]
neo
.
CellInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
data
=
data
[
8
:
]
}
}
...
...
@@ -56,7 +62,7 @@ func (p *RowInfo) NEODecode(data []byte) (int, error) {
func
(
p
*
Notify
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -68,9 +74,9 @@ func (p *Notify) NEODecode(data []byte) (int, error) {
}
func
(
p
*
Error
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Code
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Code
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -90,11 +96,11 @@ func (p *CloseClient) NEODecode(data []byte) (int, error) {
}
func
(
p
*
RequestIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
ProtocolVersion
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
8
:
]))
p
.
ProtocolVersion
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
NodeType
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
12
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
12
:
])
data
=
data
[
16
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -102,9 +108,9 @@ func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
p
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
2
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])
data
=
data
[
6
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -117,13 +123,13 @@ func (p *RequestIdentification) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AcceptIdentification
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
MyUUID
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
NumPartitions
=
BigEndian
.
Uint32
(
data
[
8
:
])
p
.
NumReplicas
=
BigEndian
.
Uint32
(
data
[
12
:
])
p
.
YourUUID
=
int32
(
BigEndian
.
Uint32
(
data
[
16
:
]))
p
.
NodeType
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
MyUUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
NumPartitions
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
p
.
NumReplicas
=
binary
.
BigEndian
.
Uint32
(
data
[
12
:
])
p
.
YourUUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
16
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
20
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
data
=
data
[
24
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -131,9 +137,9 @@ func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
p
.
Primary
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Primary
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
Primary
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
2
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
2
:
])
data
=
data
[
6
:
]
p
.
KnownMasterList
=
make
([]
struct
{
neo
.
Address
...
...
@@ -142,7 +148,7 @@ func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -150,8 +156,8 @@ func (p *AcceptIdentification) NEODecode(data []byte) (int, error) {
a
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
a
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
2
:
]))
a
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
]))
data
=
data
[
6
:
]
}
}
...
...
@@ -163,7 +169,7 @@ func (p *PrimaryMaster) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerPrimary
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
PrimaryUUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
PrimaryUUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
return
4
/* + TODO variable part */
,
nil
}
...
...
@@ -180,9 +186,9 @@ func (p *Recovery) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerRecovery
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
PTid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
BackupTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
TruncateTID
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
PTid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
BackupTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
TruncateTID
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
return
24
/* + TODO variable part */
,
nil
}
...
...
@@ -191,8 +197,8 @@ func (p *LastIDs) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerLastIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
LastOID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
LastTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
LastOID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
LastTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
...
...
@@ -201,22 +207,22 @@ func (p *PartitionTable) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
PTid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
PTid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
RowList
=
make
([]
neo
.
RowInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
.
Offset
=
BigEndian
.
Uint32
(
data
[
0
:
])
a
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
a
.
CellList
=
make
([]
neo
.
CellInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
a
.
CellList
[
i
]
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
data
=
data
[
8
:
]
}
}
...
...
@@ -227,22 +233,22 @@ func (p *AnswerPartitionTable) NEODecode(data []byte) (int, error) {
}
func
(
p
*
NotifyPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
PTid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
PTid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
RowList
=
make
([]
neo
.
RowInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
.
Offset
=
BigEndian
.
Uint32
(
data
[
0
:
])
a
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
a
.
CellList
=
make
([]
neo
.
CellInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
a
.
CellList
[
i
]
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
data
=
data
[
8
:
]
}
}
...
...
@@ -253,9 +259,9 @@ func (p *NotifyPartitionTable) NEODecode(data []byte) (int, error) {
}
func
(
p
*
PartitionChanges
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
PTid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
PTid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
CellList
=
make
([]
struct
{
Offset
uint32
...
...
@@ -264,9 +270,9 @@ func (p *PartitionChanges) NEODecode(data []byte) (int, error) {
},
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
.
Offset
=
BigEndian
.
Uint32
(
data
[
0
:
])
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
a
.
CellState
=
int32
(
BigEndian
.
Uint32
(
data
[
8
:
]))
a
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
a
.
CellState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
]))
data
=
data
[
12
:
]
}
}
...
...
@@ -287,14 +293,14 @@ func (p *UnfinishedTransactions) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
TidList
=
make
([]
struct
{
UnfinishedTID
neo
.
Tid
},
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
a
.
UnfinishedTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
.
UnfinishedTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -307,13 +313,13 @@ func (p *LockedTransactions) NEODecode(data []byte) (int, error) {
func
(
p
*
AnswerLockedTransactions
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
TidDict
=
make
(
map
[
neo
.
Tid
]
neo
.
Tid
,
l
)
m
:=
p
.
TidDict
for
i
:=
0
;
i
<
l
;
i
++
{
key
=
BigEndian
.
Uint64
(
data
[
0
:
])
m
[
key
]
=
BigEndian
.
Uint64
(
data
[
8
:
])
key
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
m
[
key
]
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
data
=
data
[
16
:
]
}
}
...
...
@@ -321,50 +327,50 @@ func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
}
func
(
p
*
FinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
TTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
TTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerFinalTID
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
ValidateTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
TTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
TTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
func
(
p
*
BeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerBeginTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
FinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
OIDList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
OIDList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
CheckedList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
CheckedList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -372,37 +378,37 @@ func (p *FinishTransaction) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerFinishTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
TTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
TTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
func
(
p
*
NotifyTransactionFinished
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
TTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
TTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
func
(
p
*
LockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Ttid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Ttid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerLockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Ttid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Ttid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
InvalidateObjects
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
OidList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -410,23 +416,23 @@ func (p *InvalidateObjects) NEODecode(data []byte) (int, error) {
}
func
(
p
*
UnlockInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
TTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
TTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
GenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
NumOIDs
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
NumOIDs
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
return
4
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerGenerateOIDs
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
OidList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -434,8 +440,8 @@ func (p *AnswerGenerateOIDs) NEODecode(data []byte) (int, error) {
}
func
(
p
*
StoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Serial
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Serial
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Compression
=
bool
((
data
[
16
:
])[
0
])
p
.
Checksum
[
0
]
=
(
data
[
17
:
])[
0
]
p
.
Checksum
[
1
]
=
(
data
[
18
:
])[
0
]
...
...
@@ -458,7 +464,7 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) {
p
.
Checksum
[
18
]
=
(
data
[
35
:
])[
0
]
p
.
Checksum
[
19
]
=
(
data
[
36
:
])[
0
]
{
l
:=
BigEndian
.
Uint32
(
data
[
37
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
37
:
])
data
=
data
[
41
:
]
p
.
Data
=
make
([]
byte
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
...
...
@@ -467,28 +473,28 @@ func (p *StoreObject) NEODecode(data []byte) (int, error) {
data
=
data
[
1
:
]
}
}
p
.
DataSerial
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
DataSerial
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Unlock
=
bool
((
data
[
16
:
])[
0
])
return
17
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerStoreObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Conflicting
=
bool
((
data
[
0
:
])[
0
])
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
1
:
])
p
.
Serial
=
BigEndian
.
Uint64
(
data
[
9
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
1
:
])
p
.
Serial
=
binary
.
BigEndian
.
Uint64
(
data
[
9
:
])
return
17
/* + TODO variable part */
,
nil
}
func
(
p
*
AbortTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
StoreTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -497,7 +503,7 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -506,7 +512,7 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -515,12 +521,12 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
OidList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -528,21 +534,21 @@ func (p *StoreTransaction) NEODecode(data []byte) (int, error) {
}
func
(
p
*
VoteTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
GetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Serial
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Serial
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
return
24
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerGetObject
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
SerialStart
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
SerialEnd
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
SerialStart
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
SerialEnd
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Compression
=
bool
((
data
[
24
:
])[
0
])
p
.
Checksum
[
0
]
=
(
data
[
25
:
])[
0
]
p
.
Checksum
[
1
]
=
(
data
[
26
:
])[
0
]
...
...
@@ -565,7 +571,7 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
p
.
Checksum
[
18
]
=
(
data
[
43
:
])[
0
]
p
.
Checksum
[
19
]
=
(
data
[
44
:
])[
0
]
{
l
:=
BigEndian
.
Uint32
(
data
[
45
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
45
:
])
data
=
data
[
49
:
]
p
.
Data
=
make
([]
byte
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
...
...
@@ -574,25 +580,25 @@ func (p *AnswerGetObject) NEODecode(data []byte) (int, error) {
data
=
data
[
1
:
]
}
}
p
.
DataSerial
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
DataSerial
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
TIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
First
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Last
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Partition
=
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Last
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
return
20
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerTIDList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
TIDList
=
make
([]
neo
.
Tid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
TIDList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -600,21 +606,21 @@ func (p *AnswerTIDList) NEODecode(data []byte) (int, error) {
}
func
(
p
*
TIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
MinTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Length
=
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
Partition
=
BigEndian
.
Uint32
(
data
[
20
:
])
p
.
MinTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
return
24
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerTIDListFrom
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
TidList
=
make
([]
neo
.
Tid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -622,14 +628,14 @@ func (p *AnswerTIDListFrom) NEODecode(data []byte) (int, error) {
}
func
(
p
*
TransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerTransactionInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -638,7 +644,7 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -647,7 +653,7 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -657,12 +663,12 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
}
p
.
Packed
=
bool
((
data
[
0
:
])[
0
])
{
l
:=
BigEndian
.
Uint32
(
data
[
1
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
1
:
])
data
=
data
[
5
:
]
p
.
OidList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -670,16 +676,16 @@ func (p *AnswerTransactionInformation) NEODecode(data []byte) (int, error) {
}
func
(
p
*
ObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
First
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Last
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
First
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Last
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
return
24
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerObjectHistory
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
HistoryList
=
make
([]
struct
{
Serial
neo
.
Tid
...
...
@@ -687,8 +693,8 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
},
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
HistoryList
[
i
]
a
.
Serial
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
.
Size
=
BigEndian
.
Uint32
(
data
[
8
:
])
a
.
Serial
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
a
.
Size
=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
}
}
...
...
@@ -696,29 +702,29 @@ func (p *AnswerObjectHistory) NEODecode(data []byte) (int, error) {
}
func
(
p
*
PartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
MinOffset
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
MaxOffset
=
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
8
:
]))
p
.
MinOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
MaxOffset
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
]))
return
12
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerPartitionList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
PTid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
PTid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
8
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])
data
=
data
[
12
:
]
p
.
RowList
=
make
([]
neo
.
RowInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
a
.
Offset
=
BigEndian
.
Uint32
(
data
[
0
:
])
a
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
a
.
CellList
=
make
([]
neo
.
CellInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
a
.
CellList
[
i
]
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
CellState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
data
=
data
[
8
:
]
}
}
...
...
@@ -729,20 +735,20 @@ func (p *AnswerPartitionList) NEODecode(data []byte) (int, error) {
}
func
(
p
*
X_NodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
NodeType
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
return
4
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerNodeList
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
NodeList
=
make
([]
neo
.
NodeInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
NodeType
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -750,9 +756,9 @@ func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
a
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
a
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
2
:
]))
a
.
NodeState
=
int32
(
BigEndian
.
Uint32
(
data
[
6
:
]))
a
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
]))
a
.
NodeState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
]))
a
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
data
=
data
[
18
:
]
}
...
...
@@ -761,19 +767,19 @@ func (p *AnswerNodeList) NEODecode(data []byte) (int, error) {
}
func
(
p
*
SetNodeState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
NodeState
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
p
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
NodeState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
return
8
/* + TODO variable part */
,
nil
}
func
(
p
*
AddPendingNodes
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
UUIDList
=
make
([]
neo
.
UUID
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
a
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
data
=
data
[
4
:
]
}
}
...
...
@@ -782,12 +788,12 @@ func (p *AddPendingNodes) NEODecode(data []byte) (int, error) {
func
(
p
*
TweakPartitionTable
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
UUIDList
=
make
([]
neo
.
UUID
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
a
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
data
=
data
[
4
:
]
}
}
...
...
@@ -796,14 +802,14 @@ func (p *TweakPartitionTable) NEODecode(data []byte) (int, error) {
func
(
p
*
NotifyNodeInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
NodeList
=
make
([]
neo
.
NodeInfo
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
a
.
NodeType
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
.
NodeType
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -811,9 +817,9 @@ func (p *NotifyNodeInformation) NEODecode(data []byte) (int, error) {
a
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
a
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
a
.
UUID
=
int32
(
BigEndian
.
Uint32
(
data
[
2
:
]))
a
.
NodeState
=
int32
(
BigEndian
.
Uint32
(
data
[
6
:
]))
a
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
a
.
UUID
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
2
:
]))
a
.
NodeState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
6
:
]))
a
.
IdTimestamp
=
float64_NEODecode
(
data
[
10
:
])
data
=
data
[
18
:
]
}
...
...
@@ -826,31 +832,31 @@ func (p *NodeInformation) NEODecode(data []byte) (int, error) {
}
func
(
p
*
SetClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
State
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
State
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
return
4
/* + TODO variable part */
,
nil
}
func
(
p
*
ClusterInformation
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
State
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
State
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
return
4
/* + TODO variable part */
,
nil
}
func
(
p
*
X_ClusterState
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
State
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
p
.
State
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
return
4
/* + TODO variable part */
,
nil
}
func
(
p
*
ObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
LTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
UndoneTID
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
LTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
UndoneTID
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
24
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
24
:
])
data
=
data
[
28
:
]
p
.
OidList
=
make
([]
neo
.
Oid
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
OidList
[
i
]
a
=
BigEndian
.
Uint64
(
data
[
0
:
])
a
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
data
=
data
[
8
:
]
}
}
...
...
@@ -859,7 +865,7 @@ func (p *ObjectUndoSerial) NEODecode(data []byte) (int, error) {
func
(
p
*
AnswerObjectUndoSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
ObjectTIDDict
=
make
(
map
[
neo
.
Oid
]
struct
{
CurrentSerial
neo
.
Tid
...
...
@@ -868,9 +874,9 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
},
l
)
m
:=
p
.
ObjectTIDDict
for
i
:=
0
;
i
<
l
;
i
++
{
key
=
BigEndian
.
Uint64
(
data
[
0
:
])
m
[
key
]
.
CurrentSerial
=
BigEndian
.
Uint64
(
data
[
8
:
])
m
[
key
]
.
UndoSerial
=
BigEndian
.
Uint64
(
data
[
16
:
])
key
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
m
[
key
]
.
CurrentSerial
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
m
[
key
]
.
UndoSerial
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
m
[
key
]
.
IsCurrent
=
bool
((
data
[
24
:
])[
0
])
data
=
data
[
25
:
]
}
...
...
@@ -879,33 +885,33 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
}
func
(
p
*
HasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerHasLock
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
LockState
=
int32
(
BigEndian
.
Uint32
(
data
[
8
:
]))
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
LockState
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
]))
return
12
/* + TODO variable part */
,
nil
}
func
(
p
*
CheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Serial
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Serial
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
return
24
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerCheckCurrentSerial
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Conflicting
=
bool
((
data
[
0
:
])[
0
])
p
.
Oid
=
BigEndian
.
Uint64
(
data
[
1
:
])
p
.
Serial
=
BigEndian
.
Uint64
(
data
[
9
:
])
p
.
Oid
=
binary
.
BigEndian
.
Uint64
(
data
[
1
:
])
p
.
Serial
=
binary
.
BigEndian
.
Uint64
(
data
[
9
:
])
return
17
/* + TODO variable part */
,
nil
}
func
(
p
*
Pack
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
...
...
@@ -916,25 +922,25 @@ func (p *AnswerPack) NEODecode(data []byte) (int, error) {
func
(
p
*
CheckReplicas
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
p
.
PartitionDict
=
make
(
map
[
uint32
]
neo
.
UUID
,
l
)
m
:=
p
.
PartitionDict
for
i
:=
0
;
i
<
l
;
i
++
{
key
=
BigEndian
.
Uint32
(
data
[
0
:
])
m
[
key
]
=
int32
(
BigEndian
.
Uint32
(
data
[
4
:
]))
key
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
m
[
key
]
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
]))
data
=
data
[
8
:
]
}
}
p
.
MinTID
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
MinTID
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
return
16
/* + TODO variable part */
,
nil
}
func
(
p
*
CheckPartition
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Partition
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -943,7 +949,7 @@ func (p *CheckPartition) NEODecode(data []byte) (int, error) {
data
=
data
[
l
:
]
}
{
l
:=
BigEndian
.
Uint32
(
data
[
0
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
len
(
data
)
<
l
{
return
0
,
ErrDecodeOverflow
...
...
@@ -951,22 +957,22 @@ func (p *CheckPartition) NEODecode(data []byte) (int, error) {
p
.
Source
.
Address
.
Host
=
string
(
data
[
:
l
])
data
=
data
[
l
:
]
}
p
.
Source
.
Address
.
Port
=
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
MinTID
=
BigEndian
.
Uint64
(
data
[
2
:
])
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
10
:
])
p
.
Source
.
Address
.
Port
=
binary
.
BigEndian
.
Uint16
(
data
[
0
:
])
p
.
MinTID
=
binary
.
BigEndian
.
Uint64
(
data
[
2
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
10
:
])
return
18
/* + TODO variable part */
,
nil
}
func
(
p
*
CheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Partition
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Length
=
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
MinTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
MinTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
return
24
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerCheckTIDRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Count
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Checksum
[
0
]
=
(
data
[
4
:
])[
0
]
p
.
Checksum
[
1
]
=
(
data
[
5
:
])[
0
]
p
.
Checksum
[
2
]
=
(
data
[
6
:
])[
0
]
...
...
@@ -987,21 +993,21 @@ func (p *AnswerCheckTIDRange) NEODecode(data []byte) (int, error) {
p
.
Checksum
[
17
]
=
(
data
[
21
:
])[
0
]
p
.
Checksum
[
18
]
=
(
data
[
22
:
])[
0
]
p
.
Checksum
[
19
]
=
(
data
[
23
:
])[
0
]
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
24
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
24
:
])
return
32
/* + TODO variable part */
,
nil
}
func
(
p
*
CheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Partition
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Length
=
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
MinTID
=
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
MinOID
=
BigEndian
.
Uint64
(
data
[
24
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
p
.
MinTID
=
binary
.
BigEndian
.
Uint64
(
data
[
8
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
16
:
])
p
.
MinOID
=
binary
.
BigEndian
.
Uint64
(
data
[
24
:
])
return
32
/* + TODO variable part */
,
nil
}
func
(
p
*
AnswerCheckSerialRange
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Count
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Count
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
TidChecksum
[
0
]
=
(
data
[
4
:
])[
0
]
p
.
TidChecksum
[
1
]
=
(
data
[
5
:
])[
0
]
p
.
TidChecksum
[
2
]
=
(
data
[
6
:
])[
0
]
...
...
@@ -1022,7 +1028,7 @@ func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
p
.
TidChecksum
[
17
]
=
(
data
[
21
:
])[
0
]
p
.
TidChecksum
[
18
]
=
(
data
[
22
:
])[
0
]
p
.
TidChecksum
[
19
]
=
(
data
[
23
:
])[
0
]
p
.
MaxTID
=
BigEndian
.
Uint64
(
data
[
24
:
])
p
.
MaxTID
=
binary
.
BigEndian
.
Uint64
(
data
[
24
:
])
p
.
OidChecksum
[
0
]
=
(
data
[
32
:
])[
0
]
p
.
OidChecksum
[
1
]
=
(
data
[
33
:
])[
0
]
p
.
OidChecksum
[
2
]
=
(
data
[
34
:
])[
0
]
...
...
@@ -1043,19 +1049,19 @@ func (p *AnswerCheckSerialRange) NEODecode(data []byte) (int, error) {
p
.
OidChecksum
[
17
]
=
(
data
[
49
:
])[
0
]
p
.
OidChecksum
[
18
]
=
(
data
[
50
:
])[
0
]
p
.
OidChecksum
[
19
]
=
(
data
[
51
:
])[
0
]
p
.
MaxOID
=
BigEndian
.
Uint64
(
data
[
52
:
])
p
.
MaxOID
=
binary
.
BigEndian
.
Uint64
(
data
[
52
:
])
return
60
/* + TODO variable part */
,
nil
}
func
(
p
*
PartitionCorrupted
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Partition
=
BigEndian
.
Uint32
(
data
[
0
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
{
l
:=
BigEndian
.
Uint32
(
data
[
4
:
])
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])
data
=
data
[
8
:
]
p
.
CellList
=
make
([]
neo
.
UUID
,
l
)
for
i
:=
0
;
i
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
a
=
int32
(
BigEndian
.
Uint32
(
data
[
0
:
]))
a
=
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
]))
data
=
data
[
4
:
]
}
}
...
...
@@ -1067,7 +1073,7 @@ func (p *LastTransaction) NEODecode(data []byte) (int, error) {
}
func
(
p
*
AnswerLastTransaction
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
p
.
Tid
=
BigEndian
.
Uint64
(
data
[
0
:
])
p
.
Tid
=
binary
.
BigEndian
.
Uint64
(
data
[
0
:
])
return
8
/* + TODO variable part */
,
nil
}
...
...
t/neo/pkt.go
View file @
39ab6e94
...
...
@@ -25,6 +25,13 @@ type PktBuf struct {
Data
[]
byte
// whole packet data including all headers XXX -> Buf ?
}
// XXX naming -> PktHeader ?
type
PktHead
struct
{
ConnId
be32
// NOTE is .msgid in py
MsgCode
be16
Len
be32
// whole packet length (including header)
}
// Get pointer to packet header
func
(
pkt
*
PktBuf
)
Header
()
*
PktHead
{
// XXX check len(Data) < PktHead ? -> no, Data has to be allocated with cap >= PktHeadLen
...
...
t/neo/proto.go
View file @
39ab6e94
...
...
@@ -14,7 +14,7 @@ const (
PROTOCOL_VERSION
=
8
MIN_PACKET_SIZE
=
10
// XXX unsafe.Sizeof(PktHead{}) give _typed_ constant (uintptr)
PktHeadLen
=
MIN_PACKET_SIZE
// TODO link this to PktHead.Encode/Decode size ?
PktHeadLen
=
MIN_PACKET_SIZE
// TODO link this to PktHead.Encode/Decode size ?
XXX -> pkt.go ?
MAX_PACKET_SIZE
=
0x4000000
RESPONSE_MASK
=
0x8000
...
...
t/neo/protogen.go
View file @
39ab6e94
...
...
@@ -80,7 +80,13 @@ func main() {
f
:=
fv
[
0
]
// proto.go comes first
buf
:=
Buffer
{}
buf
.
WriteString
(
"package neo
\n
"
)
buf
.
WriteString
(
`// DO NOT EDIT - AUTOGENERATED (by protogen.go)
package neo
import (
"encoding/binary"
)
`
)
for
_
,
decl
:=
range
f
.
Decls
{
// we look for types (which can be only under GenDecl)
...
...
@@ -145,14 +151,14 @@ var basicDecode = map[types.BasicKind]basicXXX {
// %v will be `data[n:n+wireSize]` XXX or `data[n:]` ?
types
.
Bool
:
{
1
,
"bool((%v)[0])"
},
types
.
Int8
:
{
1
,
"int8((%v)[0])"
},
types
.
Int16
:
{
2
,
"int16(BigEndian.Uint16(%v))"
},
types
.
Int32
:
{
4
,
"int32(BigEndian.Uint32(%v))"
},
types
.
Int64
:
{
8
,
"int64(BigEndian.Uint64(%v))"
},
types
.
Int16
:
{
2
,
"int16(
binary.
BigEndian.Uint16(%v))"
},
types
.
Int32
:
{
4
,
"int32(
binary.
BigEndian.Uint32(%v))"
},
types
.
Int64
:
{
8
,
"int64(
binary.
BigEndian.Uint64(%v))"
},
types
.
Uint8
:
{
1
,
"(%v)[0]"
},
types
.
Uint16
:
{
2
,
"BigEndian.Uint16(%v)"
},
types
.
Uint32
:
{
4
,
"BigEndian.Uint32(%v)"
},
types
.
Uint64
:
{
8
,
"BigEndian.Uint64(%v)"
},
types
.
Uint16
:
{
2
,
"
binary.
BigEndian.Uint16(%v)"
},
types
.
Uint32
:
{
4
,
"
binary.
BigEndian.Uint32(%v)"
},
types
.
Uint64
:
{
8
,
"
binary.
BigEndian.Uint64(%v)"
},
types
.
Float64
:
{
8
,
"float64_NEODecode(%v)"
},
...
...
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