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
2571af8d
Commit
2571af8d
authored
Jan 15, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bee7e8f5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
20 deletions
+19
-20
go/neo/proto/msgpack.go
go/neo/proto/msgpack.go
+5
-4
go/neo/proto/protogen.go
go/neo/proto/protogen.go
+1
-3
go/neo/proto/zproto-marshal.go
go/neo/proto/zproto-marshal.go
+13
-13
No files found.
go/neo/proto/msgpack.go
View file @
2571af8d
...
...
@@ -58,13 +58,14 @@ func (e *mdecodeError) Error() string {
// mOpError represents decode error when decoder faces unexpected operation.
type
mOpError
struct
{
op
,
opOk
msgpack
.
Op
// op we got and what was expected
op
msgpack
.
Op
// op we got
expectedv
[]
msgpack
.
Op
// expected was any op from expectedv
}
func
(
e
*
mOpError
)
Error
()
string
{
return
fmt
.
Sprintf
(
"
expected opcode %02x; got %02x"
,
e
.
opOk
,
e
.
op
)
return
fmt
.
Sprintf
(
"
got opcode %02x; expected any from %02x"
,
e
.
op
,
e
.
expectedv
)
}
func
mdecodeOpErr
(
path
string
,
op
,
opOk
msgpack
.
Op
)
error
{
return
mdecodeErr
(
path
+
"/op"
,
&
mOpError
{
op
,
opOk
})
func
mdecodeOpErr
(
path
string
,
op
msgpack
.
Op
,
expectedv
...
msgpack
.
Op
)
error
{
return
mdecodeErr
(
path
+
"/op"
,
&
mOpError
{
op
,
expectedv
})
}
// mLen8Error represents decode error when decoder faces unexpected length in Bin8.
...
...
go/neo/proto/protogen.go
View file @
2571af8d
...
...
@@ -1161,11 +1161,9 @@ func (d *decoderM) genBasic(assignto string, typ *types.Basic, userType types.Ty
case
types
.
Bool
:
// XXX move -> mgetbool ?
d
.
emit
(
"switch op := msgpack.Op(data[%v]); op {"
,
d
.
n
)
// XXX vvv False also ok
d
.
emit
(
"default: return 0, mdecodeOpErr(%q, op, msgpack.True)"
,
d
.
pathName
(
assignto
))
d
.
emit
(
"default: return 0, mdecodeOpErr(%q, op, msgpack.True, msgpack.False)"
,
d
.
pathName
(
assignto
))
d
.
emit
(
"case msgpack.True: %s = true"
,
assignto
)
d
.
emit
(
"case msgpack.False: %s = false"
,
assignto
)
// XXX also support 0|1 ?
d
.
emit
(
"}"
)
d
.
n
++
...
...
go/neo/proto/zproto-marshal.go
View file @
2571af8d
...
...
@@ -2177,7 +2177,7 @@ func (p *StartOperation) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
1
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"StartOperation.Backup"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"StartOperation.Backup"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Backup
=
true
case
msgpack
.
False
:
...
...
@@ -4172,7 +4172,7 @@ func (p *AnswerRebaseObject) neoMsgDecodeM(data []byte) (int, error) {
p
.
ConflictSerial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
13
:
]))
switch
op
:=
msgpack
.
Op
(
data
[
21
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AnswerRebaseObject.Compression"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AnswerRebaseObject.Compression"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Compression
=
true
case
msgpack
.
False
:
...
...
@@ -4311,7 +4311,7 @@ func (p *StoreObject) neoMsgDecodeM(data []byte) (int, error) {
p
.
Serial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
13
:
]))
switch
op
:=
msgpack
.
Op
(
data
[
21
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"StoreObject.Compression"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"StoreObject.Compression"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Compression
=
true
case
msgpack
.
False
:
...
...
@@ -5081,7 +5081,7 @@ func (p *AnswerObject) neoMsgDecodeM(data []byte) (int, error) {
p
.
NextSerial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
23
:
]))
switch
op
:=
msgpack
.
Op
(
data
[
31
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AnswerObject.Compression"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AnswerObject.Compression"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Compression
=
true
case
msgpack
.
False
:
...
...
@@ -5571,7 +5571,7 @@ func (p *AnswerTransactionInformation) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
0
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AnswerTransactionInformation.Packed"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AnswerTransactionInformation.Packed"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Packed
=
true
case
msgpack
.
False
:
...
...
@@ -6753,7 +6753,7 @@ func (p *TweakPartitionTable) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
1
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"TweakPartitionTable.DryRun"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"TweakPartitionTable.DryRun"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
DryRun
=
true
case
msgpack
.
False
:
...
...
@@ -6921,7 +6921,7 @@ func (p *AnswerTweakPartitionTable) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
1
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AnswerTweakPartitionTable.Changed"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AnswerTweakPartitionTable.Changed"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Changed
=
true
case
msgpack
.
False
:
...
...
@@ -7241,7 +7241,7 @@ func (p *Repair) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
1
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"Repair.repairFlags.DryRun"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"Repair.repairFlags.DryRun"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
repairFlags
.
DryRun
=
true
case
msgpack
.
False
:
...
...
@@ -7300,7 +7300,7 @@ func (p *RepairOne) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
2
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"RepairOne.repairFlags.DryRun"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"RepairOne.repairFlags.DryRun"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
repairFlags
.
DryRun
=
true
case
msgpack
.
False
:
...
...
@@ -7783,7 +7783,7 @@ func (p *AnswerObjectUndoSerial) neoMsgDecodeM(data []byte) (int, error) {
mv
.
UndoSerial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
23
:
]))
switch
op
:=
msgpack
.
Op
(
data
[
31
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AnswerObjectUndoSerial.IsCurrent"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AnswerObjectUndoSerial.IsCurrent"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
mv
.
IsCurrent
=
true
case
msgpack
.
False
:
...
...
@@ -8105,7 +8105,7 @@ func (p *AnswerPack) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
1
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AnswerPack.Status"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AnswerPack.Status"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Status
=
true
case
msgpack
.
False
:
...
...
@@ -10590,7 +10590,7 @@ func (p *AddTransaction) neoMsgDecodeM(data []byte) (int, error) {
}
switch
op
:=
msgpack
.
Op
(
data
[
0
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AddTransaction.Packed"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AddTransaction.Packed"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Packed
=
true
case
msgpack
.
False
:
...
...
@@ -10738,7 +10738,7 @@ func (p *AddObject) neoMsgDecodeM(data []byte) (int, error) {
p
.
Serial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
13
:
]))
switch
op
:=
msgpack
.
Op
(
data
[
21
]);
op
{
default
:
return
0
,
mdecodeOpErr
(
"AddObject.Compression"
,
op
,
msgpack
.
True
)
return
0
,
mdecodeOpErr
(
"AddObject.Compression"
,
op
,
msgpack
.
True
,
msgpack
.
False
)
case
msgpack
.
True
:
p
.
Compression
=
true
case
msgpack
.
False
:
...
...
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