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
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
20cacd14
Commit
20cacd14
authored
Nov 01, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/neo/proto: tweak += dry-run
This corresponds to NEO/py commit
2a27239d
(tweak: add option to simulate).
parent
789c16d3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
95 additions
and
7 deletions
+95
-7
go/neo/proto/proto.go
go/neo/proto/proto.go
+6
-0
go/neo/proto/zproto-marshal.go
go/neo/proto/zproto-marshal.go
+88
-7
go/neo/proto/ztestdata_proto_py_test.go
go/neo/proto/ztestdata_proto_py_test.go
+1
-0
No files found.
go/neo/proto/proto.go
View file @
20cacd14
...
...
@@ -846,11 +846,17 @@ type AddPendingNodes struct {
//
//neo:nodes ctl -> A -> M
type
TweakPartitionTable
struct
{
DryRun
bool
NodeList
[]
NodeUUID
// answer = Error
}
type
AnswerTweakPartitionTable
struct
{
Changed
bool
RowList
[]
RowInfo
}
// Set the number of replicas.
//
//neo:nodes ctl -> A -> M
...
...
go/neo/proto/zproto-marshal.go
View file @
20cacd14
...
...
@@ -2639,14 +2639,15 @@ func (*TweakPartitionTable) NEOMsgCode() uint16 {
}
func
(
p
*
TweakPartitionTable
)
NEOMsgEncodedLen
()
int
{
return
4
+
len
(
p
.
NodeList
)
*
4
return
5
+
len
(
p
.
NodeList
)
*
4
}
func
(
p
*
TweakPartitionTable
)
NEOMsgEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
DryRun
)
{
l
:=
uint32
(
len
(
p
.
NodeList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
binary
.
BigEndian
.
PutUint32
(
data
[
1
:
],
l
)
data
=
data
[
5
:
]
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
NodeList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
...
...
@@ -2657,12 +2658,13 @@ func (p *TweakPartitionTable) NEOMsgEncode(data []byte) {
func
(
p
*
TweakPartitionTable
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint64
if
len
(
data
)
<
4
{
if
len
(
data
)
<
5
{
goto
overflow
}
p
.
DryRun
=
byte2bool
((
data
[
0
:
0
+
1
])[
0
])
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
0
+
4
])
data
=
data
[
4
:
]
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
1
:
1
+
4
])
data
=
data
[
5
:
]
if
uint64
(
len
(
data
))
<
uint64
(
l
)
*
4
{
goto
overflow
}
...
...
@@ -2674,7 +2676,85 @@ func (p *TweakPartitionTable) NEOMsgDecode(data []byte) (int, error) {
data
=
data
[
4
:
]
}
}
return
4
+
int
(
nread
),
nil
return
5
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 40 | answerBit. AnswerTweakPartitionTable
func
(
*
AnswerTweakPartitionTable
)
NEOMsgCode
()
uint16
{
return
40
|
answerBit
}
func
(
p
*
AnswerTweakPartitionTable
)
NEOMsgEncodedLen
()
int
{
var
size
int
for
i
:=
0
;
i
<
len
(
p
.
RowList
);
i
++
{
a
:=
&
p
.
RowList
[
i
]
size
+=
len
((
*
a
)
.
CellList
)
*
5
}
return
5
+
len
(
p
.
RowList
)
*
4
+
size
}
func
(
p
*
AnswerTweakPartitionTable
)
NEOMsgEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
Changed
)
{
l
:=
uint32
(
len
(
p
.
RowList
))
binary
.
BigEndian
.
PutUint32
(
data
[
1
:
],
l
)
data
=
data
[
5
:
]
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
{
l
:=
uint32
(
len
((
*
a
)
.
CellList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
)
.
UUID
)))
(
data
[
4
:
])[
0
]
=
uint8
(
int8
((
*
a
)
.
State
))
data
=
data
[
5
:
]
}
}
data
=
data
[
0
:
]
}
}
}
func
(
p
*
AnswerTweakPartitionTable
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint64
if
len
(
data
)
<
5
{
goto
overflow
}
p
.
Changed
=
byte2bool
((
data
[
0
:
0
+
1
])[
0
])
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
1
:
1
+
4
])
data
=
data
[
5
:
]
p
.
RowList
=
make
([]
RowInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
RowList
[
i
]
if
len
(
data
)
<
4
{
goto
overflow
}
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
0
+
4
])
data
=
data
[
4
:
]
if
uint64
(
len
(
data
))
<
uint64
(
l
)
*
5
{
goto
overflow
}
nread
+=
uint64
(
l
)
*
5
(
*
a
)
.
CellList
=
make
([]
CellInfo
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
(
*
a
)
.
CellList
[
i
]
(
*
a
)
.
UUID
=
NodeUUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
0
+
4
])))
(
*
a
)
.
State
=
CellState
(
int8
((
data
[
4
:
4
+
1
])[
0
]))
data
=
data
[
5
:
]
}
}
}
nread
+=
uint64
(
l
)
*
4
}
return
5
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
...
...
@@ -4229,6 +4309,7 @@ var msgTypeRegistry = map[uint16]reflect.Type{
38
:
reflect
.
TypeOf
(
SetNodeState
{}),
39
:
reflect
.
TypeOf
(
AddPendingNodes
{}),
40
:
reflect
.
TypeOf
(
TweakPartitionTable
{}),
40
|
answerBit
:
reflect
.
TypeOf
(
AnswerTweakPartitionTable
{}),
41
:
reflect
.
TypeOf
(
SetNumReplicas
{}),
42
:
reflect
.
TypeOf
(
SetClusterState
{}),
43
:
reflect
.
TypeOf
(
Repair
{}),
...
...
go/neo/proto/ztestdata_proto_py_test.go
View file @
20cacd14
...
...
@@ -93,6 +93,7 @@ var pyMsgRegistry = map[uint16]string{
32803
:
"AnswerObjectHistory"
,
32804
:
"AnswerPartitionList"
,
32805
:
"AnswerNodeList"
,
32808
:
"AnswerTweakPartitionTable"
,
32814
:
"AnswerClusterState"
,
32815
:
"AnswerObjectUndoSerial"
,
32816
:
"AnswerTIDsFrom"
,
...
...
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