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
c2a1b63a
Commit
c2a1b63a
authored
Jun 09, 2017
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X naming: Packet = raw data; Message = meaningful object
Message can be delivered encoded in a packet.
parent
b13e8150
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
552 additions
and
555 deletions
+552
-555
go/neo/cluster_test.go
go/neo/cluster_test.go
+6
-0
go/neo/connection.go
go/neo/connection.go
+8
-8
go/neo/connection_test.go
go/neo/connection_test.go
+59
-70
go/neo/pkt.go
go/neo/pkt.go
+3
-1
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+367
-367
go/neo/proto.go
go/neo/proto.go
+15
-15
go/neo/proto_test.go
go/neo/proto_test.go
+27
-27
go/neo/protogen.go
go/neo/protogen.go
+36
-36
go/neo/server/master.go
go/neo/server/master.go
+5
-5
go/neo/server/storage.go
go/neo/server/storage.go
+2
-2
go/neo/x_connection.go
go/neo/x_connection.go
+24
-24
No files found.
go/neo/cluster_test.go
View file @
c2a1b63a
...
...
@@ -53,6 +53,9 @@ func xfs1stor(net Network, path string) (*server.Storage, *fs1.FileStorage) {
// M drives cluster with 1 S through recovery -> verification -> service -> shutdown
func
TestMasterStorage
(
t
*
testing
.
T
)
{
// XXX temp disabled
return
net
:=
NetPipe
(
""
)
// test network FIXME New registers to global table
M
:=
server
.
NewMaster
(
"abc1"
)
S
,
_
:=
xfs1stor
(
net
,
"../zodb/storage/fs1/testdata/1.fs"
)
// XXX +readonly
...
...
@@ -70,6 +73,9 @@ func TestMasterStorage(t *testing.T) {
// basic interaction between Client -- Storage
func
TestClientStorage
(
t
*
testing
.
T
)
{
// XXX temp disabled
return
Cnl
,
Snl
:=
NodeLinkPipe
()
wg
:=
WorkGroup
()
...
...
go/neo/connection.go
View file @
c2a1b63a
...
...
@@ -297,7 +297,7 @@ func (nl *NodeLink) Accept() (c *Conn, err error) {
}
}
// errRecvShutdown returns appropriate error when c.down is found ready in
Recv
// errRecvShutdown returns appropriate error when c.down is found ready in
recvPkt
func
(
c
*
Conn
)
errRecvShutdown
()
error
{
switch
{
case
atomic
.
LoadUint32
(
&
c
.
closed
)
!=
0
:
...
...
@@ -323,8 +323,8 @@ func (c *Conn) errRecvShutdown() error {
}
}
//
Recv receives
packet from connection
func
(
c
*
Conn
)
Recv
()
(
*
PktBuf
,
error
)
{
//
recvPkt receives raw
packet from connection
func
(
c
*
Conn
)
recvPkt
()
(
*
PktBuf
,
error
)
{
select
{
case
<-
c
.
down
:
return
nil
,
c
.
err
(
"recv"
,
c
.
errRecvShutdown
())
...
...
@@ -441,13 +441,13 @@ func (c *Conn) errSendShutdown() error {
}
}
//
Send sends
packet via connection
func
(
c
*
Conn
)
Send
(
pkt
*
PktBuf
)
error
{
err
:=
c
.
send
(
pkt
)
//
sendPkt sends raw
packet via connection
func
(
c
*
Conn
)
sendPkt
(
pkt
*
PktBuf
)
error
{
err
:=
c
.
send
Pkt2
(
pkt
)
return
c
.
err
(
"send"
,
err
)
}
func
(
c
*
Conn
)
send
(
pkt
*
PktBuf
)
error
{
func
(
c
*
Conn
)
send
Pkt2
(
pkt
*
PktBuf
)
error
{
// set pkt connId associated with this connection
pkt
.
Header
()
.
ConnId
=
hton32
(
c
.
connId
)
var
err
error
...
...
@@ -541,7 +541,7 @@ func (nl *NodeLink) recvPkt() (*PktBuf, error) {
// first read to read pkt header and hopefully up to page of data in 1 syscall
pkt
:=
&
PktBuf
{
make
([]
byte
,
4096
)}
// TODO reenable, but NOTE next packet can be also prefetched here -> use buffering ?
//n, err := io.ReadAtLeast(nl.peerLink, p
kt
.Data, PktHeadLen)
//n, err := io.ReadAtLeast(nl.peerLink, p
tb
.Data, PktHeadLen)
n
,
err
:=
io
.
ReadFull
(
nl
.
peerLink
,
pkt
.
Data
[
:
PktHeadLen
])
if
err
!=
nil
{
return
nil
,
err
...
...
go/neo/connection_test.go
View file @
c2a1b63a
...
...
@@ -72,24 +72,13 @@ func xaccept(nl *NodeLink) *Conn {
return
c
}
func
xsend
(
c
*
Conn
,
pkt
*
PktBuf
)
{
err
:=
c
.
Send
(
pkt
)
func
xsend
Pkt
(
c
interface
{
sendPkt
(
*
PktBuf
)
error
}
,
pkt
*
PktBuf
)
{
err
:=
c
.
sendPkt
(
pkt
)
exc
.
Raiseif
(
err
)
}
func
xrecv
(
c
*
Conn
)
*
PktBuf
{
pkt
,
err
:=
c
.
Recv
()
exc
.
Raiseif
(
err
)
return
pkt
}
func
xsendPkt
(
nl
*
NodeLink
,
pkt
*
PktBuf
)
{
err
:=
nl
.
sendPkt
(
pkt
)
exc
.
Raiseif
(
err
)
}
func
xrecvPkt
(
nl
*
NodeLink
)
*
PktBuf
{
pkt
,
err
:=
nl
.
recvPkt
()
func
xrecvPkt
(
c
interface
{
recvPkt
()
(
*
PktBuf
,
error
)
})
*
PktBuf
{
pkt
,
err
:=
c
.
recvPkt
()
exc
.
Raiseif
(
err
)
return
pkt
}
...
...
@@ -134,7 +123,7 @@ func _mkpkt(connid uint32, msgcode uint16, payload []byte) *PktBuf {
}
func
mkpkt
(
msgcode
uint16
,
payload
[]
byte
)
*
PktBuf
{
// in Conn exchange connid is automatically set by Conn.
Send
// in Conn exchange connid is automatically set by Conn.
sendPkt
return
_mkpkt
(
0
,
msgcode
,
payload
)
}
...
...
@@ -300,7 +289,7 @@ func TestNodeLink(t *testing.T) {
// Test connections on top of nodelink
// Close vs
Recv
// Close vs
recvPkt
nl1
,
nl2
=
_nodeLinkPipe
(
0
,
linkNoRecvSend
)
c
=
xnewconn
(
nl1
)
wg
=
WorkGroup
()
...
...
@@ -308,15 +297,15 @@ func TestNodeLink(t *testing.T) {
tdelay
()
xclose
(
c
)
})
pkt
,
err
=
c
.
Recv
()
pkt
,
err
=
c
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
ErrClosedConn
)
{
t
.
Fatalf
(
"Conn.
Recv
() after close: pkt = %v err = %v"
,
pkt
,
err
)
t
.
Fatalf
(
"Conn.
recvPkt
() after close: pkt = %v err = %v"
,
pkt
,
err
)
}
xwait
(
wg
)
xclose
(
nl1
)
xclose
(
nl2
)
// Close vs
Send
// Close vs
sendPkt
nl1
,
nl2
=
_nodeLinkPipe
(
0
,
linkNoRecvSend
)
c
=
xnewconn
(
nl1
)
wg
=
WorkGroup
()
...
...
@@ -325,27 +314,27 @@ func TestNodeLink(t *testing.T) {
xclose
(
c
)
})
pkt
=
&
PktBuf
{[]
byte
(
"data"
)}
err
=
c
.
Send
(
pkt
)
err
=
c
.
sendPkt
(
pkt
)
if
xconnError
(
err
)
!=
ErrClosedConn
{
t
.
Fatalf
(
"Conn.
Send
() after close: err = %v"
,
err
)
t
.
Fatalf
(
"Conn.
sendPkt
() after close: err = %v"
,
err
)
}
xwait
(
wg
)
// NodeLink.Close vs Conn.
Send/Recv
// NodeLink.Close vs Conn.
sendPkt/recvPkt
c11
:=
xnewconn
(
nl1
)
c12
:=
xnewconn
(
nl1
)
wg
=
WorkGroup
()
wg
.
Gox
(
func
()
{
pkt
,
err
:=
c11
.
Recv
()
pkt
,
err
:=
c11
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
ErrLinkClosed
)
{
exc
.
Raisef
(
"Conn.
Recv
() after NodeLink close: pkt = %v err = %v"
,
pkt
,
err
)
exc
.
Raisef
(
"Conn.
recvPkt
() after NodeLink close: pkt = %v err = %v"
,
pkt
,
err
)
}
})
wg
.
Gox
(
func
()
{
pkt
:=
&
PktBuf
{[]
byte
(
"data"
)}
err
:=
c12
.
Send
(
pkt
)
err
:=
c12
.
sendPkt
(
pkt
)
if
xconnError
(
err
)
!=
ErrLinkClosed
{
exc
.
Raisef
(
"Conn.
Send
() after NodeLink close: err = %v"
,
err
)
exc
.
Raisef
(
"Conn.
sendPkt
() after NodeLink close: err = %v"
,
err
)
}
})
tdelay
()
...
...
@@ -355,7 +344,7 @@ func TestNodeLink(t *testing.T) {
xclose
(
c12
)
xclose
(
nl2
)
// NodeLink.Close vs Conn.
Send/Recv
and Accept on another side
// NodeLink.Close vs Conn.
sendPkt/recvPkt
and Accept on another side
nl1
,
nl2
=
_nodeLinkPipe
(
linkNoRecvSend
,
0
)
c21
:=
xnewconn
(
nl2
)
c22
:=
xnewconn
(
nl2
)
...
...
@@ -363,22 +352,22 @@ func TestNodeLink(t *testing.T) {
wg
=
WorkGroup
()
var
errRecv
error
wg
.
Gox
(
func
()
{
pkt
,
err
:=
c21
.
Recv
()
pkt
,
err
:=
c21
.
recvPkt
()
want1
:=
io
.
EOF
// if recvPkt wakes up due to peer close
want2
:=
io
.
ErrClosedPipe
// if recvPkt wakes up due to sendPkt wakes up first and closes nl1
cerr
:=
xconnError
(
err
)
if
!
(
pkt
==
nil
&&
(
cerr
==
want1
||
cerr
==
want2
))
{
exc
.
Raisef
(
"Conn.
Recv
after peer NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
exc
.
Raisef
(
"Conn.
recvPkt
after peer NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
}
errRecv
=
cerr
})
wg
.
Gox
(
func
()
{
pkt
:=
&
PktBuf
{[]
byte
(
"data"
)}
err
:=
c22
.
Send
(
pkt
)
err
:=
c22
.
sendPkt
(
pkt
)
want
:=
io
.
ErrClosedPipe
// always this in both due to peer close or recvPkt waking up and closing nl2
if
xconnError
(
err
)
!=
want
{
exc
.
Raisef
(
"Conn.
Send
after peer NodeLink shutdown: %v"
,
err
)
exc
.
Raisef
(
"Conn.
sendPkt
after peer NodeLink shutdown: %v"
,
err
)
}
})
...
...
@@ -406,46 +395,46 @@ func TestNodeLink(t *testing.T) {
t
.
Fatalf
(
"Accept after NodeLink shutdown: conn = %v err = %v"
,
c
,
err
)
}
//
Recv/Send
on another Conn
pkt
,
err
=
c23
.
Recv
()
//
recvPkt/sendPkt
on another Conn
pkt
,
err
=
c23
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
errRecv
)
{
t
.
Fatalf
(
"Conn.
Recv
2 after peer NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
t
.
Fatalf
(
"Conn.
recvPkt
2 after peer NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
}
err
=
c23
.
Send
(
&
PktBuf
{[]
byte
(
"data"
)})
err
=
c23
.
sendPkt
(
&
PktBuf
{[]
byte
(
"data"
)})
if
xconnError
(
err
)
!=
ErrLinkDown
{
t
.
Fatalf
(
"Conn.
Send
2 after peer NodeLink shutdown: %v"
,
err
)
t
.
Fatalf
(
"Conn.
sendPkt
2 after peer NodeLink shutdown: %v"
,
err
)
}
//
Recv/Send
error on second call
pkt
,
err
=
c21
.
Recv
()
//
recvPkt/sendPkt
error on second call
pkt
,
err
=
c21
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
ErrLinkDown
)
{
t
.
Fatalf
(
"Conn.
Recv
after NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
t
.
Fatalf
(
"Conn.
recvPkt
after NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
}
err
=
c22
.
Send
(
&
PktBuf
{[]
byte
(
"data"
)})
err
=
c22
.
sendPkt
(
&
PktBuf
{[]
byte
(
"data"
)})
if
xconnError
(
err
)
!=
ErrLinkDown
{
t
.
Fatalf
(
"Conn.
Send
after NodeLink shutdown: %v"
,
err
)
t
.
Fatalf
(
"Conn.
sendPkt
after NodeLink shutdown: %v"
,
err
)
}
xclose
(
c23
)
//
Recv/Send
on closed Conn but not closed NodeLink
pkt
,
err
=
c23
.
Recv
()
//
recvPkt/sendPkt
on closed Conn but not closed NodeLink
pkt
,
err
=
c23
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
ErrClosedConn
)
{
t
.
Fatalf
(
"Conn.
Recv
after close but only stopped NodeLink: pkt = %v err = %v"
,
pkt
,
err
)
t
.
Fatalf
(
"Conn.
recvPkt
after close but only stopped NodeLink: pkt = %v err = %v"
,
pkt
,
err
)
}
err
=
c23
.
Send
(
&
PktBuf
{[]
byte
(
"data"
)})
err
=
c23
.
sendPkt
(
&
PktBuf
{[]
byte
(
"data"
)})
if
xconnError
(
err
)
!=
ErrClosedConn
{
t
.
Fatalf
(
"Conn.
Send
after close but only stopped NodeLink: %v"
,
err
)
t
.
Fatalf
(
"Conn.
sendPkt
after close but only stopped NodeLink: %v"
,
err
)
}
xclose
(
nl2
)
//
Recv/Send
NewConn/Accept error after NodeLink close
pkt
,
err
=
c21
.
Recv
()
//
recvPkt/sendPkt
NewConn/Accept error after NodeLink close
pkt
,
err
=
c21
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
ErrLinkClosed
)
{
t
.
Fatalf
(
"Conn.
Recv
after NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
t
.
Fatalf
(
"Conn.
recvPkt
after NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
}
err
=
c22
.
Send
(
&
PktBuf
{[]
byte
(
"data"
)})
err
=
c22
.
sendPkt
(
&
PktBuf
{[]
byte
(
"data"
)})
if
xconnError
(
err
)
!=
ErrLinkClosed
{
t
.
Fatalf
(
"Conn.
Send
after NodeLink shutdown: %v"
,
err
)
t
.
Fatalf
(
"Conn.
sendPkt
after NodeLink shutdown: %v"
,
err
)
}
c
,
err
=
nl2
.
NewConn
()
...
...
@@ -460,14 +449,14 @@ func TestNodeLink(t *testing.T) {
xclose
(
c21
)
xclose
(
c22
)
//
Recv/Send
error after Close & NodeLink shutdown
pkt
,
err
=
c21
.
Recv
()
//
recvPkt/sendPkt
error after Close & NodeLink shutdown
pkt
,
err
=
c21
.
recvPkt
()
if
!
(
pkt
==
nil
&&
xconnError
(
err
)
==
ErrClosedConn
)
{
t
.
Fatalf
(
"Conn.
Recv
after close and NodeLink close: pkt = %v err = %v"
,
pkt
,
err
)
t
.
Fatalf
(
"Conn.
recvPkt
after close and NodeLink close: pkt = %v err = %v"
,
pkt
,
err
)
}
err
=
c22
.
Send
(
&
PktBuf
{[]
byte
(
"data"
)})
err
=
c22
.
sendPkt
(
&
PktBuf
{[]
byte
(
"data"
)})
if
xconnError
(
err
)
!=
ErrClosedConn
{
t
.
Fatalf
(
"Conn.
Send
after close and NodeLink close: %v"
,
err
)
t
.
Fatalf
(
"Conn.
sendPkt
after close and NodeLink close: %v"
,
err
)
}
...
...
@@ -477,25 +466,25 @@ func TestNodeLink(t *testing.T) {
wg
.
Gox
(
func
()
{
c
:=
xaccept
(
nl2
)
pkt
:=
xrecv
(
c
)
pkt
:=
xrecv
Pkt
(
c
)
xverifyPkt
(
pkt
,
c
.
connId
,
33
,
[]
byte
(
"ping"
))
// change pkt a bit and send it back
xsend
(
c
,
mkpkt
(
34
,
[]
byte
(
"pong"
)))
xsend
Pkt
(
c
,
mkpkt
(
34
,
[]
byte
(
"pong"
)))
// one more time
pkt
=
xrecv
(
c
)
pkt
=
xrecv
Pkt
(
c
)
xverifyPkt
(
pkt
,
c
.
connId
,
35
,
[]
byte
(
"ping2"
))
xsend
(
c
,
mkpkt
(
36
,
[]
byte
(
"pong2"
)))
xsend
Pkt
(
c
,
mkpkt
(
36
,
[]
byte
(
"pong2"
)))
xclose
(
c
)
})
c
=
xnewconn
(
nl1
)
xsend
(
c
,
mkpkt
(
33
,
[]
byte
(
"ping"
)))
pkt
=
xrecv
(
c
)
xsend
Pkt
(
c
,
mkpkt
(
33
,
[]
byte
(
"ping"
)))
pkt
=
xrecv
Pkt
(
c
)
xverifyPkt
(
pkt
,
c
.
connId
,
34
,
[]
byte
(
"pong"
))
xsend
(
c
,
mkpkt
(
35
,
[]
byte
(
"ping2"
)))
pkt
=
xrecv
(
c
)
xsend
Pkt
(
c
,
mkpkt
(
35
,
[]
byte
(
"ping2"
)))
pkt
=
xrecv
Pkt
(
c
)
xverifyPkt
(
pkt
,
c
.
connId
,
36
,
[]
byte
(
"pong2"
))
xwait
(
wg
)
...
...
@@ -520,13 +509,13 @@ func TestNodeLink(t *testing.T) {
c
:=
xaccept
(
nl2
)
wg
.
Gox
(
func
()
{
pkt
:=
xrecv
(
c
)
pkt
:=
xrecv
Pkt
(
c
)
n
:=
ntoh16
(
pkt
.
Header
()
.
MsgCode
)
x
:=
replyOrder
[
n
]
// wait before it is our turn & echo pkt back
<-
x
.
start
xsend
(
c
,
pkt
)
xsend
Pkt
(
c
,
pkt
)
xclose
(
c
)
...
...
@@ -540,12 +529,12 @@ func TestNodeLink(t *testing.T) {
c1
:=
xnewconn
(
nl1
)
c2
:=
xnewconn
(
nl1
)
xsend
(
c1
,
mkpkt
(
1
,
[]
byte
(
""
)))
xsend
(
c2
,
mkpkt
(
2
,
[]
byte
(
""
)))
xsend
Pkt
(
c1
,
mkpkt
(
1
,
[]
byte
(
""
)))
xsend
Pkt
(
c2
,
mkpkt
(
2
,
[]
byte
(
""
)))
// replies must be coming in reverse order
xechoWait
:=
func
(
c
*
Conn
,
msgCode
uint16
)
{
pkt
:=
xrecv
(
c
)
pkt
:=
xrecv
Pkt
(
c
)
xverifyPkt
(
pkt
,
c
.
connId
,
msgCode
,
[]
byte
(
""
))
}
xechoWait
(
c2
,
2
)
...
...
go/neo/pkt.go
View file @
c2a1b63a
...
...
@@ -26,6 +26,8 @@ import (
// TODO organize rx buffers management (freelist etc)
// PktBuf is a buffer with full raw packet (header + data)
//
// variables of type PktBuf are usually named "pkb" (packet buffer), similar to "skb" in Linux
type
PktBuf
struct
{
Data
[]
byte
// whole packet data including all headers XXX -> Buf ?
}
...
...
@@ -61,7 +63,7 @@ func (pkt *PktBuf) String() string {
s
:=
fmt
.
Sprintf
(
".%d"
,
ntoh32
(
h
.
ConnId
))
msgCode
:=
ntoh16
(
h
.
MsgCode
)
msgType
:=
pkt
TypeRegistry
[
msgCode
]
msgType
:=
msg
TypeRegistry
[
msgCode
]
if
msgType
==
nil
{
s
+=
fmt
.
Sprintf
(
" ? (%d)"
,
msgCode
)
}
else
{
...
...
go/neo/proto-marshal.go
View file @
c2a1b63a
...
...
@@ -10,19 +10,19 @@ import (
"../zodb"
)
//
packet
s marshalling
//
message
s marshalling
// 0. Address
func
(
_
*
Address
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Address
)
NEOMsgCode
()
uint16
{
return
0
}
func
(
p
*
Address
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Address
)
NEO
Msg
EncodedLen
()
int
{
return
6
+
len
(
p
.
Host
)
}
func
(
p
*
Address
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Address
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -33,7 +33,7 @@ func (p *Address) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
}
func
(
p
*
Address
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Address
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -57,15 +57,15 @@ overflow:
// 1. NodeInfo
func
(
_
*
NodeInfo
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NodeInfo
)
NEOMsgCode
()
uint16
{
return
1
}
func
(
p
*
NodeInfo
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NodeInfo
)
NEO
Msg
EncodedLen
()
int
{
return
26
+
len
(
p
.
Address
.
Host
)
}
func
(
p
*
NodeInfo
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NodeInfo
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
{
l
:=
uint32
(
len
(
p
.
Address
.
Host
))
...
...
@@ -80,7 +80,7 @@ func (p *NodeInfo) NEOPktEncode(data []byte) {
float64_NEOEncode
(
data
[
10
:
],
p
.
IdTimestamp
)
}
func
(
p
*
NodeInfo
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeInfo
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
...
...
@@ -108,20 +108,20 @@ overflow:
// 2. CellInfo
func
(
_
*
CellInfo
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CellInfo
)
NEOMsgCode
()
uint16
{
return
2
}
func
(
p
*
CellInfo
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CellInfo
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
CellInfo
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CellInfo
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
CellState
)))
}
func
(
p
*
CellInfo
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CellInfo
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -135,15 +135,15 @@ overflow:
// 3. RowInfo
func
(
_
*
RowInfo
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
RowInfo
)
NEOMsgCode
()
uint16
{
return
3
}
func
(
p
*
RowInfo
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
RowInfo
)
NEO
Msg
EncodedLen
()
int
{
return
8
+
len
(
p
.
CellList
)
*
8
}
func
(
p
*
RowInfo
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
RowInfo
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Offset
)
{
l
:=
uint32
(
len
(
p
.
CellList
))
...
...
@@ -158,7 +158,7 @@ func (p *RowInfo) NEOPktEncode(data []byte) {
}
}
func
(
p
*
RowInfo
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RowInfo
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
...
...
@@ -187,15 +187,15 @@ overflow:
// 4. Error
func
(
_
*
Error
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Error
)
NEOMsgCode
()
uint16
{
return
4
}
func
(
p
*
Error
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Error
)
NEO
Msg
EncodedLen
()
int
{
return
8
+
len
(
p
.
Message
)
}
func
(
p
*
Error
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Error
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
p
.
Code
))
{
l
:=
uint32
(
len
(
p
.
Message
))
...
...
@@ -206,7 +206,7 @@ func (p *Error) NEOPktEncode(data []byte) {
}
}
func
(
p
*
Error
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Error
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
...
...
@@ -230,49 +230,49 @@ overflow:
// 5. Ping
func
(
_
*
Ping
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Ping
)
NEOMsgCode
()
uint16
{
return
5
}
func
(
p
*
Ping
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Ping
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
Ping
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Ping
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
Ping
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Ping
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 6. CloseClient
func
(
_
*
CloseClient
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CloseClient
)
NEOMsgCode
()
uint16
{
return
6
}
func
(
p
*
CloseClient
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CloseClient
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
CloseClient
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CloseClient
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
CloseClient
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CloseClient
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 7. RequestIdentification
func
(
_
*
RequestIdentification
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
RequestIdentification
)
NEOMsgCode
()
uint16
{
return
7
}
func
(
p
*
RequestIdentification
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
RequestIdentification
)
NEO
Msg
EncodedLen
()
int
{
return
26
+
len
(
p
.
Address
.
Host
)
+
len
(
p
.
ClusterName
)
}
func
(
p
*
RequestIdentification
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
RequestIdentification
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
{
...
...
@@ -293,7 +293,7 @@ func (p *RequestIdentification) NEOPktEncode(data []byte) {
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
}
func
(
p
*
RequestIdentification
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RequestIdentification
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -330,15 +330,15 @@ overflow:
// 8. AcceptIdentification
func
(
_
*
AcceptIdentification
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AcceptIdentification
)
NEOMsgCode
()
uint16
{
return
8
}
func
(
p
*
AcceptIdentification
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AcceptIdentification
)
NEO
Msg
EncodedLen
()
int
{
return
20
}
func
(
p
*
AcceptIdentification
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AcceptIdentification
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
MyNodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
p
.
NumPartitions
)
...
...
@@ -346,7 +346,7 @@ func (p *AcceptIdentification) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
uint32
(
int32
(
p
.
YourNodeUUID
)))
}
func
(
p
*
AcceptIdentification
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AcceptIdentification
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
20
{
goto
overflow
}
...
...
@@ -363,36 +363,36 @@ overflow:
// 9. PrimaryMaster
func
(
_
*
PrimaryMaster
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
PrimaryMaster
)
NEOMsgCode
()
uint16
{
return
9
}
func
(
p
*
PrimaryMaster
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
PrimaryMaster
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
PrimaryMaster
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
PrimaryMaster
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
PrimaryMaster
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PrimaryMaster
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 10. AnswerPrimary
func
(
_
*
AnswerPrimary
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerPrimary
)
NEOMsgCode
()
uint16
{
return
10
}
func
(
p
*
AnswerPrimary
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerPrimary
)
NEO
Msg
EncodedLen
()
int
{
return
4
}
func
(
p
*
AnswerPrimary
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerPrimary
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
PrimaryNodeUUID
)))
}
func
(
p
*
AnswerPrimary
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPrimary
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -405,11 +405,11 @@ overflow:
// 11. NotPrimaryMaster
func
(
_
*
NotPrimaryMaster
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NotPrimaryMaster
)
NEOMsgCode
()
uint16
{
return
11
}
func
(
p
*
NotPrimaryMaster
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NotPrimaryMaster
)
NEO
Msg
EncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
KnownMasterList
);
i
++
{
a
:=
&
p
.
KnownMasterList
[
i
]
...
...
@@ -418,7 +418,7 @@ func (p *NotPrimaryMaster) NEOPktEncodedLen() int {
return
8
+
len
(
p
.
KnownMasterList
)
*
6
+
size
}
func
(
p
*
NotPrimaryMaster
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NotPrimaryMaster
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
Primary
)))
{
l
:=
uint32
(
len
(
p
.
KnownMasterList
))
...
...
@@ -439,7 +439,7 @@ func (p *NotPrimaryMaster) NEOPktEncode(data []byte) {
}
}
func
(
p
*
NotPrimaryMaster
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotPrimaryMaster
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
...
...
@@ -477,38 +477,38 @@ overflow:
// 12. Recovery
func
(
_
*
Recovery
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Recovery
)
NEOMsgCode
()
uint16
{
return
12
}
func
(
p
*
Recovery
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Recovery
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
Recovery
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Recovery
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
Recovery
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Recovery
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 13. AnswerRecovery
func
(
_
*
AnswerRecovery
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerRecovery
)
NEOMsgCode
()
uint16
{
return
13
}
func
(
p
*
AnswerRecovery
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerRecovery
)
NEO
Msg
EncodedLen
()
int
{
return
24
}
func
(
p
*
AnswerRecovery
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerRecovery
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
BackupTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
TruncateTid
))
}
func
(
p
*
AnswerRecovery
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRecovery
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
}
...
...
@@ -523,37 +523,37 @@ overflow:
// 14. LastIDs
func
(
_
*
LastIDs
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
LastIDs
)
NEOMsgCode
()
uint16
{
return
14
}
func
(
p
*
LastIDs
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
LastIDs
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
LastIDs
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
LastIDs
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
LastIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LastIDs
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 15. AnswerLastIDs
func
(
_
*
AnswerLastIDs
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerLastIDs
)
NEOMsgCode
()
uint16
{
return
15
}
func
(
p
*
AnswerLastIDs
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerLastIDs
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
AnswerLastIDs
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastIDs
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
LastOid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LastTid
))
}
func
(
p
*
AnswerLastIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLastIDs
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -567,28 +567,28 @@ overflow:
// 16. X_PartitionTable
func
(
_
*
X_PartitionTable
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
X_PartitionTable
)
NEOMsgCode
()
uint16
{
return
16
}
func
(
p
*
X_PartitionTable
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
X_PartitionTable
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
X_PartitionTable
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
X_PartitionTable
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
X_PartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
X_PartitionTable
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 17. AnswerPartitionTable
func
(
_
*
AnswerPartitionTable
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerPartitionTable
)
NEOMsgCode
()
uint16
{
return
17
}
func
(
p
*
AnswerPartitionTable
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerPartitionTable
)
NEO
Msg
EncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
...
...
@@ -597,7 +597,7 @@ func (p *AnswerPartitionTable) NEOPktEncodedLen() int {
return
12
+
len
(
p
.
RowList
)
*
8
+
size
}
func
(
p
*
AnswerPartitionTable
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionTable
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
l
:=
uint32
(
len
(
p
.
RowList
))
...
...
@@ -622,7 +622,7 @@ func (p *AnswerPartitionTable) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerPartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPartitionTable
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -664,11 +664,11 @@ overflow:
// 18. NotifyPartitionTable
func
(
_
*
NotifyPartitionTable
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NotifyPartitionTable
)
NEOMsgCode
()
uint16
{
return
18
}
func
(
p
*
NotifyPartitionTable
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NotifyPartitionTable
)
NEO
Msg
EncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
...
...
@@ -677,7 +677,7 @@ func (p *NotifyPartitionTable) NEOPktEncodedLen() int {
return
12
+
len
(
p
.
RowList
)
*
8
+
size
}
func
(
p
*
NotifyPartitionTable
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NotifyPartitionTable
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
l
:=
uint32
(
len
(
p
.
RowList
))
...
...
@@ -702,7 +702,7 @@ func (p *NotifyPartitionTable) NEOPktEncode(data []byte) {
}
}
func
(
p
*
NotifyPartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyPartitionTable
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -744,15 +744,15 @@ overflow:
// 19. PartitionChanges
func
(
_
*
PartitionChanges
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
PartitionChanges
)
NEOMsgCode
()
uint16
{
return
19
}
func
(
p
*
PartitionChanges
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
PartitionChanges
)
NEO
Msg
EncodedLen
()
int
{
return
12
+
len
(
p
.
CellList
)
*
12
}
func
(
p
*
PartitionChanges
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
PartitionChanges
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
l
:=
uint32
(
len
(
p
.
CellList
))
...
...
@@ -768,7 +768,7 @@ func (p *PartitionChanges) NEOPktEncode(data []byte) {
}
}
func
(
p
*
PartitionChanges
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionChanges
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -802,19 +802,19 @@ overflow:
// 20. StartOperation
func
(
_
*
StartOperation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
StartOperation
)
NEOMsgCode
()
uint16
{
return
20
}
func
(
p
*
StartOperation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
StartOperation
)
NEO
Msg
EncodedLen
()
int
{
return
1
}
func
(
p
*
StartOperation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
StartOperation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Backup
)
}
func
(
p
*
StartOperation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StartOperation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
}
...
...
@@ -827,32 +827,32 @@ overflow:
// 21. StopOperation
func
(
_
*
StopOperation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
StopOperation
)
NEOMsgCode
()
uint16
{
return
21
}
func
(
p
*
StopOperation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
StopOperation
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
StopOperation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
StopOperation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
StopOperation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StopOperation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 22. UnfinishedTransactions
func
(
_
*
UnfinishedTransactions
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
UnfinishedTransactions
)
NEOMsgCode
()
uint16
{
return
22
}
func
(
p
*
UnfinishedTransactions
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
UnfinishedTransactions
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
RowList
)
*
4
}
func
(
p
*
UnfinishedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
UnfinishedTransactions
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
RowList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -865,7 +865,7 @@ func (p *UnfinishedTransactions) NEOPktEncode(data []byte) {
}
}
func
(
p
*
UnfinishedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
UnfinishedTransactions
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -892,15 +892,15 @@ overflow:
// 23. AnswerUnfinishedTransactions
func
(
_
*
AnswerUnfinishedTransactions
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerUnfinishedTransactions
)
NEOMsgCode
()
uint16
{
return
23
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Msg
EncodedLen
()
int
{
return
12
+
len
(
p
.
TidList
)
*
8
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MaxTID
))
{
l
:=
uint32
(
len
(
p
.
TidList
))
...
...
@@ -914,7 +914,7 @@ func (p *AnswerUnfinishedTransactions) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerUnfinishedTransactions
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -942,32 +942,32 @@ overflow:
// 24. LockedTransactions
func
(
_
*
LockedTransactions
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
LockedTransactions
)
NEOMsgCode
()
uint16
{
return
24
}
func
(
p
*
LockedTransactions
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
LockedTransactions
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
LockedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
LockedTransactions
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
LockedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LockedTransactions
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 25. AnswerLockedTransactions
func
(
_
*
AnswerLockedTransactions
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerLockedTransactions
)
NEOMsgCode
()
uint16
{
return
25
}
func
(
p
*
AnswerLockedTransactions
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerLockedTransactions
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
TidDict
)
*
16
}
func
(
p
*
AnswerLockedTransactions
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockedTransactions
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
TidDict
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -985,7 +985,7 @@ func (p *AnswerLockedTransactions) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerLockedTransactions
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLockedTransactions
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -1013,19 +1013,19 @@ overflow:
// 26. FinalTID
func
(
_
*
FinalTID
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
FinalTID
)
NEOMsgCode
()
uint16
{
return
26
}
func
(
p
*
FinalTID
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
FinalTID
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
FinalTID
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
FinalTID
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
}
func
(
p
*
FinalTID
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FinalTID
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1038,19 +1038,19 @@ overflow:
// 27. AnswerFinalTID
func
(
_
*
AnswerFinalTID
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerFinalTID
)
NEOMsgCode
()
uint16
{
return
27
}
func
(
p
*
AnswerFinalTID
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerFinalTID
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerFinalTID
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinalTID
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
AnswerFinalTID
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerFinalTID
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1063,20 +1063,20 @@ overflow:
// 28. ValidateTransaction
func
(
_
*
ValidateTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
ValidateTransaction
)
NEOMsgCode
()
uint16
{
return
28
}
func
(
p
*
ValidateTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
ValidateTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
ValidateTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
ValidateTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
ValidateTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ValidateTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1090,19 +1090,19 @@ overflow:
// 29. BeginTransaction
func
(
_
*
BeginTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
BeginTransaction
)
NEOMsgCode
()
uint16
{
return
29
}
func
(
p
*
BeginTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
BeginTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
BeginTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
BeginTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
BeginTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
BeginTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1115,19 +1115,19 @@ overflow:
// 30. AnswerBeginTransaction
func
(
_
*
AnswerBeginTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerBeginTransaction
)
NEOMsgCode
()
uint16
{
return
30
}
func
(
p
*
AnswerBeginTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerBeginTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerBeginTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerBeginTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
AnswerBeginTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerBeginTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1140,15 +1140,15 @@ overflow:
// 31. FailedVote
func
(
_
*
FailedVote
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
FailedVote
)
NEOMsgCode
()
uint16
{
return
31
}
func
(
p
*
FailedVote
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
FailedVote
)
NEO
Msg
EncodedLen
()
int
{
return
12
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
FailedVote
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
FailedVote
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
NodeList
))
...
...
@@ -1162,7 +1162,7 @@ func (p *FailedVote) NEOPktEncode(data []byte) {
}
}
func
(
p
*
FailedVote
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FailedVote
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -1190,15 +1190,15 @@ overflow:
// 32. FinishTransaction
func
(
_
*
FinishTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
FinishTransaction
)
NEOMsgCode
()
uint16
{
return
32
}
func
(
p
*
FinishTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
FinishTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
16
+
len
(
p
.
OIDList
)
*
8
+
len
(
p
.
CheckedList
)
*
8
}
func
(
p
*
FinishTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
FinishTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
OIDList
))
...
...
@@ -1222,7 +1222,7 @@ func (p *FinishTransaction) NEOPktEncode(data []byte) {
}
}
func
(
p
*
FinishTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
FinishTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -1264,20 +1264,20 @@ overflow:
// 33. AnswerFinishTransaction
func
(
_
*
AnswerFinishTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerFinishTransaction
)
NEOMsgCode
()
uint16
{
return
33
}
func
(
p
*
AnswerFinishTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerFinishTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
AnswerFinishTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerFinishTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
AnswerFinishTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerFinishTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1291,20 +1291,20 @@ overflow:
// 34. NotifyTransactionFinished
func
(
_
*
NotifyTransactionFinished
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NotifyTransactionFinished
)
NEOMsgCode
()
uint16
{
return
34
}
func
(
p
*
NotifyTransactionFinished
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NotifyTransactionFinished
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
NotifyTransactionFinished
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NotifyTransactionFinished
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
}
func
(
p
*
NotifyTransactionFinished
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyTransactionFinished
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1318,20 +1318,20 @@ overflow:
// 35. LockInformation
func
(
_
*
LockInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
LockInformation
)
NEOMsgCode
()
uint16
{
return
35
}
func
(
p
*
LockInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
LockInformation
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
LockInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
LockInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
LockInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LockInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1345,19 +1345,19 @@ overflow:
// 36. AnswerLockInformation
func
(
_
*
AnswerLockInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerLockInformation
)
NEOMsgCode
()
uint16
{
return
36
}
func
(
p
*
AnswerLockInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerLockInformation
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerLockInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerLockInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Ttid
))
}
func
(
p
*
AnswerLockInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLockInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1370,15 +1370,15 @@ overflow:
// 37. InvalidateObjects
func
(
_
*
InvalidateObjects
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
InvalidateObjects
)
NEOMsgCode
()
uint16
{
return
37
}
func
(
p
*
InvalidateObjects
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
InvalidateObjects
)
NEO
Msg
EncodedLen
()
int
{
return
12
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
InvalidateObjects
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
InvalidateObjects
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
OidList
))
...
...
@@ -1392,7 +1392,7 @@ func (p *InvalidateObjects) NEOPktEncode(data []byte) {
}
}
func
(
p
*
InvalidateObjects
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
InvalidateObjects
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -1420,19 +1420,19 @@ overflow:
// 38. UnlockInformation
func
(
_
*
UnlockInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
UnlockInformation
)
NEOMsgCode
()
uint16
{
return
38
}
func
(
p
*
UnlockInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
UnlockInformation
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
UnlockInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
UnlockInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
}
func
(
p
*
UnlockInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
UnlockInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1445,19 +1445,19 @@ overflow:
// 39. GenerateOIDs
func
(
_
*
GenerateOIDs
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
GenerateOIDs
)
NEOMsgCode
()
uint16
{
return
39
}
func
(
p
*
GenerateOIDs
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
GenerateOIDs
)
NEO
Msg
EncodedLen
()
int
{
return
4
}
func
(
p
*
GenerateOIDs
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
GenerateOIDs
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
NumOIDs
)
}
func
(
p
*
GenerateOIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
GenerateOIDs
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -1470,15 +1470,15 @@ overflow:
// 40. AnswerGenerateOIDs
func
(
_
*
AnswerGenerateOIDs
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerGenerateOIDs
)
NEOMsgCode
()
uint16
{
return
40
}
func
(
p
*
AnswerGenerateOIDs
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerGenerateOIDs
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
AnswerGenerateOIDs
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -1491,7 +1491,7 @@ func (p *AnswerGenerateOIDs) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerGenerateOIDs
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerGenerateOIDs
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -1518,20 +1518,20 @@ overflow:
// 41. Deadlock
func
(
_
*
Deadlock
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Deadlock
)
NEOMsgCode
()
uint16
{
return
41
}
func
(
p
*
Deadlock
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Deadlock
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
Deadlock
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Deadlock
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LockingTid
))
}
func
(
p
*
Deadlock
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Deadlock
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1545,20 +1545,20 @@ overflow:
// 42. RebaseTransaction
func
(
_
*
RebaseTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
RebaseTransaction
)
NEOMsgCode
()
uint16
{
return
42
}
func
(
p
*
RebaseTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
RebaseTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
RebaseTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
RebaseTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LockingTid
))
}
func
(
p
*
RebaseTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RebaseTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1572,15 +1572,15 @@ overflow:
// 43. AnswerRebaseTransaction
func
(
_
*
AnswerRebaseTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerRebaseTransaction
)
NEOMsgCode
()
uint16
{
return
43
}
func
(
p
*
AnswerRebaseTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerRebaseTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
AnswerRebaseTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerRebaseTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -1593,7 +1593,7 @@ func (p *AnswerRebaseTransaction) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerRebaseTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRebaseTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -1620,20 +1620,20 @@ overflow:
// 44. RebaseObject
func
(
_
*
RebaseObject
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
RebaseObject
)
NEOMsgCode
()
uint16
{
return
44
}
func
(
p
*
RebaseObject
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
RebaseObject
)
NEO
Msg
EncodedLen
()
int
{
return
16
}
func
(
p
*
RebaseObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
RebaseObject
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
}
func
(
p
*
RebaseObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RebaseObject
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
...
...
@@ -1647,15 +1647,15 @@ overflow:
// 45. AnswerRebaseObject
func
(
_
*
AnswerRebaseObject
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerRebaseObject
)
NEOMsgCode
()
uint16
{
return
45
}
func
(
p
*
AnswerRebaseObject
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerRebaseObject
)
NEO
Msg
EncodedLen
()
int
{
return
41
+
len
(
p
.
Data
)
}
func
(
p
*
AnswerRebaseObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerRebaseObject
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
ConflictSerial
))
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
...
...
@@ -1669,7 +1669,7 @@ func (p *AnswerRebaseObject) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerRebaseObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerRebaseObject
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
41
{
goto
overflow
...
...
@@ -1697,15 +1697,15 @@ overflow:
// 46. StoreObject
func
(
_
*
StoreObject
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
StoreObject
)
NEOMsgCode
()
uint16
{
return
46
}
func
(
p
*
StoreObject
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
StoreObject
)
NEO
Msg
EncodedLen
()
int
{
return
57
+
len
(
p
.
Data
)
}
func
(
p
*
StoreObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
StoreObject
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
(
data
[
16
:
])[
0
]
=
bool2byte
(
p
.
Compression
)
...
...
@@ -1721,7 +1721,7 @@ func (p *StoreObject) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
StoreObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StoreObject
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
41
{
goto
overflow
...
...
@@ -1751,19 +1751,19 @@ overflow:
// 47. AnswerStoreObject
func
(
_
*
AnswerStoreObject
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerStoreObject
)
NEOMsgCode
()
uint16
{
return
47
}
func
(
p
*
AnswerStoreObject
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerStoreObject
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerStoreObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerStoreObject
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Conflict
))
}
func
(
p
*
AnswerStoreObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerStoreObject
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1776,15 +1776,15 @@ overflow:
// 48. AbortTransaction
func
(
_
*
AbortTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AbortTransaction
)
NEOMsgCode
()
uint16
{
return
48
}
func
(
p
*
AbortTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AbortTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
12
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
AbortTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AbortTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
NodeList
))
...
...
@@ -1798,7 +1798,7 @@ func (p *AbortTransaction) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AbortTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AbortTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -1826,15 +1826,15 @@ overflow:
// 49. StoreTransaction
func
(
_
*
StoreTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
StoreTransaction
)
NEOMsgCode
()
uint16
{
return
49
}
func
(
p
*
StoreTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
StoreTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
24
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
StoreTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
StoreTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
User
))
...
...
@@ -1869,7 +1869,7 @@ func (p *StoreTransaction) NEOPktEncode(data []byte) {
}
}
func
(
p
*
StoreTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
StoreTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -1927,19 +1927,19 @@ overflow:
// 50. VoteTransaction
func
(
_
*
VoteTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
VoteTransaction
)
NEOMsgCode
()
uint16
{
return
50
}
func
(
p
*
VoteTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
VoteTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
VoteTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
VoteTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
VoteTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
VoteTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -1952,21 +1952,21 @@ overflow:
// 51. GetObject
func
(
_
*
GetObject
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
GetObject
)
NEOMsgCode
()
uint16
{
return
51
}
func
(
p
*
GetObject
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
GetObject
)
NEO
Msg
EncodedLen
()
int
{
return
24
}
func
(
p
*
GetObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
GetObject
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
GetObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
GetObject
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
}
...
...
@@ -1981,15 +1981,15 @@ overflow:
// 52. AnswerGetObject
func
(
_
*
AnswerGetObject
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerGetObject
)
NEOMsgCode
()
uint16
{
return
52
}
func
(
p
*
AnswerGetObject
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerGetObject
)
NEO
Msg
EncodedLen
()
int
{
return
57
+
len
(
p
.
Data
)
}
func
(
p
*
AnswerGetObject
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerGetObject
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
NextSerial
))
...
...
@@ -2005,7 +2005,7 @@ func (p *AnswerGetObject) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
DataSerial
))
}
func
(
p
*
AnswerGetObject
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerGetObject
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
49
{
goto
overflow
...
...
@@ -2035,21 +2035,21 @@ overflow:
// 53. TIDList
func
(
_
*
TIDList
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
TIDList
)
NEOMsgCode
()
uint16
{
return
53
}
func
(
p
*
TIDList
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
TIDList
)
NEO
Msg
EncodedLen
()
int
{
return
20
}
func
(
p
*
TIDList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
TIDList
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
p
.
First
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
p
.
Last
)
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Partition
)
}
func
(
p
*
TIDList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TIDList
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
20
{
goto
overflow
}
...
...
@@ -2064,15 +2064,15 @@ overflow:
// 54. AnswerTIDList
func
(
_
*
AnswerTIDList
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerTIDList
)
NEOMsgCode
()
uint16
{
return
54
}
func
(
p
*
AnswerTIDList
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerTIDList
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
TIDList
)
*
8
}
func
(
p
*
AnswerTIDList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDList
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
TIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -2085,7 +2085,7 @@ func (p *AnswerTIDList) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerTIDList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTIDList
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -2112,22 +2112,22 @@ overflow:
// 55. TIDListFrom
func
(
_
*
TIDListFrom
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
TIDListFrom
)
NEOMsgCode
()
uint16
{
return
55
}
func
(
p
*
TIDListFrom
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
TIDListFrom
)
NEO
Msg
EncodedLen
()
int
{
return
24
}
func
(
p
*
TIDListFrom
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
TIDListFrom
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
p
.
Partition
)
}
func
(
p
*
TIDListFrom
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TIDListFrom
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
}
...
...
@@ -2143,15 +2143,15 @@ overflow:
// 56. AnswerTIDListFrom
func
(
_
*
AnswerTIDListFrom
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerTIDListFrom
)
NEOMsgCode
()
uint16
{
return
56
}
func
(
p
*
AnswerTIDListFrom
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerTIDListFrom
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
TidList
)
*
8
}
func
(
p
*
AnswerTIDListFrom
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerTIDListFrom
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
TidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -2164,7 +2164,7 @@ func (p *AnswerTIDListFrom) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerTIDListFrom
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTIDListFrom
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -2191,19 +2191,19 @@ overflow:
// 57. TransactionInformation
func
(
_
*
TransactionInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
TransactionInformation
)
NEOMsgCode
()
uint16
{
return
57
}
func
(
p
*
TransactionInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
TransactionInformation
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
TransactionInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
TransactionInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
TransactionInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TransactionInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -2216,15 +2216,15 @@ overflow:
// 58. AnswerTransactionInformation
func
(
_
*
AnswerTransactionInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerTransactionInformation
)
NEOMsgCode
()
uint16
{
return
58
}
func
(
p
*
AnswerTransactionInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerTransactionInformation
)
NEO
Msg
EncodedLen
()
int
{
return
25
+
len
(
p
.
User
)
+
len
(
p
.
Description
)
+
len
(
p
.
Extension
)
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
AnswerTransactionInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerTransactionInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
{
l
:=
uint32
(
len
(
p
.
User
))
...
...
@@ -2260,7 +2260,7 @@ func (p *AnswerTransactionInformation) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerTransactionInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerTransactionInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -2319,21 +2319,21 @@ overflow:
// 59. ObjectHistory
func
(
_
*
ObjectHistory
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
ObjectHistory
)
NEOMsgCode
()
uint16
{
return
59
}
func
(
p
*
ObjectHistory
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
ObjectHistory
)
NEO
Msg
EncodedLen
()
int
{
return
24
}
func
(
p
*
ObjectHistory
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
ObjectHistory
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
p
.
First
)
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
p
.
Last
)
}
func
(
p
*
ObjectHistory
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ObjectHistory
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
}
...
...
@@ -2348,15 +2348,15 @@ overflow:
// 60. AnswerObjectHistory
func
(
_
*
AnswerObjectHistory
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerObjectHistory
)
NEOMsgCode
()
uint16
{
return
60
}
func
(
p
*
AnswerObjectHistory
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerObjectHistory
)
NEO
Msg
EncodedLen
()
int
{
return
12
+
len
(
p
.
HistoryList
)
*
12
}
func
(
p
*
AnswerObjectHistory
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectHistory
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Oid
))
{
l
:=
uint32
(
len
(
p
.
HistoryList
))
...
...
@@ -2371,7 +2371,7 @@ func (p *AnswerObjectHistory) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerObjectHistory
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerObjectHistory
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -2403,21 +2403,21 @@ overflow:
// 61. PartitionList
func
(
_
*
PartitionList
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
PartitionList
)
NEOMsgCode
()
uint16
{
return
61
}
func
(
p
*
PartitionList
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
PartitionList
)
NEO
Msg
EncodedLen
()
int
{
return
12
}
func
(
p
*
PartitionList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
PartitionList
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
MinOffset
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
MaxOffset
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
}
func
(
p
*
PartitionList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionList
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
}
...
...
@@ -2432,11 +2432,11 @@ overflow:
// 62. AnswerPartitionList
func
(
_
*
AnswerPartitionList
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerPartitionList
)
NEOMsgCode
()
uint16
{
return
62
}
func
(
p
*
AnswerPartitionList
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerPartitionList
)
NEO
Msg
EncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
...
...
@@ -2445,7 +2445,7 @@ func (p *AnswerPartitionList) NEOPktEncodedLen() int {
return
12
+
len
(
p
.
RowList
)
*
8
+
size
}
func
(
p
*
AnswerPartitionList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerPartitionList
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
l
:=
uint32
(
len
(
p
.
RowList
))
...
...
@@ -2470,7 +2470,7 @@ func (p *AnswerPartitionList) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerPartitionList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPartitionList
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -2512,19 +2512,19 @@ overflow:
// 63. NodeList
func
(
_
*
NodeList
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NodeList
)
NEOMsgCode
()
uint16
{
return
63
}
func
(
p
*
NodeList
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NodeList
)
NEO
Msg
EncodedLen
()
int
{
return
4
}
func
(
p
*
NodeList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NodeList
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeType
)))
}
func
(
p
*
NodeList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeList
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -2537,11 +2537,11 @@ overflow:
// 64. AnswerNodeList
func
(
_
*
AnswerNodeList
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerNodeList
)
NEOMsgCode
()
uint16
{
return
64
}
func
(
p
*
AnswerNodeList
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerNodeList
)
NEO
Msg
EncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
a
:=
&
p
.
NodeList
[
i
]
...
...
@@ -2550,7 +2550,7 @@ func (p *AnswerNodeList) NEOPktEncodedLen() int {
return
4
+
len
(
p
.
NodeList
)
*
26
+
size
}
func
(
p
*
AnswerNodeList
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerNodeList
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -2574,7 +2574,7 @@ func (p *AnswerNodeList) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerNodeList
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerNodeList
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -2615,20 +2615,20 @@ overflow:
// 65. SetNodeState
func
(
_
*
SetNodeState
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
SetNodeState
)
NEOMsgCode
()
uint16
{
return
65
}
func
(
p
*
SetNodeState
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
SetNodeState
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
SetNodeState
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
SetNodeState
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
(
p
.
NodeState
)))
}
func
(
p
*
SetNodeState
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
SetNodeState
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -2642,15 +2642,15 @@ overflow:
// 66. AddPendingNodes
func
(
_
*
AddPendingNodes
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AddPendingNodes
)
NEOMsgCode
()
uint16
{
return
66
}
func
(
p
*
AddPendingNodes
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AddPendingNodes
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
AddPendingNodes
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AddPendingNodes
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -2663,7 +2663,7 @@ func (p *AddPendingNodes) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AddPendingNodes
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AddPendingNodes
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -2690,15 +2690,15 @@ overflow:
// 67. TweakPartitionTable
func
(
_
*
TweakPartitionTable
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
TweakPartitionTable
)
NEOMsgCode
()
uint16
{
return
67
}
func
(
p
*
TweakPartitionTable
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
TweakPartitionTable
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
TweakPartitionTable
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
TweakPartitionTable
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -2711,7 +2711,7 @@ func (p *TweakPartitionTable) NEOPktEncode(data []byte) {
}
}
func
(
p
*
TweakPartitionTable
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
TweakPartitionTable
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -2738,11 +2738,11 @@ overflow:
// 68. NotifyNodeInformation
func
(
_
*
NotifyNodeInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NotifyNodeInformation
)
NEOMsgCode
()
uint16
{
return
68
}
func
(
p
*
NotifyNodeInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NotifyNodeInformation
)
NEO
Msg
EncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
NodeList
);
i
++
{
a
:=
&
p
.
NodeList
[
i
]
...
...
@@ -2751,7 +2751,7 @@ func (p *NotifyNodeInformation) NEOPktEncodedLen() int {
return
12
+
len
(
p
.
NodeList
)
*
26
+
size
}
func
(
p
*
NotifyNodeInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NotifyNodeInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
{
l
:=
uint32
(
len
(
p
.
NodeList
))
...
...
@@ -2776,7 +2776,7 @@ func (p *NotifyNodeInformation) NEOPktEncode(data []byte) {
}
}
func
(
p
*
NotifyNodeInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyNodeInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -2818,36 +2818,36 @@ overflow:
// 69. NodeInformation
func
(
_
*
NodeInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NodeInformation
)
NEOMsgCode
()
uint16
{
return
69
}
func
(
p
*
NodeInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NodeInformation
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
NodeInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NodeInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
NodeInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NodeInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 70. SetClusterState
func
(
_
*
SetClusterState
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
SetClusterState
)
NEOMsgCode
()
uint16
{
return
70
}
func
(
p
*
SetClusterState
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
SetClusterState
)
NEO
Msg
EncodedLen
()
int
{
return
4
}
func
(
p
*
SetClusterState
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
SetClusterState
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
func
(
p
*
SetClusterState
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
SetClusterState
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -2860,19 +2860,19 @@ overflow:
// 71. repairFlags
func
(
_
*
repairFlags
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
repairFlags
)
NEOMsgCode
()
uint16
{
return
71
}
func
(
p
*
repairFlags
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
repairFlags
)
NEO
Msg
EncodedLen
()
int
{
return
1
}
func
(
p
*
repairFlags
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
repairFlags
)
NEO
Msg
Encode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
DryRun
)
}
func
(
p
*
repairFlags
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
repairFlags
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
}
...
...
@@ -2885,15 +2885,15 @@ overflow:
// 72. Repair
func
(
_
*
Repair
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Repair
)
NEOMsgCode
()
uint16
{
return
72
}
func
(
p
*
Repair
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Repair
)
NEO
Msg
EncodedLen
()
int
{
return
5
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
Repair
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Repair
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -2907,7 +2907,7 @@ func (p *Repair) NEOPktEncode(data []byte) {
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
}
func
(
p
*
Repair
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Repair
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -2935,19 +2935,19 @@ overflow:
// 73. RepairOne
func
(
_
*
RepairOne
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
RepairOne
)
NEOMsgCode
()
uint16
{
return
73
}
func
(
p
*
RepairOne
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
RepairOne
)
NEO
Msg
EncodedLen
()
int
{
return
1
}
func
(
p
*
RepairOne
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
RepairOne
)
NEO
Msg
Encode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
}
func
(
p
*
RepairOne
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
RepairOne
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
}
...
...
@@ -2960,19 +2960,19 @@ overflow:
// 74. ClusterInformation
func
(
_
*
ClusterInformation
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
ClusterInformation
)
NEOMsgCode
()
uint16
{
return
74
}
func
(
p
*
ClusterInformation
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
ClusterInformation
)
NEO
Msg
EncodedLen
()
int
{
return
4
}
func
(
p
*
ClusterInformation
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
ClusterInformation
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
func
(
p
*
ClusterInformation
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ClusterInformation
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -2985,19 +2985,19 @@ overflow:
// 75. X_ClusterState
func
(
_
*
X_ClusterState
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
X_ClusterState
)
NEOMsgCode
()
uint16
{
return
75
}
func
(
p
*
X_ClusterState
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
X_ClusterState
)
NEO
Msg
EncodedLen
()
int
{
return
4
}
func
(
p
*
X_ClusterState
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
X_ClusterState
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
func
(
p
*
X_ClusterState
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
X_ClusterState
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -3010,15 +3010,15 @@ overflow:
// 76. ObjectUndoSerial
func
(
_
*
ObjectUndoSerial
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
ObjectUndoSerial
)
NEOMsgCode
()
uint16
{
return
76
}
func
(
p
*
ObjectUndoSerial
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
ObjectUndoSerial
)
NEO
Msg
EncodedLen
()
int
{
return
28
+
len
(
p
.
OidList
)
*
8
}
func
(
p
*
ObjectUndoSerial
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
ObjectUndoSerial
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
LTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
UndoneTID
))
...
...
@@ -3034,7 +3034,7 @@ func (p *ObjectUndoSerial) NEOPktEncode(data []byte) {
}
}
func
(
p
*
ObjectUndoSerial
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
ObjectUndoSerial
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
28
{
goto
overflow
...
...
@@ -3064,15 +3064,15 @@ overflow:
// 77. AnswerObjectUndoSerial
func
(
_
*
AnswerObjectUndoSerial
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerObjectUndoSerial
)
NEOMsgCode
()
uint16
{
return
77
}
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Msg
EncodedLen
()
int
{
return
4
+
len
(
p
.
ObjectTIDDict
)
*
25
}
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
ObjectTIDDict
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -3092,7 +3092,7 @@ func (p *AnswerObjectUndoSerial) NEOPktEncode(data []byte) {
}
}
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerObjectUndoSerial
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -3132,21 +3132,21 @@ overflow:
// 78. CheckCurrentSerial
func
(
_
*
CheckCurrentSerial
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CheckCurrentSerial
)
NEOMsgCode
()
uint16
{
return
78
}
func
(
p
*
CheckCurrentSerial
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CheckCurrentSerial
)
NEO
Msg
EncodedLen
()
int
{
return
24
}
func
(
p
*
CheckCurrentSerial
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CheckCurrentSerial
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Serial
))
}
func
(
p
*
CheckCurrentSerial
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckCurrentSerial
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
}
...
...
@@ -3161,19 +3161,19 @@ overflow:
// 79. Pack
func
(
_
*
Pack
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
Pack
)
NEOMsgCode
()
uint16
{
return
79
}
func
(
p
*
Pack
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
Pack
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
Pack
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
Pack
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
Pack
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Pack
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -3186,19 +3186,19 @@ overflow:
// 80. AnswerPack
func
(
_
*
AnswerPack
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerPack
)
NEOMsgCode
()
uint16
{
return
80
}
func
(
p
*
AnswerPack
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerPack
)
NEO
Msg
EncodedLen
()
int
{
return
1
}
func
(
p
*
AnswerPack
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerPack
)
NEO
Msg
Encode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Status
)
}
func
(
p
*
AnswerPack
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerPack
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
}
...
...
@@ -3211,15 +3211,15 @@ overflow:
// 81. CheckReplicas
func
(
_
*
CheckReplicas
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CheckReplicas
)
NEOMsgCode
()
uint16
{
return
81
}
func
(
p
*
CheckReplicas
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CheckReplicas
)
NEO
Msg
EncodedLen
()
int
{
return
20
+
len
(
p
.
PartitionDict
)
*
8
}
func
(
p
*
CheckReplicas
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CheckReplicas
)
NEO
Msg
Encode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
PartitionDict
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
...
...
@@ -3239,7 +3239,7 @@ func (p *CheckReplicas) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
}
func
(
p
*
CheckReplicas
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckReplicas
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
...
...
@@ -3269,15 +3269,15 @@ overflow:
// 82. CheckPartition
func
(
_
*
CheckPartition
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CheckPartition
)
NEOMsgCode
()
uint16
{
return
82
}
func
(
p
*
CheckPartition
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CheckPartition
)
NEO
Msg
EncodedLen
()
int
{
return
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
}
func
(
p
*
CheckPartition
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CheckPartition
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
{
l
:=
uint32
(
len
(
p
.
Source
.
UpstreamName
))
...
...
@@ -3298,7 +3298,7 @@ func (p *CheckPartition) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
10
:
],
uint64
(
p
.
MaxTID
))
}
func
(
p
*
CheckPartition
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckPartition
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
...
...
@@ -3335,22 +3335,22 @@ overflow:
// 83. CheckTIDRange
func
(
_
*
CheckTIDRange
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CheckTIDRange
)
NEOMsgCode
()
uint16
{
return
83
}
func
(
p
*
CheckTIDRange
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CheckTIDRange
)
NEO
Msg
EncodedLen
()
int
{
return
24
}
func
(
p
*
CheckTIDRange
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CheckTIDRange
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
MaxTID
))
}
func
(
p
*
CheckTIDRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckTIDRange
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
}
...
...
@@ -3366,21 +3366,21 @@ overflow:
// 84. AnswerCheckTIDRange
func
(
_
*
AnswerCheckTIDRange
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerCheckTIDRange
)
NEOMsgCode
()
uint16
{
return
84
}
func
(
p
*
AnswerCheckTIDRange
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerCheckTIDRange
)
NEO
Msg
EncodedLen
()
int
{
return
32
}
func
(
p
*
AnswerCheckTIDRange
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
copy
(
data
[
4
:
],
p
.
Checksum
[
:
])
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MaxTID
))
}
func
(
p
*
AnswerCheckTIDRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckTIDRange
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
32
{
goto
overflow
}
...
...
@@ -3395,15 +3395,15 @@ overflow:
// 85. CheckSerialRange
func
(
_
*
CheckSerialRange
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
CheckSerialRange
)
NEOMsgCode
()
uint16
{
return
85
}
func
(
p
*
CheckSerialRange
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
CheckSerialRange
)
NEO
Msg
EncodedLen
()
int
{
return
32
}
func
(
p
*
CheckSerialRange
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
CheckSerialRange
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MinTID
))
...
...
@@ -3411,7 +3411,7 @@ func (p *CheckSerialRange) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MinOID
))
}
func
(
p
*
CheckSerialRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckSerialRange
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
32
{
goto
overflow
}
...
...
@@ -3428,15 +3428,15 @@ overflow:
// 86. AnswerCheckSerialRange
func
(
_
*
AnswerCheckSerialRange
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerCheckSerialRange
)
NEOMsgCode
()
uint16
{
return
86
}
func
(
p
*
AnswerCheckSerialRange
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerCheckSerialRange
)
NEO
Msg
EncodedLen
()
int
{
return
60
}
func
(
p
*
AnswerCheckSerialRange
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Count
)
copy
(
data
[
4
:
],
p
.
TidChecksum
[
:
])
binary
.
BigEndian
.
PutUint64
(
data
[
24
:
],
uint64
(
p
.
MaxTID
))
...
...
@@ -3444,7 +3444,7 @@ func (p *AnswerCheckSerialRange) NEOPktEncode(data []byte) {
binary
.
BigEndian
.
PutUint64
(
data
[
52
:
],
uint64
(
p
.
MaxOID
))
}
func
(
p
*
AnswerCheckSerialRange
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerCheckSerialRange
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
60
{
goto
overflow
}
...
...
@@ -3461,15 +3461,15 @@ overflow:
// 87. PartitionCorrupted
func
(
_
*
PartitionCorrupted
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
PartitionCorrupted
)
NEOMsgCode
()
uint16
{
return
87
}
func
(
p
*
PartitionCorrupted
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
PartitionCorrupted
)
NEO
Msg
EncodedLen
()
int
{
return
8
+
len
(
p
.
CellList
)
*
4
}
func
(
p
*
PartitionCorrupted
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
PartitionCorrupted
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
p
.
Partition
)
{
l
:=
uint32
(
len
(
p
.
CellList
))
...
...
@@ -3483,7 +3483,7 @@ func (p *PartitionCorrupted) NEOPktEncode(data []byte) {
}
}
func
(
p
*
PartitionCorrupted
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
PartitionCorrupted
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
...
...
@@ -3511,36 +3511,36 @@ overflow:
// 88. LastTransaction
func
(
_
*
LastTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
LastTransaction
)
NEOMsgCode
()
uint16
{
return
88
}
func
(
p
*
LastTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
LastTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
LastTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
LastTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
LastTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
LastTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 89. AnswerLastTransaction
func
(
_
*
AnswerLastTransaction
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
AnswerLastTransaction
)
NEOMsgCode
()
uint16
{
return
89
}
func
(
p
*
AnswerLastTransaction
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
AnswerLastTransaction
)
NEO
Msg
EncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerLastTransaction
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
AnswerLastTransaction
)
NEO
Msg
Encode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
}
func
(
p
*
AnswerLastTransaction
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AnswerLastTransaction
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
...
...
@@ -3553,23 +3553,23 @@ overflow:
// 90. NotifyReady
func
(
_
*
NotifyReady
)
NEO
Pkt
MsgCode
()
uint16
{
func
(
_
*
NotifyReady
)
NEOMsgCode
()
uint16
{
return
90
}
func
(
p
*
NotifyReady
)
NEO
Pkt
EncodedLen
()
int
{
func
(
p
*
NotifyReady
)
NEO
Msg
EncodedLen
()
int
{
return
0
}
func
(
p
*
NotifyReady
)
NEO
Pkt
Encode
(
data
[]
byte
)
{
func
(
p
*
NotifyReady
)
NEO
Msg
Encode
(
data
[]
byte
)
{
}
func
(
p
*
NotifyReady
)
NEO
Pkt
Decode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
NotifyReady
)
NEO
Msg
Decode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// registry of
packet
types
var
pkt
TypeRegistry
=
map
[
uint16
]
reflect
.
Type
{
// registry of
message
types
var
msg
TypeRegistry
=
map
[
uint16
]
reflect
.
Type
{
0
:
reflect
.
TypeOf
(
Address
{}),
1
:
reflect
.
TypeOf
(
NodeInfo
{}),
2
:
reflect
.
TypeOf
(
CellInfo
{}),
...
...
go/neo/proto.go
View file @
c2a1b63a
...
...
@@ -110,7 +110,7 @@ const (
// node finishes to replicate it. It means a partition is moved from 1 node
// to another.
FEEDING
//short: F
// Not really a state: only used in network
packet
s to tell storages to drop
// Not really a state: only used in network
message
s to tell storages to drop
// partitions.
DISCARDED
//short: D
// A check revealed that data differs from other replicas. Cell is neither
...
...
@@ -136,24 +136,24 @@ type NodeUUID int32
// TODO NodeType -> base NodeUUID
// ErrDecodeOverflow is the error returned by NEO
Pkt
Decode when decoding hit buffer overflow
// ErrDecodeOverflow is the error returned by NEO
Msg
Decode when decoding hit buffer overflow
var
ErrDecodeOverflow
=
errors
.
New
(
"decode: bufer overflow"
)
//
Pkt is the interface implemented by NEO packet
s to marshal/unmarshal them into/from wire format
type
Pkt
interface
{
// NEO
PktMsgCode returns message code needed to be used for particular packet
type
//
Msg is the interface implemented by NEO message
s to marshal/unmarshal them into/from wire format
type
Msg
interface
{
// NEO
MsgCode returns message code needed to be used for particular message
type
// on the wire
NEO
Pkt
MsgCode
()
uint16
NEOMsgCode
()
uint16
// NEO
PktEncodedLen returns how much space is needed to encode current state
NEO
Pkt
EncodedLen
()
int
// NEO
MsgEncodedLen returns how much space is needed to encode current message payload
NEO
Msg
EncodedLen
()
int
// NEO
PktEncode encodes current
state into buf.
// len(buf) must be >= NEO
Pkt
EncodedLen()
NEO
Pkt
Encode
(
buf
[]
byte
)
// NEO
MsgEncode encodes current message
state into buf.
// len(buf) must be >= NEO
Msg
EncodedLen()
NEO
Msg
Encode
(
buf
[]
byte
)
// NEO
PktDecode decodes data into current packet stat
e.
NEO
Pkt
Decode
(
data
[]
byte
)
(
nread
int
,
err
error
)
// NEO
MsgDecode decodes data into message in-plac
e.
NEO
Msg
Decode
(
data
[]
byte
)
(
nread
int
,
err
error
)
}
...
...
@@ -163,7 +163,7 @@ type Address struct {
}
// NOTE if Host == "" -> Port not added to wire (see py.PAddress):
// func (a *Address) NEO
Pkt
Encode(b []byte) int {
// func (a *Address) NEO
Msg
Encode(b []byte) int {
// n := string_NEOEncode(a.Host, b[0:])
// if a.Host != "" {
// BigEndian.PutUint16(b[n:], a.Port)
...
...
@@ -263,7 +263,7 @@ type Ping struct {
type
CloseClient
struct
{
}
// Request a node identification. This must be the first
packet
for any
// Request a node identification. This must be the first
message
for any
// connection. Any -> Any.
type
RequestIdentification
struct
{
NodeType
NodeType
// XXX name
...
...
go/neo/proto_test.go
View file @
c2a1b63a
...
...
@@ -68,10 +68,10 @@ func TestPktHeader(t *testing.T) {
}
}
// test marshalling for one
packet
type
func
test
PktMarshal
(
t
*
testing
.
T
,
pkt
Pkt
,
encoded
string
)
{
typ
:=
reflect
.
TypeOf
(
pkt
)
.
Elem
()
// type of *pkt
pkt2
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
Pkt
)
// test marshalling for one
message
type
func
test
MsgMarshal
(
t
*
testing
.
T
,
msg
Msg
,
encoded
string
)
{
typ
:=
reflect
.
TypeOf
(
msg
)
.
Elem
()
// type of *msg
msg2
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
Msg
)
defer
func
()
{
if
e
:=
recover
();
e
!=
nil
{
t
.
Errorf
(
"%v: panic ↓↓↓:"
,
typ
)
...
...
@@ -79,10 +79,10 @@ func testPktMarshal(t *testing.T, pkt Pkt, encoded string) {
}
}()
//
pkt
.encode() == expected
msgCode
:=
pkt
.
NEOPkt
MsgCode
()
n
:=
pkt
.
NEOPkt
EncodedLen
()
msgType
:=
pkt
TypeRegistry
[
msgCode
]
//
msg
.encode() == expected
msgCode
:=
msg
.
NEO
MsgCode
()
n
:=
msg
.
NEOMsg
EncodedLen
()
msgType
:=
msg
TypeRegistry
[
msgCode
]
if
msgType
!=
typ
{
t
.
Errorf
(
"%v: msgCode = %v which corresponds to %v"
,
typ
,
msgCode
,
msgType
)
}
...
...
@@ -91,7 +91,7 @@ func testPktMarshal(t *testing.T, pkt Pkt, encoded string) {
}
buf
:=
make
([]
byte
,
n
)
pkt
.
NEOPkt
Encode
(
buf
)
msg
.
NEOMsg
Encode
(
buf
)
if
string
(
buf
)
!=
encoded
{
t
.
Errorf
(
"%v: encode result unexpected:"
,
typ
)
t
.
Errorf
(
"
\t
have: %s"
,
hexpkg
.
EncodeToString
(
buf
))
...
...
@@ -121,13 +121,13 @@ func testPktMarshal(t *testing.T, pkt Pkt, encoded string) {
}
}()
pkt
.
NEOPkt
Encode
(
buf
[
:
l
])
msg
.
NEOMsg
Encode
(
buf
[
:
l
])
}()
}
//
pkt
.decode() == expected
//
msg
.decode() == expected
data
:=
[]
byte
(
encoded
+
"noise"
)
n
,
err
:=
pkt2
.
NEOPkt
Decode
(
data
)
n
,
err
:=
msg2
.
NEOMsg
Decode
(
data
)
if
err
!=
nil
{
t
.
Errorf
(
"%v: decode error %v"
,
typ
,
err
)
}
...
...
@@ -135,13 +135,13 @@ func testPktMarshal(t *testing.T, pkt Pkt, encoded string) {
t
.
Errorf
(
"%v: nread = %v ; want %v"
,
typ
,
n
,
len
(
encoded
))
}
if
!
reflect
.
DeepEqual
(
pkt2
,
pkt
)
{
t
.
Errorf
(
"%v: decode result unexpected: %v ; want %v"
,
typ
,
pkt2
,
pkt
)
if
!
reflect
.
DeepEqual
(
msg2
,
msg
)
{
t
.
Errorf
(
"%v: decode result unexpected: %v ; want %v"
,
typ
,
msg2
,
msg
)
}
// decode must detect buffer overflow
for
l
:=
len
(
encoded
)
-
1
;
l
>=
0
;
l
--
{
n
,
err
=
pkt2
.
NEOPkt
Decode
(
data
[
:
l
])
n
,
err
=
msg2
.
NEOMsg
Decode
(
data
[
:
l
])
if
!
(
n
==
0
&&
err
==
ErrDecodeOverflow
)
{
t
.
Errorf
(
"%v: decode overflow not detected on [:%v]"
,
typ
,
l
)
}
...
...
@@ -149,10 +149,10 @@ func testPktMarshal(t *testing.T, pkt Pkt, encoded string) {
}
}
// test encoding/decoding of
packet
s
func
Test
Pkt
Marshal
(
t
*
testing
.
T
)
{
// test encoding/decoding of
message
s
func
Test
Msg
Marshal
(
t
*
testing
.
T
)
{
var
testv
=
[]
struct
{
pkt
Pkt
msg
Msg
encoded
string
// []byte
}
{
// empty
...
...
@@ -259,25 +259,25 @@ func TestPktMarshal(t *testing.T) {
}
for
_
,
tt
:=
range
testv
{
test
PktMarshal
(
t
,
tt
.
pkt
,
tt
.
encoded
)
test
MsgMarshal
(
t
,
tt
.
msg
,
tt
.
encoded
)
}
}
// For all
packet types: same as testPkt
Marshal but zero-values only
// For all
message types: same as testMsg
Marshal but zero-values only
// this way we additionally lightly check encode / decode overflow behaviour for all types.
func
Test
Pkt
MarshalAllOverflowLightly
(
t
*
testing
.
T
)
{
for
_
,
typ
:=
range
pkt
TypeRegistry
{
func
Test
Msg
MarshalAllOverflowLightly
(
t
*
testing
.
T
)
{
for
_
,
typ
:=
range
msg
TypeRegistry
{
// zero-value for a type
pkt
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
Pkt
)
l
:=
pkt
.
NEOPkt
EncodedLen
()
msg
:=
reflect
.
New
(
typ
)
.
Interface
()
.
(
Msg
)
l
:=
msg
.
NEOMsg
EncodedLen
()
zerol
:=
make
([]
byte
,
l
)
// decoding will turn nil slice & map into empty allocated ones.
// we need it so that reflect.DeepEqual works for
pkt
encode/decode comparison
n
,
err
:=
pkt
.
NEOPkt
Decode
(
zerol
)
// we need it so that reflect.DeepEqual works for
msg
encode/decode comparison
n
,
err
:=
msg
.
NEOMsg
Decode
(
zerol
)
if
!
(
n
==
l
&&
err
==
nil
)
{
t
.
Errorf
(
"%v: zero-decode unexpected: %v, %v ; want %v, nil"
,
typ
,
n
,
err
,
l
)
}
test
PktMarshal
(
t
,
pkt
,
string
(
zerol
))
test
MsgMarshal
(
t
,
msg
,
string
(
zerol
))
}
}
go/neo/protogen.go
View file @
c2a1b63a
...
...
@@ -20,15 +20,15 @@
/*
NEO. Protocol module. Code generator
This program generates marshalling code for
packet
types defined in proto.go .
For every type 4 methods are generated in accordance with neo.
Pkt
interface:
This program generates marshalling code for
message
types defined in proto.go .
For every type 4 methods are generated in accordance with neo.
Msg
interface:
NEO
Pkt
MsgCode() uint16
NEO
Pkt
EncodedLen() int
NEO
Pkt
Encode(buf []byte)
NEO
Pkt
Decode(data []byte) (nread int, err error)
NEOMsgCode() uint16
NEO
Msg
EncodedLen() int
NEO
Msg
Encode(buf []byte)
NEO
Msg
Decode(data []byte) (nread int, err error)
List of
packet
types is obtained via searching through proto.go AST - looking
List of
message
types is obtained via searching through proto.go AST - looking
for appropriate struct declarations there.
Code generation for a type is organized via recursively walking through type's
...
...
@@ -169,11 +169,11 @@ import (
"../zodb"
)`
)
pktTypeRegistry
:=
map
[
int
]
string
{}
// pkt
Code -> typename
msgTypeRegistry
:=
map
[
int
]
string
{}
// msg
Code -> typename
// go over
packet
types declaration and generate marshal code for them
buf
.
emit
(
"//
packet
s marshalling
\n
"
)
pkt
Code
:=
0
// go over
message
types declaration and generate marshal code for them
buf
.
emit
(
"//
message
s marshalling
\n
"
)
msg
Code
:=
0
for
_
,
decl
:=
range
f
.
Decls
{
// we look for types (which can be only under GenDecl)
gendecl
,
ok
:=
decl
.
(
*
ast
.
GenDecl
)
...
...
@@ -195,35 +195,35 @@ import (
continue
case
*
ast
.
StructType
:
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
pkt
Code
,
typename
)
fmt
.
Fprintf
(
&
buf
,
"// %d. %s
\n\n
"
,
msg
Code
,
typename
)
buf
.
emit
(
"func (_ *%s) NEO
Pkt
MsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"return %d"
,
pkt
Code
)
buf
.
emit
(
"func (_ *%s) NEOMsgCode() uint16 {"
,
typename
)
buf
.
emit
(
"return %d"
,
msg
Code
)
buf
.
emit
(
"}
\n
"
)
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
sizer
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
encoder
{}))
buf
.
WriteString
(
generateCodecCode
(
typespec
,
&
decoder
{}))
pktTypeRegistry
[
pkt
Code
]
=
typename
pkt
Code
++
msgTypeRegistry
[
msg
Code
]
=
typename
msg
Code
++
}
}
}
// now generate
packet
types registry
buf
.
emit
(
"
\n
// registry of
packet
types"
)
buf
.
emit
(
"var
pktTypeRegistry = map[uint16]reflect.Type {"
)
// XXX key -> Pkt
Code ?
// now generate
message
types registry
buf
.
emit
(
"
\n
// registry of
message
types"
)
buf
.
emit
(
"var
msgTypeRegistry = map[uint16]reflect.Type {"
)
// XXX key -> Msg
Code ?
// ordered by
pkt
Code
pkt
CodeV
:=
[]
int
{}
for
pktCode
:=
range
pkt
TypeRegistry
{
pktCodeV
=
append
(
pktCodeV
,
pkt
Code
)
// ordered by
msg
Code
msg
CodeV
:=
[]
int
{}
for
msgCode
:=
range
msg
TypeRegistry
{
msgCodeV
=
append
(
msgCodeV
,
msg
Code
)
}
sort
.
Ints
(
pkt
CodeV
)
sort
.
Ints
(
msg
CodeV
)
for
_
,
pktCode
:=
range
pkt
CodeV
{
buf
.
emit
(
"%v: reflect.TypeOf(%v{}),"
,
pktCode
,
pktTypeRegistry
[
pkt
Code
])
for
_
,
msgCode
:=
range
msg
CodeV
{
buf
.
emit
(
"%v: reflect.TypeOf(%v{}),"
,
msgCode
,
msgTypeRegistry
[
msg
Code
])
}
buf
.
emit
(
"}"
)
...
...
@@ -456,21 +456,21 @@ func (o *OverflowCheck) AddExpr(format string, a ...interface{}) {
}
// sizer generates code to compute encoded size of a
packet
// sizer generates code to compute encoded size of a
message
//
// when type is recursively walked, for every case symbolic size is added appropriately.
// in case when it was needed to generate loops, runtime accumulator variable is additionally used.
// result is: symbolic size + (optionally) runtime accumulator.
type
sizer
struct
{
commonCodeGen
size
SymSize
// currently accumulated
packet
size
size
SymSize
// currently accumulated size
}
// encoder generates code to encode a
packet
// encoder generates code to encode a
message
//
// when type is recursively walked, for every case code to update `data[n:]` is generated.
// no overflow checks are generated as by neo.
Pkt
interface provided data
// buffer should have at least payloadLen length returned by NEO
Pkt
EncodedInfo()
// no overflow checks are generated as by neo.
Msg
interface provided data
// buffer should have at least payloadLen length returned by NEO
Msg
EncodedInfo()
// (the size computed by sizer).
//
// the code emitted looks like:
...
...
@@ -479,14 +479,14 @@ type sizer struct {
// encode<typ2>(data[n2:], path2)
// ...
//
// TODO encode have to care in NEO
Pkt
Encode to emit preambule such that bound
// TODO encode have to care in NEO
Msg
Encode to emit preambule such that bound
// checking is performed only once (currenty compiler emits many of them)
type
encoder
struct
{
commonCodeGen
n
int
// current write position in data
}
// decoder generates code to decode a
packet
// decoder generates code to decode a
message
//
// when type is recursively walked, for every case code to decode next item from
// `data[n:]` is generated.
...
...
@@ -527,7 +527,7 @@ var _ CodeGenerator = (*decoder)(nil)
func
(
s
*
sizer
)
generatedCode
()
string
{
code
:=
Buffer
{}
// prologue
code
.
emit
(
"func (%s *%s) NEO
Pkt
EncodedLen() int {"
,
s
.
recvName
,
s
.
typeName
)
code
.
emit
(
"func (%s *%s) NEO
Msg
EncodedLen() int {"
,
s
.
recvName
,
s
.
typeName
)
if
s
.
varUsed
[
"size"
]
{
code
.
emit
(
"var %s int"
,
s
.
var_
(
"size"
))
}
...
...
@@ -548,7 +548,7 @@ func (s *sizer) generatedCode() string {
func
(
e
*
encoder
)
generatedCode
()
string
{
code
:=
Buffer
{}
// prologue
code
.
emit
(
"func (%s *%s) NEO
Pkt
Encode(data []byte) {"
,
e
.
recvName
,
e
.
typeName
)
code
.
emit
(
"func (%s *%s) NEO
Msg
Encode(data []byte) {"
,
e
.
recvName
,
e
.
typeName
)
code
.
Write
(
e
.
buf
.
Bytes
())
...
...
@@ -655,7 +655,7 @@ func (d *decoder) generatedCode() string {
code
:=
Buffer
{}
// prologue
code
.
emit
(
"func (%s *%s) NEO
Pkt
Decode(data []byte) (int, error) {"
,
d
.
recvName
,
d
.
typeName
)
code
.
emit
(
"func (%s *%s) NEO
Msg
Decode(data []byte) (int, error) {"
,
d
.
recvName
,
d
.
typeName
)
if
d
.
varUsed
[
"nread"
]
{
code
.
emit
(
"var %v uint32"
,
d
.
var_
(
"nread"
))
}
...
...
go/neo/server/master.go
View file @
c2a1b63a
...
...
@@ -64,7 +64,7 @@ type Master struct {
type
nodeCome
struct
{
link
*
neo
.
NodeLink
idReq
neo
.
RequestIdentification
// we received this identification request
idResp
chan
neo
.
Pkt
// what we reply (AcceptIdentification | Error)
idResp
chan
neo
.
Msg
// what we reply (AcceptIdentification | Error)
}
// node disconnects
...
...
@@ -701,7 +701,7 @@ func (m *Master) ServeLink(ctx context.Context, link *neo.NodeLink) {
}
// convey identification request to master
idRespCh
:=
make
(
chan
neo
.
Pkt
)
idRespCh
:=
make
(
chan
neo
.
Msg
)
m
.
nodeCome
<-
nodeCome
{
link
,
idReq
,
idRespCh
}
idResp
:=
<-
idRespCh
...
...
@@ -757,7 +757,7 @@ func (m *Master) ServeLink(ctx context.Context, link *neo.NodeLink) {
m
.
stateMu
.
Unlock
()
go
func
()
{
var
pkt
neo
.
Pkt
var
msg
neo
.
Msg
for
{
select
{
...
...
@@ -767,7 +767,7 @@ func (m *Master) ServeLink(ctx context.Context, link *neo.NodeLink) {
return
case
nodeUpdateV
:=
<-
nodeCh
:
pkt
=
&
neo
.
NotifyNodeInformation
{
msg
=
&
neo
.
NotifyNodeInformation
{
IdTimestamp
:
math
.
NaN
(),
// XXX
NodeList
:
nodeUpdateV
,
}
...
...
@@ -776,7 +776,7 @@ func (m *Master) ServeLink(ctx context.Context, link *neo.NodeLink) {
// changed = true
}
err
=
neo
.
EncodeAndSend
(
connNotify
,
pkt
)
err
=
neo
.
EncodeAndSend
(
connNotify
,
msg
)
if
err
!=
nil
{
// XXX err
}
...
...
go/neo/server/storage.go
View file @
c2a1b63a
...
...
@@ -277,7 +277,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *neo.Conn) {
xid
.
TidBefore
=
true
}
var
reply
neo
.
Pkt
var
reply
neo
.
Msg
data
,
tid
,
err
:=
stor
.
zstor
.
Load
(
xid
)
if
err
!=
nil
{
// TODO translate err to NEO protocol error codes
...
...
@@ -299,7 +299,7 @@ func (stor *Storage) ServeClient(ctx context.Context, conn *neo.Conn) {
neo
.
EncodeAndSend
(
conn
,
reply
)
// XXX err
case
*
neo
.
LastTransaction
:
var
reply
neo
.
Pkt
var
reply
neo
.
Msg
lastTid
,
err
:=
stor
.
zstor
.
LastTid
()
if
err
!=
nil
{
...
...
go/neo/x_connection.go
View file @
c2a1b63a
...
...
@@ -10,9 +10,9 @@ import (
"lab.nexedi.com/kirr/go123/xerr"
)
// Recv
AndDecode receives packet from conn and decodes
it
func
RecvAndDecode
(
conn
*
Conn
)
(
Pkt
,
error
)
{
pkt
,
err
:=
conn
.
Recv
()
// Recv
receives packet and decodes message from
it
func
RecvAndDecode
(
conn
*
Conn
)
(
Msg
,
error
)
{
pkt
,
err
:=
conn
.
recvPkt
()
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -20,7 +20,7 @@ func RecvAndDecode(conn *Conn) (Pkt, error) {
// decode packet
pkth
:=
pkt
.
Header
()
msgCode
:=
ntoh16
(
pkth
.
MsgCode
)
msgType
:=
pkt
TypeRegistry
[
msgCode
]
msgType
:=
msg
TypeRegistry
[
msgCode
]
if
msgType
==
nil
{
err
=
fmt
.
Errorf
(
"invalid msgCode (%d)"
,
msgCode
)
// XXX -> ProtoError ?
...
...
@@ -28,47 +28,47 @@ func RecvAndDecode(conn *Conn) (Pkt, error) {
}
// TODO use free-list for decoded packets + when possible decode in-place
pktObj
:=
reflect
.
New
(
msgType
)
.
Interface
()
.
(
Pkt
)
_
,
err
=
pktObj
.
NEOPkt
Decode
(
pkt
.
Payload
())
msg
:=
reflect
.
New
(
msgType
)
.
Interface
()
.
(
Msg
)
_
,
err
=
msg
.
NEOMsg
Decode
(
pkt
.
Payload
())
if
err
!=
nil
{
// XXX -> ProtoError ?
return
nil
,
&
ConnError
{
Conn
:
conn
,
Op
:
"decode"
,
Err
:
err
}
}
return
pktObj
,
nil
return
msg
,
nil
}
// EncodeAndSend encodes
pkt and sends it to conn
func
EncodeAndSend
(
conn
*
Conn
,
pkt
Pkt
)
error
{
l
:=
pkt
.
NEOPkt
EncodedLen
()
// EncodeAndSend encodes
message into packet and sends it
func
EncodeAndSend
(
conn
*
Conn
,
msg
Msg
)
error
{
l
:=
msg
.
NEOMsg
EncodedLen
()
buf
:=
PktBuf
{
make
([]
byte
,
PktHeadLen
+
l
)}
// XXX -> freelist
h
:=
buf
.
Header
()
// h.ConnId will be set by conn.Send
h
.
MsgCode
=
hton16
(
pkt
.
NEOPkt
MsgCode
())
h
.
MsgCode
=
hton16
(
msg
.
NEO
MsgCode
())
h
.
MsgLen
=
hton32
(
uint32
(
l
))
// XXX casting: think again
pkt
.
NEOPkt
Encode
(
buf
.
Payload
())
msg
.
NEOMsg
Encode
(
buf
.
Payload
())
return
conn
.
Send
(
&
buf
)
// XXX why pointer?
return
conn
.
sendPkt
(
&
buf
)
// XXX why pointer?
}
// Ask does simple request/response protocol exchange
// It expects the answer to be exactly of resp type and errors otherwise
func
Ask
(
conn
*
Conn
,
req
Pkt
,
resp
Pkt
)
error
{
func
Ask
(
conn
*
Conn
,
req
Msg
,
resp
Msg
)
error
{
err
:=
EncodeAndSend
(
conn
,
req
)
if
err
!=
nil
{
return
err
}
err
=
Expect
(
conn
,
resp
)
err
=
Expect
(
conn
,
resp
)
// XXX +Error
return
err
}
// ProtoError is returned when there wa
a
a protocol error, like receiving
// ProtoError is returned when there wa
s
a protocol error, like receiving
// unexpected packet or packet with wrong header
//
XXX -> ConnError{Op: "decode"} ?
//
FIXME -> ConnError{Op: "decode"}
type
ProtoError
struct
{
Conn
*
Conn
Err
error
...
...
@@ -80,8 +80,8 @@ func (e *ProtoError) Error() string {
// Expect receives 1 packet and expects it to be exactly of msg type
// XXX naming (-> Recv1 ?)
func
Expect
(
conn
*
Conn
,
msg
Pkt
)
(
err
error
)
{
pkt
,
err
:=
conn
.
Recv
()
func
Expect
(
conn
*
Conn
,
msg
Msg
)
(
err
error
)
{
pkt
,
err
:=
conn
.
recvPkt
()
if
err
!=
nil
{
return
err
}
...
...
@@ -92,11 +92,11 @@ func Expect(conn *Conn, msg Pkt) (err error) {
pkth
:=
pkt
.
Header
()
msgCode
:=
ntoh16
(
pkth
.
MsgCode
)
if
msgCode
!=
msg
.
NEO
Pkt
MsgCode
()
{
if
msgCode
!=
msg
.
NEOMsgCode
()
{
// unexpected Error response
if
msgCode
==
(
&
Error
{})
.
NEO
Pkt
MsgCode
()
{
if
msgCode
==
(
&
Error
{})
.
NEOMsgCode
()
{
errResp
:=
Error
{}
_
,
err
=
errResp
.
NEO
Pkt
Decode
(
pkt
.
Payload
())
_
,
err
=
errResp
.
NEO
Msg
Decode
(
pkt
.
Payload
())
if
err
!=
nil
{
return
&
ProtoError
{
conn
,
err
}
}
...
...
@@ -108,7 +108,7 @@ func Expect(conn *Conn, msg Pkt) (err error) {
return
ErrDecode
(
&
errResp
)
// XXX err ctx vs ^^^ errcontextf ?
}
msgType
:=
pkt
TypeRegistry
[
msgCode
]
msgType
:=
msg
TypeRegistry
[
msgCode
]
if
msgType
==
nil
{
return
&
ProtoError
{
conn
,
fmt
.
Errorf
(
"invalid msgCode (%d)"
,
msgCode
)}
}
...
...
@@ -116,7 +116,7 @@ func Expect(conn *Conn, msg Pkt) (err error) {
return
&
ProtoError
{
conn
,
fmt
.
Errorf
(
"unexpected packet: %v"
,
msgType
)}
}
_
,
err
=
msg
.
NEO
Pkt
Decode
(
pkt
.
Payload
())
_
,
err
=
msg
.
NEO
Msg
Decode
(
pkt
.
Payload
())
if
err
!=
nil
{
return
&
ProtoError
{
conn
,
err
}
}
...
...
Kirill Smelkov
@kirr
mentioned in commit
64513925
·
Jul 12, 2018
mentioned in commit
64513925
mentioned in commit 6451392565728c599c98fbd0b859401827c560b9
Toggle commit list
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