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
61308d4a
Commit
61308d4a
authored
Jun 12, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c0a8161c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
82 deletions
+101
-82
go/neo/proto-marshal.go
go/neo/proto-marshal.go
+87
-70
go/neo/proto.go
go/neo/proto.go
+13
-11
neo/lib/protocol.py
neo/lib/protocol.py
+1
-1
No files found.
go/neo/proto-marshal.go
View file @
61308d4a
...
...
@@ -565,20 +565,20 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 16.
X_
PartitionTable
// 16.
Ask
PartitionTable
func
(
_
*
X_
PartitionTable
)
NEOMsgCode
()
uint16
{
func
(
_
*
Ask
PartitionTable
)
NEOMsgCode
()
uint16
{
return
16
}
func
(
p
*
X_
PartitionTable
)
NEOMsgEncodedLen
()
int
{
func
(
p
*
Ask
PartitionTable
)
NEOMsgEncodedLen
()
int
{
return
0
}
func
(
p
*
X_
PartitionTable
)
NEOMsgEncode
(
data
[]
byte
)
{
func
(
p
*
Ask
PartitionTable
)
NEOMsgEncode
(
data
[]
byte
)
{
}
func
(
p
*
X_
PartitionTable
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Ask
PartitionTable
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
...
...
@@ -742,17 +742,17 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 19. PartitionChanges
// 19.
Notify
PartitionChanges
func
(
_
*
PartitionChanges
)
NEOMsgCode
()
uint16
{
func
(
_
*
Notify
PartitionChanges
)
NEOMsgCode
()
uint16
{
return
19
}
func
(
p
*
PartitionChanges
)
NEOMsgEncodedLen
()
int
{
func
(
p
*
Notify
PartitionChanges
)
NEOMsgEncodedLen
()
int
{
return
12
+
len
(
p
.
CellList
)
*
12
}
func
(
p
*
PartitionChanges
)
NEOMsgEncode
(
data
[]
byte
)
{
func
(
p
*
Notify
PartitionChanges
)
NEOMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
PTid
))
{
l
:=
uint32
(
len
(
p
.
CellList
))
...
...
@@ -761,14 +761,14 @@ func (p *PartitionChanges) NEOMsgEncode(data []byte) {
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
(
*
a
)
.
Offset
)
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
((
*
a
)
.
CellState
)))
binary
.
BigEndian
.
PutUint32
(
data
[
4
:
],
uint32
(
int32
((
*
a
)
.
CellInfo
.
NodeUUID
)))
binary
.
BigEndian
.
PutUint32
(
data
[
8
:
],
uint32
(
int32
((
*
a
)
.
Cell
Info
.
Cell
State
)))
data
=
data
[
12
:
]
}
}
}
func
(
p
*
PartitionChanges
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Notify
PartitionChanges
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
var
nread
uint32
if
uint32
(
len
(
data
))
<
12
{
goto
overflow
...
...
@@ -782,15 +782,14 @@ func (p *PartitionChanges) NEOMsgDecode(data []byte) (int, error) {
}
nread
+=
l
*
12
p
.
CellList
=
make
([]
struct
{
Offset
uint32
NodeUUID
NodeUUID
CellState
CellState
Offset
uint32
CellInfo
CellInfo
},
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
CellList
[
i
]
(
*
a
)
.
Offset
=
binary
.
BigEndian
.
Uint32
(
data
[
0
:
])
(
*
a
)
.
NodeUUID
=
NodeUUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
CellState
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
(
*
a
)
.
CellInfo
.
NodeUUID
=
NodeUUID
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
4
:
])))
(
*
a
)
.
Cell
Info
.
Cell
State
=
CellState
(
int32
(
binary
.
BigEndian
.
Uint32
(
data
[
8
:
])))
data
=
data
[
12
:
]
}
}
...
...
@@ -2983,21 +2982,38 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 75.
X_
ClusterState
// 75.
Ask
ClusterState
func
(
_
*
X_
ClusterState
)
NEOMsgCode
()
uint16
{
func
(
_
*
Ask
ClusterState
)
NEOMsgCode
()
uint16
{
return
75
}
func
(
p
*
X_ClusterState
)
NEOMsgEncodedLen
()
int
{
func
(
p
*
AskClusterState
)
NEOMsgEncodedLen
()
int
{
return
0
}
func
(
p
*
AskClusterState
)
NEOMsgEncode
(
data
[]
byte
)
{
}
func
(
p
*
AskClusterState
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 76. AnswerClusterState
func
(
_
*
AnswerClusterState
)
NEOMsgCode
()
uint16
{
return
76
}
func
(
p
*
AnswerClusterState
)
NEOMsgEncodedLen
()
int
{
return
4
}
func
(
p
*
X_
ClusterState
)
NEOMsgEncode
(
data
[]
byte
)
{
func
(
p
*
Answer
ClusterState
)
NEOMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
uint32
(
int32
(
p
.
State
)))
}
func
(
p
*
X_
ClusterState
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
Answer
ClusterState
)
NEOMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
4
{
goto
overflow
}
...
...
@@ -3008,10 +3024,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
6
. ObjectUndoSerial
// 7
7
. ObjectUndoSerial
func
(
_
*
ObjectUndoSerial
)
NEOMsgCode
()
uint16
{
return
7
6
return
7
7
}
func
(
p
*
ObjectUndoSerial
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3062,10 +3078,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
7
. AnswerObjectUndoSerial
// 7
8
. AnswerObjectUndoSerial
func
(
_
*
AnswerObjectUndoSerial
)
NEOMsgCode
()
uint16
{
return
7
7
return
7
8
}
func
(
p
*
AnswerObjectUndoSerial
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3130,10 +3146,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
8
. CheckCurrentSerial
// 7
9
. CheckCurrentSerial
func
(
_
*
CheckCurrentSerial
)
NEOMsgCode
()
uint16
{
return
7
8
return
7
9
}
func
(
p
*
CheckCurrentSerial
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3159,10 +3175,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
//
79
. Pack
//
80
. Pack
func
(
_
*
Pack
)
NEOMsgCode
()
uint16
{
return
79
return
80
}
func
(
p
*
Pack
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3184,10 +3200,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
0
. AnswerPack
// 8
1
. AnswerPack
func
(
_
*
AnswerPack
)
NEOMsgCode
()
uint16
{
return
8
0
return
8
1
}
func
(
p
*
AnswerPack
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3209,10 +3225,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
1
. CheckReplicas
// 8
2
. CheckReplicas
func
(
_
*
CheckReplicas
)
NEOMsgCode
()
uint16
{
return
8
1
return
8
2
}
func
(
p
*
CheckReplicas
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3267,10 +3283,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
2
. CheckPartition
// 8
3
. CheckPartition
func
(
_
*
CheckPartition
)
NEOMsgCode
()
uint16
{
return
8
2
return
8
3
}
func
(
p
*
CheckPartition
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3333,10 +3349,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
3
. CheckTIDRange
// 8
4
. CheckTIDRange
func
(
_
*
CheckTIDRange
)
NEOMsgCode
()
uint16
{
return
8
3
return
8
4
}
func
(
p
*
CheckTIDRange
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3364,10 +3380,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
4
. AnswerCheckTIDRange
// 8
5
. AnswerCheckTIDRange
func
(
_
*
AnswerCheckTIDRange
)
NEOMsgCode
()
uint16
{
return
8
4
return
8
5
}
func
(
p
*
AnswerCheckTIDRange
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3393,10 +3409,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
5
. CheckSerialRange
// 8
6
. CheckSerialRange
func
(
_
*
CheckSerialRange
)
NEOMsgCode
()
uint16
{
return
8
5
return
8
6
}
func
(
p
*
CheckSerialRange
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3426,10 +3442,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
6
. AnswerCheckSerialRange
// 8
7
. AnswerCheckSerialRange
func
(
_
*
AnswerCheckSerialRange
)
NEOMsgCode
()
uint16
{
return
8
6
return
8
7
}
func
(
p
*
AnswerCheckSerialRange
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3459,10 +3475,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
7
. PartitionCorrupted
// 8
8
. PartitionCorrupted
func
(
_
*
PartitionCorrupted
)
NEOMsgCode
()
uint16
{
return
8
7
return
8
8
}
func
(
p
*
PartitionCorrupted
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3509,10 +3525,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
8
. LastTransaction
// 8
9
. LastTransaction
func
(
_
*
LastTransaction
)
NEOMsgCode
()
uint16
{
return
8
8
return
8
9
}
func
(
p
*
LastTransaction
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3526,10 +3542,10 @@ func (p *LastTransaction) NEOMsgDecode(data []byte) (int, error) {
return
0
,
nil
}
//
89
. AnswerLastTransaction
//
90
. AnswerLastTransaction
func
(
_
*
AnswerLastTransaction
)
NEOMsgCode
()
uint16
{
return
89
return
90
}
func
(
p
*
AnswerLastTransaction
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3551,10 +3567,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 9
0
. NotifyReady
// 9
1
. NotifyReady
func
(
_
*
NotifyReady
)
NEOMsgCode
()
uint16
{
return
9
0
return
9
1
}
func
(
p
*
NotifyReady
)
NEOMsgEncodedLen
()
int
{
...
...
@@ -3586,10 +3602,10 @@ var msgTypeRegistry = map[uint16]reflect.Type{
13
:
reflect
.
TypeOf
(
AnswerRecovery
{}),
14
:
reflect
.
TypeOf
(
LastIDs
{}),
15
:
reflect
.
TypeOf
(
AnswerLastIDs
{}),
16
:
reflect
.
TypeOf
(
X_
PartitionTable
{}),
16
:
reflect
.
TypeOf
(
Ask
PartitionTable
{}),
17
:
reflect
.
TypeOf
(
AnswerPartitionTable
{}),
18
:
reflect
.
TypeOf
(
NotifyPartitionTable
{}),
19
:
reflect
.
TypeOf
(
PartitionChanges
{}),
19
:
reflect
.
TypeOf
(
Notify
PartitionChanges
{}),
20
:
reflect
.
TypeOf
(
StartOperation
{}),
21
:
reflect
.
TypeOf
(
StopOperation
{}),
22
:
reflect
.
TypeOf
(
UnfinishedTransactions
{}),
...
...
@@ -3645,20 +3661,21 @@ var msgTypeRegistry = map[uint16]reflect.Type{
72
:
reflect
.
TypeOf
(
Repair
{}),
73
:
reflect
.
TypeOf
(
RepairOne
{}),
74
:
reflect
.
TypeOf
(
ClusterInformation
{}),
75
:
reflect
.
TypeOf
(
X_ClusterState
{}),
76
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
77
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
78
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
79
:
reflect
.
TypeOf
(
Pack
{}),
80
:
reflect
.
TypeOf
(
AnswerPack
{}),
81
:
reflect
.
TypeOf
(
CheckReplicas
{}),
82
:
reflect
.
TypeOf
(
CheckPartition
{}),
83
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
84
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
85
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
86
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
87
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
88
:
reflect
.
TypeOf
(
LastTransaction
{}),
89
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
90
:
reflect
.
TypeOf
(
NotifyReady
{}),
75
:
reflect
.
TypeOf
(
AskClusterState
{}),
76
:
reflect
.
TypeOf
(
AnswerClusterState
{}),
77
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
78
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
79
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
80
:
reflect
.
TypeOf
(
Pack
{}),
81
:
reflect
.
TypeOf
(
AnswerPack
{}),
82
:
reflect
.
TypeOf
(
CheckReplicas
{}),
83
:
reflect
.
TypeOf
(
CheckPartition
{}),
84
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
85
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
86
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
87
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
88
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
89
:
reflect
.
TypeOf
(
LastTransaction
{}),
90
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
91
:
reflect
.
TypeOf
(
NotifyReady
{}),
}
go/neo/proto.go
View file @
61308d4a
...
...
@@ -3,6 +3,8 @@
package
neo
// protocol definition
// TODO regroup messages definitions to stay more close to 1 communication topic
// TODO document protocol itself better (who sends who what with which semantic)
// NOTE for some packets it is possible to decode raw packet -> go version from
// PktBuf in place. E.g. for GetObject.
...
...
@@ -240,7 +242,7 @@ type CellInfo struct {
}
type
RowInfo
struct
{
Offset
uint32
// PNumber
Offset
uint32
// PNumber XXX -> Pid
CellList
[]
CellInfo
}
...
...
@@ -320,8 +322,7 @@ type AnswerLastIDs struct {
// Ask the full partition table. PM -> S.
// Answer rows in a partition table. S -> PM.
// XXX overlap with PartitionTable struct
type
X_PartitionTable
struct
{
type
AskPartitionTable
struct
{
}
type
AnswerPartitionTable
struct
{
...
...
@@ -330,7 +331,7 @@ type AnswerPartitionTable struct {
}
// Send
rows in a
partition table to update other nodes. PM -> S, C.
// Send
whole
partition table to update other nodes. PM -> S, C.
type
NotifyPartitionTable
struct
{
PTid
RowList
[]
RowInfo
...
...
@@ -338,13 +339,11 @@ type NotifyPartitionTable struct {
// Notify a subset of a partition table. This is used to notify changes.
// PM -> S, C.
type
PartitionChanges
struct
{
type
Notify
PartitionChanges
struct
{
PTid
CellList
[]
struct
{
// XXX does below correlate with Cell inside top-level CellList ?
Offset
uint32
// PNumber
NodeUUID
NodeUUID
CellState
CellState
Offset
uint32
// PNumber XXX -> Pid
CellInfo
CellInfo
}
}
...
...
@@ -365,7 +364,7 @@ type StopOperation struct {
// Answer unfinished transactions PM -> S.
type
UnfinishedTransactions
struct
{
RowList
[]
struct
{
Offset
uint32
// PNumber
Offset
uint32
// PNumber
XXX -> Pid
}
}
...
...
@@ -726,7 +725,10 @@ type ClusterInformation struct {
// Ask state of the cluster
// Answer state of the cluster
type
X_ClusterState
struct
{
// XXX conflicts with ClusterState enum
type
AskClusterState
struct
{
}
type
AnswerClusterState
struct
{
State
ClusterState
}
...
...
neo/lib/protocol.py
View file @
61308d4a
...
...
@@ -684,7 +684,7 @@ class RequestIdentification(Packet):
PFNodeType
,
PUUID
(
'my_uuid'
),
PNumber
(
'num_partitions'
),
# XXX why here, not in pt updates ?
PNumber
(
'num_replicas'
),
# XXX -
--- // ----
PNumber
(
'num_replicas'
),
# XXX -
> because current neo/py cannot change Npt at runtime
PUUID
(
'your_uuid'
),
)
...
...
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