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 {
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.
// Answer information (user, description) about a transaction. S -> Any.
type
TransactionInformation
struct
{
...
...
@@ -804,7 +787,6 @@ type ObjectUndoSerial struct {
OidList
[]
zodb
.
Oid
}
// XXX answer_undo_transaction ?
type
AnswerObjectUndoSerial
struct
{
ObjectTIDDict
map
[
zodb
.
Oid
]
struct
{
CurrentSerial
zodb
.
Tid
...
...
@@ -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
// take a write lock on it (so that this state is not altered until
// transaction ends).
...
...
@@ -831,6 +828,7 @@ type AnswerCheckCurrentSerial AnswerStoreObject
//type AnswerCheckCurrentSerial struct {
// Conflict bool
//}
*/
// Request a pack at given TID.
// C -> M
...
...
go/neo/py/pyneo-gen-testdata
View file @
771aca2e
...
...
@@ -45,6 +45,10 @@ noask('TransactionInformation')
noask
(
'ObjectHistory'
)
noask
(
'PartitionList'
)
noask
(
'NodeList'
)
noask
(
'ObjectUndoSerial'
)
noask
(
'Pack'
)
noask
(
'CheckTIDRange'
)
noask
(
'CheckSerialRange'
)
_
=
renames
_
[
'AskPrimary'
]
=
'PrimaryMaster'
...
...
go/neo/zproto-marshal.go
View file @
771aca2e
...
...
@@ -2878,39 +2878,89 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 73.
CheckCurrentSerial
// 73.
AskTIDsFrom
func
(
*
CheckCurrentSerial
)
neoMsgCode
()
uint16
{
func
(
*
AskTIDsFrom
)
neoMsgCode
()
uint16
{
return
73
}
func
(
p
*
CheckCurrentSerial
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AskTIDsFrom
)
neoMsgEncodedLen
()
int
{
return
24
}
func
(
p
*
CheckCurrentSerial
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
Tid
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
Oid
))
binary
.
BigEndian
.
PutUint64
(
data
[
16
:
],
uint64
(
p
.
Serial
))
func
(
p
*
AskTIDsFrom
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
MinTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
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
{
goto
overflow
}
p
.
Tid
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
Oid
=
zodb
.
Oid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Serial
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
16
:
]))
p
.
MinTID
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
MaxTID
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
p
.
Length
=
binary
.
BigEndian
.
Uint32
(
data
[
16
:
])
p
.
Partition
=
binary
.
BigEndian
.
Uint32
(
data
[
20
:
])
return
24
,
nil
overflow
:
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
{
return
7
4
return
7
5
}
func
(
p
*
Pack
)
neoMsgEncodedLen
()
int
{
...
...
@@ -2932,10 +2982,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
5
. AnswerPack
// 7
6
. AnswerPack
func
(
*
AnswerPack
)
neoMsgCode
()
uint16
{
return
7
5
|
answerBit
return
7
6
|
answerBit
}
func
(
p
*
AnswerPack
)
neoMsgEncodedLen
()
int
{
...
...
@@ -2957,10 +3007,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
6
. CheckReplicas
// 7
7
. CheckReplicas
func
(
*
CheckReplicas
)
neoMsgCode
()
uint16
{
return
7
6
return
7
7
}
func
(
p
*
CheckReplicas
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3015,10 +3065,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
7
. CheckPartition
// 7
8
. CheckPartition
func
(
*
CheckPartition
)
neoMsgCode
()
uint16
{
return
7
7
return
7
8
}
func
(
p
*
CheckPartition
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3081,10 +3131,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 7
8
. CheckTIDRange
// 7
9
. CheckTIDRange
func
(
*
CheckTIDRange
)
neoMsgCode
()
uint16
{
return
7
8
return
7
9
}
func
(
p
*
CheckTIDRange
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3112,10 +3162,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
//
79
. AnswerCheckTIDRange
//
80
. AnswerCheckTIDRange
func
(
*
AnswerCheckTIDRange
)
neoMsgCode
()
uint16
{
return
79
|
answerBit
return
80
|
answerBit
}
func
(
p
*
AnswerCheckTIDRange
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3141,10 +3191,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
0
. CheckSerialRange
// 8
1
. CheckSerialRange
func
(
*
CheckSerialRange
)
neoMsgCode
()
uint16
{
return
8
0
return
8
1
}
func
(
p
*
CheckSerialRange
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3174,10 +3224,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
1
. AnswerCheckSerialRange
// 8
2
. AnswerCheckSerialRange
func
(
*
AnswerCheckSerialRange
)
neoMsgCode
()
uint16
{
return
8
1
|
answerBit
return
8
2
|
answerBit
}
func
(
p
*
AnswerCheckSerialRange
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3207,10 +3257,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
2
. PartitionCorrupted
// 8
3
. PartitionCorrupted
func
(
*
PartitionCorrupted
)
neoMsgCode
()
uint16
{
return
8
2
return
8
3
}
func
(
p
*
PartitionCorrupted
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3257,10 +3307,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
3
. LastTransaction
// 8
4
. LastTransaction
func
(
*
LastTransaction
)
neoMsgCode
()
uint16
{
return
8
3
return
8
4
}
func
(
p
*
LastTransaction
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3274,10 +3324,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
return
0
,
nil
}
// 8
4
. AnswerLastTransaction
// 8
5
. AnswerLastTransaction
func
(
*
AnswerLastTransaction
)
neoMsgCode
()
uint16
{
return
8
4
|
answerBit
return
8
5
|
answerBit
}
func
(
p
*
AnswerLastTransaction
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3299,10 +3349,10 @@ overflow:
return
0
,
ErrDecodeOverflow
}
// 8
5
. NotifyReady
// 8
6
. NotifyReady
func
(
*
NotifyReady
)
neoMsgCode
()
uint16
{
return
8
5
return
8
6
}
func
(
p
*
NotifyReady
)
neoMsgEncodedLen
()
int
{
...
...
@@ -3391,17 +3441,18 @@ var msgTypeRegistry = map[uint16]reflect.Type{
70
|
answerBit
:
reflect
.
TypeOf
(
AnswerClusterState
{}),
71
:
reflect
.
TypeOf
(
ObjectUndoSerial
{}),
72
|
answerBit
:
reflect
.
TypeOf
(
AnswerObjectUndoSerial
{}),
73
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
74
:
reflect
.
TypeOf
(
Pack
{}),
75
|
answerBit
:
reflect
.
TypeOf
(
AnswerPack
{}),
76
:
reflect
.
TypeOf
(
CheckReplicas
{}),
77
:
reflect
.
TypeOf
(
CheckPartition
{}),
78
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
79
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
80
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
81
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
82
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
83
:
reflect
.
TypeOf
(
LastTransaction
{}),
84
|
answerBit
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
85
:
reflect
.
TypeOf
(
NotifyReady
{}),
73
:
reflect
.
TypeOf
(
AskTIDsFrom
{}),
74
|
answerBit
:
reflect
.
TypeOf
(
AnswerTIDsFrom
{}),
75
:
reflect
.
TypeOf
(
Pack
{}),
76
|
answerBit
:
reflect
.
TypeOf
(
AnswerPack
{}),
77
:
reflect
.
TypeOf
(
CheckReplicas
{}),
78
:
reflect
.
TypeOf
(
CheckPartition
{}),
79
:
reflect
.
TypeOf
(
CheckTIDRange
{}),
80
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckTIDRange
{}),
81
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
82
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
83
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
84
:
reflect
.
TypeOf
(
LastTransaction
{}),
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{
67
:
"RepairOne"
,
68
:
"NotifyClusterState"
,
69
:
"AskClusterState"
,
71
:
"
Ask
ObjectUndoSerial"
,
71
:
"ObjectUndoSerial"
,
73
:
"AskTIDsFrom"
,
75
:
"
Ask
Pack"
,
75
:
"Pack"
,
77
:
"CheckReplicas"
,
78
:
"CheckPartition"
,
79
:
"
Ask
CheckTIDRange"
,
81
:
"
Ask
CheckSerialRange"
,
79
:
"CheckTIDRange"
,
81
:
"CheckSerialRange"
,
83
:
"NotifyPartitionCorrupted"
,
84
:
"NotifyReady"
,
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