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
6d853fa4
Commit
6d853fa4
authored
Jan 27, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X sync proto.go with recent master merge
parent
d61a34c0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
151 additions
and
41 deletions
+151
-41
t/neo/marshal.go
t/neo/marshal.go
+131
-40
t/neo/proto.go
t/neo/proto.go
+20
-1
No files found.
t/neo/marshal.go
View file @
6d853fa4
...
@@ -2455,7 +2455,95 @@ overflow:
...
@@ -2455,7 +2455,95 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 68. ClusterInformation
// 68. repairFlags
func
(
p
*
repairFlags
)
NEOEncodedLen
()
int
{
return
1
}
func
(
p
*
repairFlags
)
NEOEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
DryRun
)
}
func
(
p
*
repairFlags
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
}
p
.
DryRun
=
byte2bool
((
data
[
0
:
])[
0
])
return
1
,
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 69. Repair
func
(
p
*
Repair
)
NEOEncodedLen
()
int
{
return
5
+
len
(
p
.
UUIDList
)
*
4
}
func
(
p
*
Repair
)
NEOEncode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
UUIDList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
((
*
a
))))
data
=
data
[
4
:
]
}
}
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
}
func
(
p
*
Repair
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
{
l
:=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
data
=
data
[
4
:
]
if
uint32
(
len
(
data
))
<
1
+
l
*
4
{
goto
overflow
}
nread
+=
1
+
l
*
4
p
.
UUIDList
=
make
([]
UUID
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
UUIDList
[
i
]
(
*
a
)
=
UUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])))
data
=
data
[
4
:
]
}
}
p
.
repairFlags
.
DryRun
=
byte2bool
((
data
[
0
:
])[
0
])
return
4
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 70. RepairOne
func
(
p
*
RepairOne
)
NEOEncodedLen
()
int
{
return
1
}
func
(
p
*
RepairOne
)
NEOEncode
(
data
[]
byte
)
{
(
data
[
0
:
])[
0
]
=
bool2byte
(
p
.
repairFlags
.
DryRun
)
}
func
(
p
*
RepairOne
)
NEODecode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
1
{
goto
overflow
}
p
.
repairFlags
.
DryRun
=
byte2bool
((
data
[
0
:
])[
0
])
return
1
,
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 71. ClusterInformation
func
(
p
*
ClusterInformation
)
NEOEncodedLen
()
int
{
func
(
p
*
ClusterInformation
)
NEOEncodedLen
()
int
{
return
4
return
4
...
@@ -2476,7 +2564,7 @@ overflow:
...
@@ -2476,7 +2564,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
//
69
. X_ClusterState
//
72
. X_ClusterState
func
(
p
*
X_ClusterState
)
NEOEncodedLen
()
int
{
func
(
p
*
X_ClusterState
)
NEOEncodedLen
()
int
{
return
4
return
4
...
@@ -2497,7 +2585,7 @@ overflow:
...
@@ -2497,7 +2585,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
0
. ObjectUndoSerial
// 7
3
. ObjectUndoSerial
func
(
p
*
ObjectUndoSerial
)
NEOEncodedLen
()
int
{
func
(
p
*
ObjectUndoSerial
)
NEOEncodedLen
()
int
{
return
28
+
len
(
p
.
OidList
)
*
8
return
28
+
len
(
p
.
OidList
)
*
8
...
@@ -2547,7 +2635,7 @@ overflow:
...
@@ -2547,7 +2635,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
1
. AnswerObjectUndoSerial
// 7
4
. AnswerObjectUndoSerial
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerObjectUndoSerial
)
NEOEncodedLen
()
int
{
return
4
+
len
(
p
.
ObjectTIDDict
)
*
25
return
4
+
len
(
p
.
ObjectTIDDict
)
*
25
...
@@ -2611,7 +2699,7 @@ overflow:
...
@@ -2611,7 +2699,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
2
. HasLock
// 7
5
. HasLock
func
(
p
*
HasLock
)
NEOEncodedLen
()
int
{
func
(
p
*
HasLock
)
NEOEncodedLen
()
int
{
return
16
return
16
...
@@ -2634,7 +2722,7 @@ overflow:
...
@@ -2634,7 +2722,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
3
. AnswerHasLock
// 7
6
. AnswerHasLock
func
(
p
*
AnswerHasLock
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerHasLock
)
NEOEncodedLen
()
int
{
return
12
return
12
...
@@ -2657,7 +2745,7 @@ overflow:
...
@@ -2657,7 +2745,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
4
. CheckCurrentSerial
// 7
7
. CheckCurrentSerial
func
(
p
*
CheckCurrentSerial
)
NEOEncodedLen
()
int
{
func
(
p
*
CheckCurrentSerial
)
NEOEncodedLen
()
int
{
return
24
return
24
...
@@ -2682,7 +2770,7 @@ overflow:
...
@@ -2682,7 +2770,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
5
. AnswerCheckCurrentSerial
// 7
8
. AnswerCheckCurrentSerial
func
(
p
*
AnswerCheckCurrentSerial
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerCheckCurrentSerial
)
NEOEncodedLen
()
int
{
return
17
return
17
...
@@ -2707,7 +2795,7 @@ overflow:
...
@@ -2707,7 +2795,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
6
. Pack
// 7
9
. Pack
func
(
p
*
Pack
)
NEOEncodedLen
()
int
{
func
(
p
*
Pack
)
NEOEncodedLen
()
int
{
return
8
return
8
...
@@ -2728,7 +2816,7 @@ overflow:
...
@@ -2728,7 +2816,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
//
77
. AnswerPack
//
80
. AnswerPack
func
(
p
*
AnswerPack
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerPack
)
NEOEncodedLen
()
int
{
return
1
return
1
...
@@ -2749,7 +2837,7 @@ overflow:
...
@@ -2749,7 +2837,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
//
78
. CheckReplicas
//
81
. CheckReplicas
func
(
p
*
CheckReplicas
)
NEOEncodedLen
()
int
{
func
(
p
*
CheckReplicas
)
NEOEncodedLen
()
int
{
return
20
+
len
(
p
.
PartitionDict
)
*
8
return
20
+
len
(
p
.
PartitionDict
)
*
8
...
@@ -2803,7 +2891,7 @@ overflow:
...
@@ -2803,7 +2891,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
//
79
. CheckPartition
//
82
. CheckPartition
func
(
p
*
CheckPartition
)
NEOEncodedLen
()
int
{
func
(
p
*
CheckPartition
)
NEOEncodedLen
()
int
{
return
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
return
30
+
len
(
p
.
Source
.
UpstreamName
)
+
len
(
p
.
Source
.
Address
.
Host
)
...
@@ -2865,7 +2953,7 @@ overflow:
...
@@ -2865,7 +2953,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
0
. CheckTIDRange
// 8
3
. CheckTIDRange
func
(
p
*
CheckTIDRange
)
NEOEncodedLen
()
int
{
func
(
p
*
CheckTIDRange
)
NEOEncodedLen
()
int
{
return
24
return
24
...
@@ -2892,7 +2980,7 @@ overflow:
...
@@ -2892,7 +2980,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
1
. AnswerCheckTIDRange
// 8
4
. AnswerCheckTIDRange
func
(
p
*
AnswerCheckTIDRange
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerCheckTIDRange
)
NEOEncodedLen
()
int
{
return
32
return
32
...
@@ -2917,7 +3005,7 @@ overflow:
...
@@ -2917,7 +3005,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
2
. CheckSerialRange
// 8
5
. CheckSerialRange
func
(
p
*
CheckSerialRange
)
NEOEncodedLen
()
int
{
func
(
p
*
CheckSerialRange
)
NEOEncodedLen
()
int
{
return
32
return
32
...
@@ -2946,7 +3034,7 @@ overflow:
...
@@ -2946,7 +3034,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
3
. AnswerCheckSerialRange
// 8
6
. AnswerCheckSerialRange
func
(
p
*
AnswerCheckSerialRange
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerCheckSerialRange
)
NEOEncodedLen
()
int
{
return
60
return
60
...
@@ -2975,7 +3063,7 @@ overflow:
...
@@ -2975,7 +3063,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
4
. PartitionCorrupted
// 8
7
. PartitionCorrupted
func
(
p
*
PartitionCorrupted
)
NEOEncodedLen
()
int
{
func
(
p
*
PartitionCorrupted
)
NEOEncodedLen
()
int
{
return
8
+
len
(
p
.
CellList
)
*
4
return
8
+
len
(
p
.
CellList
)
*
4
...
@@ -3021,7 +3109,7 @@ overflow:
...
@@ -3021,7 +3109,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
5
. LastTransaction
// 8
8
. LastTransaction
func
(
p
*
LastTransaction
)
NEOEncodedLen
()
int
{
func
(
p
*
LastTransaction
)
NEOEncodedLen
()
int
{
return
0
return
0
...
@@ -3034,7 +3122,7 @@ func (p *LastTransaction) NEODecode(data []byte) (int, error) {
...
@@ -3034,7 +3122,7 @@ func (p *LastTransaction) NEODecode(data []byte) (int, error) {
return
0
,
nil
return
0
,
nil
}
}
// 8
6
. AnswerLastTransaction
// 8
9
. AnswerLastTransaction
func
(
p
*
AnswerLastTransaction
)
NEOEncodedLen
()
int
{
func
(
p
*
AnswerLastTransaction
)
NEOEncodedLen
()
int
{
return
8
return
8
...
@@ -3055,7 +3143,7 @@ overflow:
...
@@ -3055,7 +3143,7 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
//
87
. NotifyReady
//
90
. NotifyReady
func
(
p
*
NotifyReady
)
NEOEncodedLen
()
int
{
func
(
p
*
NotifyReady
)
NEOEncodedLen
()
int
{
return
0
return
0
...
@@ -3138,24 +3226,27 @@ var pktTypeRegistry = map[int]reflect.Type{
...
@@ -3138,24 +3226,27 @@ var pktTypeRegistry = map[int]reflect.Type{
65
:
reflect
.
TypeOf
(
NotifyNodeInformation
{}),
65
:
reflect
.
TypeOf
(
NotifyNodeInformation
{}),
66
:
reflect
.
TypeOf
(
NodeInformation
{}),
66
:
reflect
.
TypeOf
(
NodeInformation
{}),
67
:
reflect
.
TypeOf
(
SetClusterState
{}),
67
:
reflect
.
TypeOf
(
SetClusterState
{}),
68
:
reflect
.
TypeOf
(
ClusterInformation
{}),
68
:
reflect
.
TypeOf
(
repairFlags
{}),
69
:
reflect
.
TypeOf
(
X_ClusterState
{}),
69
:
reflect
.
TypeOf
(
Repair
{}),
70
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
70
:
reflect
.
TypeOf
(
RepairOne
{}),
71
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
71
:
reflect
.
TypeOf
(
ClusterInformation
{}),
72
:
reflect
.
TypeOf
(
HasLock
{}),
72
:
reflect
.
TypeOf
(
X_ClusterState
{}),
73
:
reflect
.
TypeOf
(
AnswerHasLock
{}),
73
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
74
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
74
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
75
:
reflect
.
TypeOf
(
AnswerCheckCurrentSerial
{}),
75
:
reflect
.
TypeOf
(
HasLock
{}),
76
:
reflect
.
TypeOf
(
Pack
{}),
76
:
reflect
.
TypeOf
(
AnswerHasLock
{}),
77
:
reflect
.
TypeOf
(
AnswerPack
{}),
77
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
78
:
reflect
.
TypeOf
(
CheckReplicas
{}),
78
:
reflect
.
TypeOf
(
AnswerCheckCurrentSerial
{}),
79
:
reflect
.
TypeOf
(
CheckPartition
{}),
79
:
reflect
.
TypeOf
(
Pack
{}),
80
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
80
:
reflect
.
TypeOf
(
AnswerPack
{}),
81
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
81
:
reflect
.
TypeOf
(
CheckReplicas
{}),
82
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
82
:
reflect
.
TypeOf
(
CheckPartition
{}),
83
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
83
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
84
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
84
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
85
:
reflect
.
TypeOf
(
LastTransaction
{}),
85
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
86
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
86
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
87
:
reflect
.
TypeOf
(
NotifyReady
{}),
87
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
88
:
reflect
.
TypeOf
(
LastTransaction
{}),
89
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
90
:
reflect
.
TypeOf
(
NotifyReady
{}),
}
}
t/neo/proto.go
View file @
6d853fa4
...
@@ -12,7 +12,7 @@ import (
...
@@ -12,7 +12,7 @@ import (
)
)
const
(
const
(
PROTOCOL_VERSION
=
8
PROTOCOL_VERSION
=
9
MIN_PACKET_SIZE
=
10
// XXX unsafe.Sizeof(PktHead{}) give _typed_ constant (uintptr)
MIN_PACKET_SIZE
=
10
// XXX unsafe.Sizeof(PktHead{}) give _typed_ constant (uintptr)
PktHeadLen
=
MIN_PACKET_SIZE
// TODO link this to PktHead.Encode/Decode size ? XXX -> pkt.go ?
PktHeadLen
=
MIN_PACKET_SIZE
// TODO link this to PktHead.Encode/Decode size ? XXX -> pkt.go ?
...
@@ -631,6 +631,25 @@ type SetClusterState struct {
...
@@ -631,6 +631,25 @@ type SetClusterState struct {
// XXX _answer = Error
// XXX _answer = Error
}
}
// XXX only helper: should not be presented as packet
type
repairFlags
struct
{
DryRun
bool
// pruneOrphan bool
// XXX _answer = Error
}
// Ask storage nodes to repair their databases. ctl -> A -> M
type
Repair
struct
{
UUIDList
[]
UUID
repairFlags
}
// See Repair. M -> S
type
RepairOne
struct
{
repairFlags
}
// Notify information about the cluster
// Notify information about the cluster
type
ClusterInformation
struct
{
type
ClusterInformation
struct
{
State
ClusterState
State
ClusterState
...
...
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