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
771aca2e
Commit
771aca2e
authored
Sep 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
97e2f8df
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
123 additions
and
70 deletions
+123
-70
go/neo/proto.go
go/neo/proto.go
+16
-18
go/neo/py/pyneo-gen-testdata
go/neo/py/pyneo-gen-testdata
+4
-0
go/neo/zproto-marshal.go
go/neo/zproto-marshal.go
+99
-48
go/neo/ztestdata_proto_py_test.go
go/neo/ztestdata_proto_py_test.go
+4
-4
No files found.
go/neo/proto.go
View file @
771aca2e
...
@@ -638,23 +638,6 @@ type AnswerTIDs struct {
...
@@ -638,23 +638,6 @@ type AnswerTIDs struct {
TIDList
[]
zodb
.
Tid
TIDList
[]
zodb
.
Tid
}
}
/*
// Ask for length TIDs starting at min_tid. The order of TIDs is ascending.
// C -> S.
// Answer the requested TIDs. S -> C
type TIDListFrom struct {
MinTID zodb.Tid
MaxTID zodb.Tid
Length uint32 // PNumber
Partition uint32 // PNumber
}
// XXX answer_tids ?
type AnswerTIDListFrom struct {
TidList []zodb.Tid
}
*/
// Ask information about a transaction. Any -> S.
// Ask information about a transaction. Any -> S.
// Answer information (user, description) about a transaction. S -> Any.
// Answer information (user, description) about a transaction. S -> Any.
type
TransactionInformation
struct
{
type
TransactionInformation
struct
{
...
@@ -804,7 +787,6 @@ type ObjectUndoSerial struct {
...
@@ -804,7 +787,6 @@ type ObjectUndoSerial struct {
OidList
[]
zodb
.
Oid
OidList
[]
zodb
.
Oid
}
}
// XXX answer_undo_transaction ?
type
AnswerObjectUndoSerial
struct
{
type
AnswerObjectUndoSerial
struct
{
ObjectTIDDict
map
[
zodb
.
Oid
]
struct
{
ObjectTIDDict
map
[
zodb
.
Oid
]
struct
{
CurrentSerial
zodb
.
Tid
CurrentSerial
zodb
.
Tid
...
@@ -813,7 +795,22 @@ type AnswerObjectUndoSerial struct {
...
@@ -813,7 +795,22 @@ type AnswerObjectUndoSerial struct {
}
}
}
}
// Ask for length TIDs starting at min_tid. The order of TIDs is ascending.
// C -> S.
// Answer the requested TIDs. S -> C
type
AskTIDsFrom
struct
{
MinTID
zodb
.
Tid
MaxTID
zodb
.
Tid
Length
uint32
// PNumber
Partition
uint32
// PNumber
}
type
AnswerTIDsFrom
struct
{
TidList
[]
zodb
.
Tid
}
/*
// Verifies if given serial is current for object oid in the database, and
// Verifies if given serial is current for object oid in the database, and
// take a write lock on it (so that this state is not altered until
// take a write lock on it (so that this state is not altered until
// transaction ends).
// transaction ends).
...
@@ -831,6 +828,7 @@ type AnswerCheckCurrentSerial AnswerStoreObject
...
@@ -831,6 +828,7 @@ type AnswerCheckCurrentSerial AnswerStoreObject
//type AnswerCheckCurrentSerial struct {
//type AnswerCheckCurrentSerial struct {
// Conflict bool
// Conflict bool
//}
//}
*/
// Request a pack at given TID.
// Request a pack at given TID.
// C -> M
// C -> M
...
...
go/neo/py/pyneo-gen-testdata
View file @
771aca2e
...
@@ -45,6 +45,10 @@ noask('TransactionInformation')
...
@@ -45,6 +45,10 @@ noask('TransactionInformation')
noask
(
'ObjectHistory'
)
noask
(
'ObjectHistory'
)
noask
(
'PartitionList'
)
noask
(
'PartitionList'
)
noask
(
'NodeList'
)
noask
(
'NodeList'
)
noask
(
'ObjectUndoSerial'
)
noask
(
'Pack'
)
noask
(
'CheckTIDRange'
)
noask
(
'CheckSerialRange'
)
_
=
renames
_
=
renames
_
[
'AskPrimary'
]
=
'PrimaryMaster'
_
[
'AskPrimary'
]
=
'PrimaryMaster'
...
...
go/neo/zproto-marshal.go
View file @
771aca2e
...
@@ -2878,39 +2878,89 @@ overflow:
...
@@ -2878,39 +2878,89 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 73.
CheckCurrentSerial
// 73.
AskTIDsFrom
func
(
*
CheckCurrentSerial
)
neoMsgCode
()
uint16
{
func
(
*
AskTIDsFrom
)
neoMsgCode
()
uint16
{
return
73
return
73
}
}
func
(
p
*
CheckCurrentSerial
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AskTIDsFrom
)
neoMsgEncodedLen
()
int
{
return
24
return
24
}
}
func
(
p
*
CheckCurrentSerial
)
neoMsgEncode
(
data
[]
byte
)
{
func
(
p
*
AskTIDsFrom
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Serial
))
binary
.
BigEndian
.
PutUint32
(
data
[
16
:
],
p
.
Length
)
binary
.
BigEndian
.
PutUint32
(
data
[
20
:
],
p
.
Partition
)
}
}
func
(
p
*
CheckCurrentSerial
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
AskTIDsFrom
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
24
{
if
uint32
(
len
(
data
))
<
24
{
goto
overflow
goto
overflow
}
}
p
.
Tid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
MinTID
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
zodb
.
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
MaxTID
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Serial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
return
24
,
nil
return
24
,
nil
overflow
:
overflow
:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 74. Pack
// 74. AnswerTIDsFrom
func
(
*
AnswerTIDsFrom
)
neoMsgCode
()
uint16
{
return
74
|
answerBit
}
func
(
p
*
AnswerTIDsFrom
)
neoMsgEncodedLen
()
int
{
return
4
+
len
(
p
.
TidList
)
*
8
}
func
(
p
*
AnswerTIDsFrom
)
neoMsgEncode
(
data
[]
byte
)
{
{
l
:=
uint32
(
len
(
p
.
TidList
))
binary
.
BigEndian
.
PutUint32
(
data
[
0
:
],
l
)
data
=
data
[
4
:
]
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
((
*
a
)))
data
=
data
[
8
:
]
}
}
}
func
(
p
*
AnswerTIDsFrom
)
neoMsgDecode
(
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
))
<
l
*
8
{
goto
overflow
}
nread
+=
l
*
8
p
.
TidList
=
make
([]
zodb
.
Tid
,
l
)
for
i
:=
0
;
uint32
(
i
)
<
l
;
i
++
{
a
:=
&
p
.
TidList
[
i
]
(
*
a
)
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
data
=
data
[
8
:
]
}
}
return
4
+
int
(
nread
),
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 75. Pack
func
(
*
Pack
)
neoMsgCode
()
uint16
{
func
(
*
Pack
)
neoMsgCode
()
uint16
{
return
7
4
return
7
5
}
}
func
(
p
*
Pack
)
neoMsgEncodedLen
()
int
{
func
(
p
*
Pack
)
neoMsgEncodedLen
()
int
{
...
@@ -2932,10 +2982,10 @@ overflow:
...
@@ -2932,10 +2982,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
5
. AnswerPack
// 7
6
. AnswerPack
func
(
*
AnswerPack
)
neoMsgCode
()
uint16
{
func
(
*
AnswerPack
)
neoMsgCode
()
uint16
{
return
7
5
|
answerBit
return
7
6
|
answerBit
}
}
func
(
p
*
AnswerPack
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AnswerPack
)
neoMsgEncodedLen
()
int
{
...
@@ -2957,10 +3007,10 @@ overflow:
...
@@ -2957,10 +3007,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
6
. CheckReplicas
// 7
7
. CheckReplicas
func
(
*
CheckReplicas
)
neoMsgCode
()
uint16
{
func
(
*
CheckReplicas
)
neoMsgCode
()
uint16
{
return
7
6
return
7
7
}
}
func
(
p
*
CheckReplicas
)
neoMsgEncodedLen
()
int
{
func
(
p
*
CheckReplicas
)
neoMsgEncodedLen
()
int
{
...
@@ -3015,10 +3065,10 @@ overflow:
...
@@ -3015,10 +3065,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
7
. CheckPartition
// 7
8
. CheckPartition
func
(
*
CheckPartition
)
neoMsgCode
()
uint16
{
func
(
*
CheckPartition
)
neoMsgCode
()
uint16
{
return
7
7
return
7
8
}
}
func
(
p
*
CheckPartition
)
neoMsgEncodedLen
()
int
{
func
(
p
*
CheckPartition
)
neoMsgEncodedLen
()
int
{
...
@@ -3081,10 +3131,10 @@ overflow:
...
@@ -3081,10 +3131,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 7
8
. CheckTIDRange
// 7
9
. CheckTIDRange
func
(
*
CheckTIDRange
)
neoMsgCode
()
uint16
{
func
(
*
CheckTIDRange
)
neoMsgCode
()
uint16
{
return
7
8
return
7
9
}
}
func
(
p
*
CheckTIDRange
)
neoMsgEncodedLen
()
int
{
func
(
p
*
CheckTIDRange
)
neoMsgEncodedLen
()
int
{
...
@@ -3112,10 +3162,10 @@ overflow:
...
@@ -3112,10 +3162,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
//
79
. AnswerCheckTIDRange
//
80
. AnswerCheckTIDRange
func
(
*
AnswerCheckTIDRange
)
neoMsgCode
()
uint16
{
func
(
*
AnswerCheckTIDRange
)
neoMsgCode
()
uint16
{
return
79
|
answerBit
return
80
|
answerBit
}
}
func
(
p
*
AnswerCheckTIDRange
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AnswerCheckTIDRange
)
neoMsgEncodedLen
()
int
{
...
@@ -3141,10 +3191,10 @@ overflow:
...
@@ -3141,10 +3191,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
0
. CheckSerialRange
// 8
1
. CheckSerialRange
func
(
*
CheckSerialRange
)
neoMsgCode
()
uint16
{
func
(
*
CheckSerialRange
)
neoMsgCode
()
uint16
{
return
8
0
return
8
1
}
}
func
(
p
*
CheckSerialRange
)
neoMsgEncodedLen
()
int
{
func
(
p
*
CheckSerialRange
)
neoMsgEncodedLen
()
int
{
...
@@ -3174,10 +3224,10 @@ overflow:
...
@@ -3174,10 +3224,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
1
. AnswerCheckSerialRange
// 8
2
. AnswerCheckSerialRange
func
(
*
AnswerCheckSerialRange
)
neoMsgCode
()
uint16
{
func
(
*
AnswerCheckSerialRange
)
neoMsgCode
()
uint16
{
return
8
1
|
answerBit
return
8
2
|
answerBit
}
}
func
(
p
*
AnswerCheckSerialRange
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AnswerCheckSerialRange
)
neoMsgEncodedLen
()
int
{
...
@@ -3207,10 +3257,10 @@ overflow:
...
@@ -3207,10 +3257,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
2
. PartitionCorrupted
// 8
3
. PartitionCorrupted
func
(
*
PartitionCorrupted
)
neoMsgCode
()
uint16
{
func
(
*
PartitionCorrupted
)
neoMsgCode
()
uint16
{
return
8
2
return
8
3
}
}
func
(
p
*
PartitionCorrupted
)
neoMsgEncodedLen
()
int
{
func
(
p
*
PartitionCorrupted
)
neoMsgEncodedLen
()
int
{
...
@@ -3257,10 +3307,10 @@ overflow:
...
@@ -3257,10 +3307,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
3
. LastTransaction
// 8
4
. LastTransaction
func
(
*
LastTransaction
)
neoMsgCode
()
uint16
{
func
(
*
LastTransaction
)
neoMsgCode
()
uint16
{
return
8
3
return
8
4
}
}
func
(
p
*
LastTransaction
)
neoMsgEncodedLen
()
int
{
func
(
p
*
LastTransaction
)
neoMsgEncodedLen
()
int
{
...
@@ -3274,10 +3324,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
...
@@ -3274,10 +3324,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
return
0
,
nil
return
0
,
nil
}
}
// 8
4
. AnswerLastTransaction
// 8
5
. AnswerLastTransaction
func
(
*
AnswerLastTransaction
)
neoMsgCode
()
uint16
{
func
(
*
AnswerLastTransaction
)
neoMsgCode
()
uint16
{
return
8
4
|
answerBit
return
8
5
|
answerBit
}
}
func
(
p
*
AnswerLastTransaction
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AnswerLastTransaction
)
neoMsgEncodedLen
()
int
{
...
@@ -3299,10 +3349,10 @@ overflow:
...
@@ -3299,10 +3349,10 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
5
. NotifyReady
// 8
6
. NotifyReady
func
(
*
NotifyReady
)
neoMsgCode
()
uint16
{
func
(
*
NotifyReady
)
neoMsgCode
()
uint16
{
return
8
5
return
8
6
}
}
func
(
p
*
NotifyReady
)
neoMsgEncodedLen
()
int
{
func
(
p
*
NotifyReady
)
neoMsgEncodedLen
()
int
{
...
@@ -3391,17 +3441,18 @@ var msgTypeRegistry = map[uint16]reflect.Type{
...
@@ -3391,17 +3441,18 @@ var msgTypeRegistry = map[uint16]reflect.Type{
70
|
answerBit
:
reflect
.
TypeOf
(
AnswerClusterState
{}),
70
|
answerBit
:
reflect
.
TypeOf
(
AnswerClusterState
{}),
71
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
71
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
72
|
answerBit
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
72
|
answerBit
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
73
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
73
:
reflect
.
TypeOf
(
AskTIDsFrom
{}),
74
:
reflect
.
TypeOf
(
Pack
{}),
74
|
answerBit
:
reflect
.
TypeOf
(
AnswerTIDsFrom
{}),
75
|
answerBit
:
reflect
.
TypeOf
(
AnswerPack
{}),
75
:
reflect
.
TypeOf
(
Pack
{}),
76
:
reflect
.
TypeOf
(
CheckReplicas
{}),
76
|
answerBit
:
reflect
.
TypeOf
(
AnswerPack
{}),
77
:
reflect
.
TypeOf
(
CheckPartition
{}),
77
:
reflect
.
TypeOf
(
CheckReplicas
{}),
78
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
78
:
reflect
.
TypeOf
(
CheckPartition
{}),
79
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
79
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
80
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
80
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
81
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
81
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
82
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
82
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
83
:
reflect
.
TypeOf
(
LastTransaction
{}),
83
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
84
|
answerBit
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
84
:
reflect
.
TypeOf
(
LastTransaction
{}),
85
:
reflect
.
TypeOf
(
NotifyReady
{}),
85
|
answerBit
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
86
:
reflect
.
TypeOf
(
NotifyReady
{}),
}
}
go/neo/ztestdata_proto_py_test.go
View file @
771aca2e
...
@@ -47,13 +47,13 @@ var pyMsgRegistry = map[uint16]string{
...
@@ -47,13 +47,13 @@ var pyMsgRegistry = map[uint16]string{
67
:
"RepairOne"
,
67
:
"RepairOne"
,
68
:
"NotifyClusterState"
,
68
:
"NotifyClusterState"
,
69
:
"AskClusterState"
,
69
:
"AskClusterState"
,
71
:
"
Ask
ObjectUndoSerial"
,
71
:
"ObjectUndoSerial"
,
73
:
"AskTIDsFrom"
,
73
:
"AskTIDsFrom"
,
75
:
"
Ask
Pack"
,
75
:
"Pack"
,
77
:
"CheckReplicas"
,
77
:
"CheckReplicas"
,
78
:
"CheckPartition"
,
78
:
"CheckPartition"
,
79
:
"
Ask
CheckTIDRange"
,
79
:
"CheckTIDRange"
,
81
:
"
Ask
CheckSerialRange"
,
81
:
"CheckSerialRange"
,
83
:
"NotifyPartitionCorrupted"
,
83
:
"NotifyPartitionCorrupted"
,
84
:
"NotifyReady"
,
84
:
"NotifyReady"
,
85
:
"AskLastTransaction"
,
85
:
"AskLastTransaction"
,
...
...
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