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
3e4d0dd7
Commit
3e4d0dd7
authored
Sep 03, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bc16d2ee
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
374 additions
and
350 deletions
+374
-350
go/neo/proto.go
go/neo/proto.go
+16
-13
go/neo/protogen.go
go/neo/protogen.go
+4
-1
go/neo/zproto-marshal.go
go/neo/zproto-marshal.go
+354
-336
No files found.
go/neo/proto.go
View file @
3e4d0dd7
...
@@ -32,8 +32,9 @@ package neo
...
@@ -32,8 +32,9 @@ package neo
// The order of message definitions is significant - messages are assigned
// The order of message definitions is significant - messages are assigned
// message IDs in the same order they are defined.
// message IDs in the same order they are defined.
//
//
// For compatibility with neo/py is a message should have its ID assigned with
// For compatibility with neo/py a message has its ID assigned with "answer"
// "answer" bit set its definition is prefixed with `//neo:proto answer` comment.
// bit set if either message name starts with "Answer" or message definition is
// prefixed with `//neo:proto answer` comment.
// TODO regroup messages definitions to stay more close to 1 communication topic
// TODO regroup messages definitions to stay more close to 1 communication topic
// TODO document protocol itself better (who sends who what with which semantic)
// TODO document protocol itself better (who sends who what with which semantic)
...
@@ -291,7 +292,8 @@ type RowInfo struct {
...
@@ -291,7 +292,8 @@ type RowInfo struct {
// Error is a special type of message, because this can be sent against
// Error is a special type of message, because this can be sent against
// any other message, even if such a message does not expect a reply
// any other message, even if such a message does not expect a reply
// usually. Any -> Any.
// usually. Any -> Any.
// FIXME -> |RESPONSE_MASK
//
//neo:proto answer
type
Error
struct
{
type
Error
struct
{
Code
ErrorCode
// PNumber
Code
ErrorCode
// PNumber
Message
string
Message
string
...
@@ -317,9 +319,10 @@ type AcceptIdentification struct {
...
@@ -317,9 +319,10 @@ type AcceptIdentification struct {
}
}
// Check if a peer is still alive. Any -> Any.
// Check if a peer is still alive. Any -> Any.
type
Ping
struct
{
type
Ping
struct
{}
// TODO _answer = PFEmpty
}
//neo:proto answer
type
Pong
struct
{}
// Tell peer it can close the connection if it has finished with us. Any -> Any
// Tell peer it can close the connection if it has finished with us. Any -> Any
type
CloseClient
struct
{
type
CloseClient
struct
{
...
@@ -341,6 +344,13 @@ type NotPrimaryMaster struct {
...
@@ -341,6 +344,13 @@ type NotPrimaryMaster struct {
}
}
}
}
// Notify information about one or more nodes. PM -> Any.
type
NotifyNodeInformation
struct
{
// XXX in py this is monotonic_time() of call to broadcastNodesInformation() & friends
IdTimestamp
float64
NodeList
[]
NodeInfo
}
// Ask all data needed by master to recover. PM -> S, S -> PM.
// Ask all data needed by master to recover. PM -> S, S -> PM.
type
Recovery
struct
{
type
Recovery
struct
{
}
}
...
@@ -722,13 +732,6 @@ type TweakPartitionTable struct {
...
@@ -722,13 +732,6 @@ type TweakPartitionTable struct {
// XXX _answer = Error
// XXX _answer = Error
}
}
// Notify information about one or more nodes. PM -> Any.
type
NotifyNodeInformation
struct
{
// XXX in py this is monotonic_time() of call to broadcastNodesInformation() & friends
IdTimestamp
float64
NodeList
[]
NodeInfo
}
// Ask node information
// Ask node information
type
NodeInformation
struct
{
type
NodeInformation
struct
{
// XXX _answer = PFEmpty
// XXX _answer = PFEmpty
...
...
go/neo/protogen.go
View file @
3e4d0dd7
...
@@ -293,7 +293,10 @@ import (
...
@@ -293,7 +293,10 @@ import (
}
}
// generate code for this type to implement neo.Msg
// generate code for this type to implement neo.Msg
msgCode
:=
MsgCode
{
msgSerial
,
specAnnotation
.
answer
}
msgCode
:=
MsgCode
{
msgSerial
:
msgSerial
,
answer
:
specAnnotation
.
answer
||
strings
.
HasPrefix
(
typename
,
"Answer"
),
}
fmt
.
Fprintf
(
&
buf
,
"// %d. %s"
,
msgSerial
,
typename
)
fmt
.
Fprintf
(
&
buf
,
"// %d. %s"
,
msgSerial
,
typename
)
if
specAnnotation
.
answer
{
if
specAnnotation
.
answer
{
...
...
go/neo/zproto-marshal.go
View file @
3e4d0dd7
This diff is collapsed.
Click to expand it.
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