Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
ce695ff1
Commit
ce695ff1
authored
Jan 20, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dbfa81a6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
22 deletions
+20
-22
t/neo/marshal.go
t/neo/marshal.go
+3
-12
t/neo/protogen.go
t/neo/protogen.go
+17
-10
No files found.
t/neo/marshal.go
View file @
ce695ff1
...
@@ -1007,10 +1007,7 @@ func (p *AnswerLockedTransactions) NEOEncodedLen() int {
...
@@ -1007,10 +1007,7 @@ func (p *AnswerLockedTransactions) NEOEncodedLen() int {
l
:=
uint32
(
len
(
p
.
TidDict
))
l
:=
uint32
(
len
(
p
.
TidDict
))
_
=
l
_
=
l
size
+=
4
size
+=
4
for
key
:=
range
p
.
TidDict
{
size
+=
l
*
16
_
=
key
size
+=
16
}
}
}
return
int
(
size
)
+
0
return
int
(
size
)
+
0
}
}
...
@@ -2758,10 +2755,7 @@ func (p *AnswerObjectUndoSerial) NEOEncodedLen() int {
...
@@ -2758,10 +2755,7 @@ func (p *AnswerObjectUndoSerial) NEOEncodedLen() int {
l
:=
uint32
(
len
(
p
.
ObjectTIDDict
))
l
:=
uint32
(
len
(
p
.
ObjectTIDDict
))
_
=
l
_
=
l
size
+=
4
size
+=
4
for
key
:=
range
p
.
ObjectTIDDict
{
size
+=
l
*
25
_
=
key
size
+=
25
}
}
}
return
int
(
size
)
+
0
return
int
(
size
)
+
0
}
}
...
@@ -2966,10 +2960,7 @@ func (p *CheckReplicas) NEOEncodedLen() int {
...
@@ -2966,10 +2960,7 @@ func (p *CheckReplicas) NEOEncodedLen() int {
l
:=
uint32
(
len
(
p
.
PartitionDict
))
l
:=
uint32
(
len
(
p
.
PartitionDict
))
_
=
l
_
=
l
size
+=
4
size
+=
4
for
key
:=
range
p
.
PartitionDict
{
size
+=
l
*
8
_
=
key
size
+=
8
}
}
}
return
int
(
size
)
+
16
return
int
(
size
)
+
16
}
}
...
...
t/neo/protogen.go
View file @
ce695ff1
...
@@ -407,7 +407,8 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
...
@@ -407,7 +407,8 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
e
.
emit
(
"size += %v"
,
e
.
n
)
e
.
emit
(
"size += %v"
,
e
.
n
)
}
}
e
.
n
=
0
e
.
n
=
0
// TODO if size(item)==const - size update in one go
keySize
,
keyFixed
:=
typeSizeFixed
(
typ
.
Key
())
elemSize
,
elemFixed
:=
typeSizeFixed
(
typ
.
Elem
())
if
!
e
.
SizeOnly
{
if
!
e
.
SizeOnly
{
// output keys in sorted order on the wire
// output keys in sorted order on the wire
// (easier for debugging & deterministic for testing)
// (easier for debugging & deterministic for testing)
...
@@ -417,9 +418,14 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
...
@@ -417,9 +418,14 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
e
.
emit
(
"}"
)
e
.
emit
(
"}"
)
e
.
emit
(
"sort.Slice(keyv, func (i, j int) bool { return keyv[i] < keyv[j] })"
)
e
.
emit
(
"sort.Slice(keyv, func (i, j int) bool { return keyv[i] < keyv[j] })"
)
e
.
emit
(
"for _, key := range keyv {"
)
e
.
emit
(
"for _, key := range keyv {"
)
}
else
{
if
keyFixed
&&
elemFixed
{
e
.
emit
(
"size += l * %v"
,
keySize
+
elemSize
)
}
else
{
}
else
{
e
.
emit
(
"for key := range %s {"
,
path
)
e
.
emit
(
"for key := range %s {"
,
path
)
}
}
}
if
!
(
e
.
SizeOnly
&&
keyFixed
&&
elemFixed
)
{
codegenType
(
"key"
,
typ
.
Key
(),
obj
,
e
)
codegenType
(
"key"
,
typ
.
Key
(),
obj
,
e
)
codegenType
(
fmt
.
Sprintf
(
"%s[key]"
,
path
),
typ
.
Elem
(),
obj
,
e
)
codegenType
(
fmt
.
Sprintf
(
"%s[key]"
,
path
),
typ
.
Elem
(),
obj
,
e
)
if
!
e
.
SizeOnly
{
if
!
e
.
SizeOnly
{
...
@@ -429,6 +435,7 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
...
@@ -429,6 +435,7 @@ func (e *encoder) genMap(path string, typ *types.Map, obj types.Object) {
e
.
emit
(
"size += %v"
,
e
.
n
)
e
.
emit
(
"size += %v"
,
e
.
n
)
}
}
e
.
emit
(
"}"
)
e
.
emit
(
"}"
)
}
// XXX vvv ?
// XXX vvv ?
e
.
emit
(
"}"
)
e
.
emit
(
"}"
)
e
.
n
=
0
e
.
n
=
0
...
...
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