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
1584a56f
Commit
1584a56f
authored
Jan 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e844649f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
+21
-0
t/neo/marshal.go
t/neo/marshal.go
+18
-0
t/neo/proto_test.go
t/neo/proto_test.go
+2
-0
t/neo/protogen.go
t/neo/protogen.go
+1
-0
No files found.
t/neo/marshal.go
View file @
1584a56f
...
@@ -23,6 +23,7 @@ func (p *Address) NEOEncode(data []byte) {
...
@@ -23,6 +23,7 @@ func (p *Address) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Host
)
copy
(
data
,
p
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Port
)
}
}
...
@@ -65,6 +66,7 @@ func (p *NodeInfo) NEOEncode(data []byte) {
...
@@ -65,6 +66,7 @@ func (p *NodeInfo) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
copy
(
data
,
p
.
Address
.
Host
)
copy
(
data
,
p
.
Address
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
(
p
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
(
p
.
UUID
)))
...
@@ -190,6 +192,7 @@ func (p *Notify) NEOEncode(data []byte) {
...
@@ -190,6 +192,7 @@ func (p *Notify) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Message
)
copy
(
data
,
p
.
Message
)
data
=
data
[
l
:
]
}
}
}
}
...
@@ -230,6 +233,7 @@ func (p *Error) NEOEncode(data []byte) {
...
@@ -230,6 +233,7 @@ func (p *Error) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
copy
(
data
,
p
.
Message
)
copy
(
data
,
p
.
Message
)
data
=
data
[
l
:
]
}
}
}
}
...
@@ -315,6 +319,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
...
@@ -315,6 +319,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
12
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
12
:
],
l
)
data
=
data
[
16
:
]
data
=
data
[
16
:
]
copy
(
data
,
p
.
Address
.
Host
)
copy
(
data
,
p
.
Address
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Address
.
Port
)
{
{
...
@@ -322,6 +327,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
...
@@ -322,6 +327,7 @@ func (p *RequestIdentification) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
l
)
data
=
data
[
6
:
]
data
=
data
[
6
:
]
copy
(
data
,
p
.
Name
)
copy
(
data
,
p
.
Name
)
data
=
data
[
l
:
]
}
}
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
float64_NEOEncode
(
data
[
0
:
],
p
.
IdTimestamp
)
}
}
...
@@ -395,6 +401,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
...
@@ -395,6 +401,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
l
)
data
=
data
[
24
:
]
data
=
data
[
24
:
]
copy
(
data
,
p
.
Primary
.
Host
)
copy
(
data
,
p
.
Primary
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Primary
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Primary
.
Port
)
{
{
...
@@ -408,6 +415,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
...
@@ -408,6 +415,7 @@ func (p *AcceptIdentification) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
...
@@ -1669,18 +1677,21 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
...
@@ -1669,18 +1677,21 @@ func (p *StoreTransaction) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
copy
(
data
,
p
.
User
)
copy
(
data
,
p
.
User
)
data
=
data
[
l
:
]
}
}
{
{
l
:=
uint32
(
len
(
p
.
Description
))
l
:=
uint32
(
len
(
p
.
Description
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Description
)
copy
(
data
,
p
.
Description
)
data
=
data
[
l
:
]
}
}
{
{
l
:=
uint32
(
len
(
p
.
Extension
))
l
:=
uint32
(
len
(
p
.
Extension
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Extension
)
copy
(
data
,
p
.
Extension
)
data
=
data
[
l
:
]
}
}
{
{
l
:=
uint32
(
len
(
p
.
OidList
))
l
:=
uint32
(
len
(
p
.
OidList
))
...
@@ -2100,18 +2111,21 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
...
@@ -2100,18 +2111,21 @@ func (p *AnswerTransactionInformation) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
l
)
data
=
data
[
12
:
]
data
=
data
[
12
:
]
copy
(
data
,
p
.
User
)
copy
(
data
,
p
.
User
)
data
=
data
[
l
:
]
}
}
{
{
l
:=
uint32
(
len
(
p
.
Description
))
l
:=
uint32
(
len
(
p
.
Description
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Description
)
copy
(
data
,
p
.
Description
)
data
=
data
[
l
:
]
}
}
{
{
l
:=
uint32
(
len
(
p
.
Extension
))
l
:=
uint32
(
len
(
p
.
Extension
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Extension
)
copy
(
data
,
p
.
Extension
)
data
=
data
[
l
:
]
}
}
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Packed
)
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Packed
)
{
{
...
@@ -2425,6 +2439,7 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
...
@@ -2425,6 +2439,7 @@ func (p *AnswerNodeList) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
...
@@ -2626,6 +2641,7 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
...
@@ -2626,6 +2641,7 @@ func (p *NotifyNodeInformation) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
copy
(
data
,
(
*
a
)
.
Address
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
(
*
a
)
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
2
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
...
@@ -3091,12 +3107,14 @@ func (p *CheckPartition) NEOEncode(data []byte) {
...
@@ -3091,12 +3107,14 @@ func (p *CheckPartition) NEOEncode(data []byte) {
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
l
)
data
=
data
[
8
:
]
data
=
data
[
8
:
]
copy
(
data
,
p
.
Source
.
UpstreamName
)
copy
(
data
,
p
.
Source
.
UpstreamName
)
data
=
data
[
l
:
]
}
}
{
{
l
:=
uint32
(
len
(
p
.
Source
.
Address
.
Host
))
l
:=
uint32
(
len
(
p
.
Source
.
Address
.
Host
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
data
=
data
[
4
:
]
copy
(
data
,
p
.
Source
.
Address
.
Host
)
copy
(
data
,
p
.
Source
.
Address
.
Host
)
data
=
data
[
l
:
]
}
}
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Source
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint16
(
data
[
0
:
],
p
.
Source
.
Address
.
Port
)
binary
.
BigEndian
.
PutUint64
(
data
[
2
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
2
:
],
uint64
(
p
.
MinTID
))
...
...
t/neo/proto_test.go
View file @
1584a56f
...
@@ -167,6 +167,7 @@ func TestPktMarshal(t *testing.T) {
...
@@ -167,6 +167,7 @@ func TestPktMarshal(t *testing.T) {
hex
(
"00000007000000030000000b000000040000000f000000030000001700000000"
),
hex
(
"00000007000000030000000b000000040000000f000000030000001700000000"
),
},
},
/*
// map[Oid]struct {Tid,Tid,bool}
// map[Oid]struct {Tid,Tid,bool}
{&AnswerObjectUndoSerial{
{&AnswerObjectUndoSerial{
ObjectTIDDict: map[Oid]struct{
ObjectTIDDict: map[Oid]struct{
...
@@ -186,6 +187,7 @@ func TestPktMarshal(t *testing.T) {
...
@@ -186,6 +187,7 @@ func TestPktMarshal(t *testing.T) {
u64(8) + u64(7) + u64(1) + hex("00") +
u64(8) + u64(7) + u64(1) + hex("00") +
u64(5) + u64(4) + u64(3) + hex("01"),
u64(5) + u64(4) + u64(3) + hex("01"),
},
},
*/
// uint32, []uint32
// uint32, []uint32
{
&
PartitionCorrupted
{
7
,
[]
UUID
{
1
,
3
,
9
,
4
}},
{
&
PartitionCorrupted
{
7
,
[]
UUID
{
1
,
3
,
9
,
4
}},
...
...
t/neo/protogen.go
View file @
1584a56f
...
@@ -289,6 +289,7 @@ func (e *encoder) genStrBytes(path string) {
...
@@ -289,6 +289,7 @@ func (e *encoder) genStrBytes(path string) {
if
!
e
.
SizeOnly
{
if
!
e
.
SizeOnly
{
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
e
.
emit
(
"data = data[%v:]"
,
e
.
n
)
e
.
emit
(
"copy(data, %v)"
,
path
)
e
.
emit
(
"copy(data, %v)"
,
path
)
e
.
emit
(
"data = data[l:]"
)
}
else
{
}
else
{
e
.
emit
(
"size += %v + l"
,
e
.
n
)
e
.
emit
(
"size += %v + l"
,
e
.
n
)
}
}
...
...
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