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
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
Stefane Fermigier
neo
Commits
5114dc42
Commit
5114dc42
authored
Sep 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
771aca2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
133 additions
and
50 deletions
+133
-50
go/neo/proto.go
go/neo/proto.go
+28
-32
go/neo/py/pyneo-gen-testdata
go/neo/py/pyneo-gen-testdata
+3
-0
go/neo/zproto-marshal.go
go/neo/zproto-marshal.go
+99
-15
go/neo/ztestdata_proto_py_test.go
go/neo/ztestdata_proto_py_test.go
+3
-3
No files found.
go/neo/proto.go
View file @
5114dc42
...
@@ -483,15 +483,6 @@ type AnswerTransactionFinished struct {
...
@@ -483,15 +483,6 @@ type AnswerTransactionFinished struct {
Tid
zodb
.
Tid
Tid
zodb
.
Tid
}
}
/* XXX move vvv
// Notify that a transaction blocking a replication is now finished
// M -> S
type NotifyTransactionFinished struct {
TTID zodb.Tid
MaxTID zodb.Tid
}
*/
// Lock information on a transaction. PM -> S.
// Lock information on a transaction. PM -> S.
// Notify information on a transaction locked. S -> PM.
// Notify information on a transaction locked. S -> PM.
type
LockInformation
struct
{
type
LockInformation
struct
{
...
@@ -810,26 +801,6 @@ type AnswerTIDsFrom struct {
...
@@ -810,26 +801,6 @@ type AnswerTIDsFrom struct {
}
}
/*
// 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).
// Answer to AskCheckCurrentSerial.
// Same structure as AnswerStoreObject, to handle the same way, except there
// is nothing to invalidate in any client's cache.
type CheckCurrentSerial struct {
Tid zodb.Tid
Oid zodb.Oid
Serial zodb.Tid
}
// XXX answer_store_object ? (was _answer = StoreObject._answer in py)
type AnswerCheckCurrentSerial AnswerStoreObject
//type AnswerCheckCurrentSerial struct {
// Conflict bool
//}
*/
// Request a pack at given TID.
// Request a pack at given TID.
// C -> M
// C -> M
// M -> S
// M -> S
...
@@ -918,6 +889,11 @@ type PartitionCorrupted struct {
...
@@ -918,6 +889,11 @@ type PartitionCorrupted struct {
CellList
[]
NodeUUID
CellList
[]
NodeUUID
}
}
// Notify that node is ready to serve requests.
// S -> M
type
NotifyReady
struct
{
}
// Ask last committed TID.
// Ask last committed TID.
// C -> M
// C -> M
...
@@ -930,12 +906,32 @@ type AnswerLastTransaction struct {
...
@@ -930,12 +906,32 @@ type AnswerLastTransaction struct {
Tid
zodb
.
Tid
Tid
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).
// Answer to AskCheckCurrentSerial.
// Same structure as AnswerStoreObject, to handle the same way, except there
// is nothing to invalidate in any client's cache.
type
CheckCurrentSerial
struct
{
Tid
zodb
.
Tid
Oid
zodb
.
Oid
Serial
zodb
.
Tid
}
// Notify that node is ready to serve requests.
type
AnswerCheckCurrentSerial
struct
{
// S -> M
// was _answer = StoreObject._answer in py
type
NotifyReady
struct
{
// XXX can we do without embedding e.g. `type AnswerCheckCurrentSerial AnswerStoreObject` ?
AnswerStoreObject
}
// Notify that a transaction blocking a replication is now finished
// M -> S
type
NotifyTransactionFinished
struct
{
TTID
zodb
.
Tid
MaxTID
zodb
.
Tid
}
}
// replication
// replication
// TODO
// TODO
go/neo/py/pyneo-gen-testdata
View file @
5114dc42
...
@@ -49,6 +49,9 @@ noask('ObjectUndoSerial')
...
@@ -49,6 +49,9 @@ noask('ObjectUndoSerial')
noask
(
'Pack'
)
noask
(
'Pack'
)
noask
(
'CheckTIDRange'
)
noask
(
'CheckTIDRange'
)
noask
(
'CheckSerialRange'
)
noask
(
'CheckSerialRange'
)
nonotify
(
'PartitionCorrupted'
)
noask
(
'LastTransaction'
)
noask
(
'CheckCurrentSerial'
)
_
=
renames
_
=
renames
_
[
'AskPrimary'
]
=
'PrimaryMaster'
_
[
'AskPrimary'
]
=
'PrimaryMaster'
...
...
go/neo/zproto-marshal.go
View file @
5114dc42
...
@@ -3307,12 +3307,29 @@ overflow:
...
@@ -3307,12 +3307,29 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 84.
LastTransaction
// 84.
NotifyReady
func
(
*
LastTransaction
)
neoMsgCode
()
uint16
{
func
(
*
NotifyReady
)
neoMsgCode
()
uint16
{
return
84
return
84
}
}
func
(
p
*
NotifyReady
)
neoMsgEncodedLen
()
int
{
return
0
}
func
(
p
*
NotifyReady
)
neoMsgEncode
(
data
[]
byte
)
{
}
func
(
p
*
NotifyReady
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
}
// 85. LastTransaction
func
(
*
LastTransaction
)
neoMsgCode
()
uint16
{
return
85
}
func
(
p
*
LastTransaction
)
neoMsgEncodedLen
()
int
{
func
(
p
*
LastTransaction
)
neoMsgEncodedLen
()
int
{
return
0
return
0
}
}
...
@@ -3324,10 +3341,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
...
@@ -3324,10 +3341,10 @@ func (p *LastTransaction) neoMsgDecode(data []byte) (int, error) {
return
0
,
nil
return
0
,
nil
}
}
// 8
5
. AnswerLastTransaction
// 8
6
. AnswerLastTransaction
func
(
*
AnswerLastTransaction
)
neoMsgCode
()
uint16
{
func
(
*
AnswerLastTransaction
)
neoMsgCode
()
uint16
{
return
8
5
|
answerBit
return
8
6
|
answerBit
}
}
func
(
p
*
AnswerLastTransaction
)
neoMsgEncodedLen
()
int
{
func
(
p
*
AnswerLastTransaction
)
neoMsgEncodedLen
()
int
{
...
@@ -3349,21 +3366,85 @@ overflow:
...
@@ -3349,21 +3366,85 @@ overflow:
return
0
,
ErrDecodeOverflow
return
0
,
ErrDecodeOverflow
}
}
// 8
6. NotifyReady
// 8
7. CheckCurrentSerial
func
(
*
NotifyReady
)
neoMsgCode
()
uint16
{
func
(
*
CheckCurrentSerial
)
neoMsgCode
()
uint16
{
return
8
6
return
8
7
}
}
func
(
p
*
NotifyReady
)
neoMsgEncodedLen
()
int
{
func
(
p
*
CheckCurrentSerial
)
neoMsgEncodedLen
()
int
{
return
0
return
24
}
}
func
(
p
*
NotifyReady
)
neoMsgEncode
(
data
[]
byte
)
{
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
*
NotifyReady
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
func
(
p
*
CheckCurrentSerial
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
return
0
,
nil
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
:
]))
return
24
,
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 88. AnswerCheckCurrentSerial
func
(
*
AnswerCheckCurrentSerial
)
neoMsgCode
()
uint16
{
return
88
|
answerBit
}
func
(
p
*
AnswerCheckCurrentSerial
)
neoMsgEncodedLen
()
int
{
return
8
}
func
(
p
*
AnswerCheckCurrentSerial
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
AnswerStoreObject
.
Conflict
))
}
func
(
p
*
AnswerCheckCurrentSerial
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
8
{
goto
overflow
}
p
.
AnswerStoreObject
.
Conflict
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
return
8
,
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
// 89. NotifyTransactionFinished
func
(
*
NotifyTransactionFinished
)
neoMsgCode
()
uint16
{
return
89
}
func
(
p
*
NotifyTransactionFinished
)
neoMsgEncodedLen
()
int
{
return
16
}
func
(
p
*
NotifyTransactionFinished
)
neoMsgEncode
(
data
[]
byte
)
{
binary
.
BigEndian
.
PutUint64
(
data
[
0
:
],
uint64
(
p
.
TTID
))
binary
.
BigEndian
.
PutUint64
(
data
[
8
:
],
uint64
(
p
.
MaxTID
))
}
func
(
p
*
NotifyTransactionFinished
)
neoMsgDecode
(
data
[]
byte
)
(
int
,
error
)
{
if
uint32
(
len
(
data
))
<
16
{
goto
overflow
}
p
.
TTID
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
0
:
]))
p
.
MaxTID
=
zodb
.
Tid
(
binary
.
BigEndian
.
Uint64
(
data
[
8
:
]))
return
16
,
nil
overflow
:
return
0
,
ErrDecodeOverflow
}
}
// registry of message types
// registry of message types
...
@@ -3452,7 +3533,10 @@ var msgTypeRegistry = map[uint16]reflect.Type{
...
@@ -3452,7 +3533,10 @@ var msgTypeRegistry = map[uint16]reflect.Type{
81
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
81
:
reflect
.
TypeOf
(
CheckSerialRange
{}),
82
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
82
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckSerialRange
{}),
83
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
83
:
reflect
.
TypeOf
(
PartitionCorrupted
{}),
84
:
reflect
.
TypeOf
(
LastTransaction
{}),
84
:
reflect
.
TypeOf
(
NotifyReady
{}),
85
|
answerBit
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
85
:
reflect
.
TypeOf
(
LastTransaction
{}),
86
:
reflect
.
TypeOf
(
NotifyReady
{}),
86
|
answerBit
:
reflect
.
TypeOf
(
AnswerLastTransaction
{}),
87
:
reflect
.
TypeOf
(
CheckCurrentSerial
{}),
88
|
answerBit
:
reflect
.
TypeOf
(
AnswerCheckCurrentSerial
{}),
89
:
reflect
.
TypeOf
(
NotifyTransactionFinished
{}),
}
}
go/neo/ztestdata_proto_py_test.go
View file @
5114dc42
...
@@ -54,10 +54,10 @@ var pyMsgRegistry = map[uint16]string{
...
@@ -54,10 +54,10 @@ var pyMsgRegistry = map[uint16]string{
78
:
"CheckPartition"
,
78
:
"CheckPartition"
,
79
:
"CheckTIDRange"
,
79
:
"CheckTIDRange"
,
81
:
"CheckSerialRange"
,
81
:
"CheckSerialRange"
,
83
:
"
Notify
PartitionCorrupted"
,
83
:
"PartitionCorrupted"
,
84
:
"NotifyReady"
,
84
:
"NotifyReady"
,
85
:
"
Ask
LastTransaction"
,
85
:
"LastTransaction"
,
87
:
"
Ask
CheckCurrentSerial"
,
87
:
"CheckCurrentSerial"
,
89
:
"NotifyTransactionFinished"
,
89
:
"NotifyTransactionFinished"
,
90
:
"Replicate"
,
90
:
"Replicate"
,
91
:
"NotifyReplicationDone"
,
91
:
"NotifyReplicationDone"
,
...
...
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