Commit 3e4d0dd7 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bc16d2ee
...@@ -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
......
...@@ -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 {
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment