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
c60e82ea
Commit
c60e82ea
authored
Dec 28, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bb67fa9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
t/neo/marshal.go
t/neo/marshal.go
+3
-3
t/neo/protogen.go
t/neo/protogen.go
+4
-2
No files found.
t/neo/marshal.go
View file @
c60e82ea
...
@@ -318,7 +318,7 @@ func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
...
@@ -318,7 +318,7 @@ func (p *AnswerLockedTransactions) NEODecode(data []byte) (int, error) {
p
.
TidDict
=
make
(
map
[
Tid
]
Tid
,
l
)
p
.
TidDict
=
make
(
map
[
Tid
]
Tid
,
l
)
m
:=
p
.
TidDict
m
:=
p
.
TidDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
key
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
key
:
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
m
[
key
]
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
m
[
key
]
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
data
=
data
[
16
:
]
data
=
data
[
16
:
]
}
}
...
@@ -874,7 +874,7 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
...
@@ -874,7 +874,7 @@ func (p *AnswerObjectUndoSerial) NEODecode(data []byte) (int, error) {
},
l
)
},
l
)
m
:=
p
.
ObjectTIDDict
m
:=
p
.
ObjectTIDDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
key
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
key
:
=
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
m
[
key
]
.
CurrentSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
m
[
key
]
.
CurrentSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
m
[
key
]
.
UndoSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
m
[
key
]
.
UndoSerial
=
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
m
[
key
]
.
IsCurrent
=
byte2bool
((
data
[
24
:
])[
0
])
m
[
key
]
.
IsCurrent
=
byte2bool
((
data
[
24
:
])[
0
])
...
@@ -927,7 +927,7 @@ func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
...
@@ -927,7 +927,7 @@ func (p *CheckReplicas) NEODecode(data []byte) (int, error) {
p
.
PartitionDict
=
make
(
map
[
uint32
]
UUID
,
l
)
p
.
PartitionDict
=
make
(
map
[
uint32
]
UUID
,
l
)
m
:=
p
.
PartitionDict
m
:=
p
.
PartitionDict
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
key
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
key
:
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
m
[
key
]
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
m
[
key
]
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
data
=
data
[
8
:
]
data
=
data
[
8
:
]
}
}
...
...
t/neo/protogen.go
View file @
c60e82ea
...
@@ -250,7 +250,7 @@ func (d *decoder) emitmap(assignto string, obj types.Object, typ *types.Map) {
...
@@ -250,7 +250,7 @@ func (d *decoder) emitmap(assignto string, obj types.Object, typ *types.Map) {
//d.emit("if len(data) < l { return 0, ErrDecodeOverflow }")
//d.emit("if len(data) < l { return 0, ErrDecodeOverflow }")
d
.
emit
(
"m := %v"
,
assignto
)
d
.
emit
(
"m := %v"
,
assignto
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
emit
(
"for i := 0; uint32(i) < l; i++ {"
)
d
.
emitobjtype
(
"key
"
,
obj
,
typ
.
Key
())
// TODO -> :=
d
.
emitobjtype
(
"key
:"
,
obj
,
typ
.
Key
())
d
.
emitobjtype
(
"m[key]"
,
obj
,
typ
.
Elem
())
d
.
emitobjtype
(
"m[key]"
,
obj
,
typ
.
Elem
())
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
// FIXME wrt map of map ?
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
// FIXME wrt map of map ?
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
...
@@ -275,7 +275,9 @@ func (d *decoder) emitobjtype(assignto string, obj types.Object, typ types.Type)
...
@@ -275,7 +275,9 @@ func (d *decoder) emitobjtype(assignto string, obj types.Object, typ types.Type)
// -> need to cast
// -> need to cast
decoded
=
fmt
.
Sprintf
(
"%v(%v)"
,
typeName
(
typ
),
decoded
)
decoded
=
fmt
.
Sprintf
(
"%v(%v)"
,
typeName
(
typ
),
decoded
)
}
}
d
.
emit
(
"%s = %s"
,
assignto
,
decoded
)
// NOTE no space before "=" - to be able to merge with ":"
// prefix and become defining assignment
d
.
emit
(
"%s= %s"
,
assignto
,
decoded
)
case
*
types
.
Array
:
case
*
types
.
Array
:
// TODO optimize for [...]byte
// TODO optimize for [...]byte
...
...
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