introduce fields for drand message

pull/569/head
Minh Doan 6 years ago committed by Minh Doan
parent 57dd53e03d
commit d5bfa934f6
  1. 148
      api/proto/message/message.pb.go
  2. 12
      api/proto/message/message.proto

@ -58,16 +58,19 @@ type ServiceType int32
const (
ServiceType_CONSENSUS ServiceType = 0
ServiceType_STAKING ServiceType = 1
ServiceType_DRAND ServiceType = 2
)
var ServiceType_name = map[int32]string{
0: "CONSENSUS",
1: "STAKING",
2: "DRAND",
}
var ServiceType_value = map[string]int32{
"CONSENSUS": 0,
"STAKING": 1,
"DRAND": 2,
}
func (x ServiceType) String() string {
@ -88,6 +91,8 @@ const (
MessageType_PREPARED MessageType = 3
MessageType_COMMIT MessageType = 4
MessageType_COMMITTED MessageType = 5
MessageType_DRAND_INIT MessageType = 6
MessageType_DRAND_COMMIT MessageType = 7
)
var MessageType_name = map[int32]string{
@ -97,6 +102,8 @@ var MessageType_name = map[int32]string{
3: "PREPARED",
4: "COMMIT",
5: "COMMITTED",
6: "DRAND_INIT",
7: "DRAND_COMMIT",
}
var MessageType_value = map[string]int32{
@ -106,6 +113,8 @@ var MessageType_value = map[string]int32{
"PREPARED": 3,
"COMMIT": 4,
"COMMITTED": 5,
"DRAND_INIT": 6,
"DRAND_COMMIT": 7,
}
func (x MessageType) String() string {
@ -129,6 +138,7 @@ type Message struct {
// Types that are valid to be assigned to Request:
// *Message_Staking
// *Message_Consensus
// *Message_Drand
Request isMessage_Request `protobuf_oneof:"request"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
@ -200,10 +210,16 @@ type Message_Consensus struct {
Consensus *ConsensusRequest `protobuf:"bytes,6,opt,name=consensus,proto3,oneof"`
}
type Message_Drand struct {
Drand *DrandRequest `protobuf:"bytes,7,opt,name=drand,proto3,oneof"`
}
func (*Message_Staking) isMessage_Request() {}
func (*Message_Consensus) isMessage_Request() {}
func (*Message_Drand) isMessage_Request() {}
func (m *Message) GetRequest() isMessage_Request {
if m != nil {
return m.Request
@ -225,11 +241,19 @@ func (m *Message) GetConsensus() *ConsensusRequest {
return nil
}
func (m *Message) GetDrand() *DrandRequest {
if x, ok := m.GetRequest().(*Message_Drand); ok {
return x.Drand
}
return nil
}
// XXX_OneofWrappers is for the internal use of the proto package.
func (*Message) XXX_OneofWrappers() []interface{} {
return []interface{}{
(*Message_Staking)(nil),
(*Message_Consensus)(nil),
(*Message_Drand)(nil),
}
}
@ -281,8 +305,6 @@ func (m *StakingRequest) GetNodeId() string {
return ""
}
// Consensus request.
// TODO: Will organize more later.
type ConsensusRequest struct {
ConsensusId uint32 `protobuf:"varint,1,opt,name=consensus_id,json=consensusId,proto3" json:"consensus_id,omitempty"`
BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
@ -346,6 +368,61 @@ func (m *ConsensusRequest) GetPayload() []byte {
return nil
}
type DrandRequest struct {
SenderId uint32 `protobuf:"varint,1,opt,name=sender_id,json=senderId,proto3" json:"sender_id,omitempty"`
BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"`
Payload []byte `protobuf:"bytes,3,opt,name=payload,proto3" json:"payload,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func (m *DrandRequest) Reset() { *m = DrandRequest{} }
func (m *DrandRequest) String() string { return proto.CompactTextString(m) }
func (*DrandRequest) ProtoMessage() {}
func (*DrandRequest) Descriptor() ([]byte, []int) {
return fileDescriptor_33c57e4bae7b9afd, []int{3}
}
func (m *DrandRequest) XXX_Unmarshal(b []byte) error {
return xxx_messageInfo_DrandRequest.Unmarshal(m, b)
}
func (m *DrandRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
return xxx_messageInfo_DrandRequest.Marshal(b, m, deterministic)
}
func (m *DrandRequest) XXX_Merge(src proto.Message) {
xxx_messageInfo_DrandRequest.Merge(m, src)
}
func (m *DrandRequest) XXX_Size() int {
return xxx_messageInfo_DrandRequest.Size(m)
}
func (m *DrandRequest) XXX_DiscardUnknown() {
xxx_messageInfo_DrandRequest.DiscardUnknown(m)
}
var xxx_messageInfo_DrandRequest proto.InternalMessageInfo
func (m *DrandRequest) GetSenderId() uint32 {
if m != nil {
return m.SenderId
}
return 0
}
func (m *DrandRequest) GetBlockHash() []byte {
if m != nil {
return m.BlockHash
}
return nil
}
func (m *DrandRequest) GetPayload() []byte {
if m != nil {
return m.Payload
}
return nil
}
func init() {
proto.RegisterEnum("message.ReceiverType", ReceiverType_name, ReceiverType_value)
proto.RegisterEnum("message.ServiceType", ServiceType_name, ServiceType_value)
@ -353,40 +430,45 @@ func init() {
proto.RegisterType((*Message)(nil), "message.Message")
proto.RegisterType((*StakingRequest)(nil), "message.StakingRequest")
proto.RegisterType((*ConsensusRequest)(nil), "message.ConsensusRequest")
proto.RegisterType((*DrandRequest)(nil), "message.DrandRequest")
}
func init() { proto.RegisterFile("message.proto", fileDescriptor_33c57e4bae7b9afd) }
var fileDescriptor_33c57e4bae7b9afd = []byte{
// 477 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x93, 0xcf, 0x6e, 0x9b, 0x40,
0x10, 0xc6, 0x8d, 0xed, 0x98, 0x30, 0xe0, 0x68, 0xb5, 0x6a, 0x1b, 0xf7, 0x9f, 0xe4, 0xfa, 0xe4,
0xfa, 0x90, 0x43, 0x72, 0xa8, 0xda, 0x1b, 0xb6, 0x57, 0x0d, 0x8a, 0xbd, 0x44, 0x0b, 0x69, 0x8f,
0x88, 0xc0, 0xca, 0x46, 0x49, 0xc0, 0x65, 0x71, 0x24, 0x3f, 0x43, 0x9f, 0xaa, 0x6f, 0x56, 0xed,
0x02, 0x86, 0xe4, 0xc6, 0xf7, 0xcd, 0xfc, 0xe6, 0x5b, 0xcd, 0x08, 0x18, 0x3e, 0x71, 0x21, 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, 0xd4, 0x15, 0xa0, 0x3e, 0xf4, 0xe4, 0xf7, 0x7c, 0xfd,
0x2f, 0x00, 0x00, 0xff, 0xff, 0xa7, 0xfe, 0xce, 0xbf, 0xe0, 0x03, 0x00, 0x00,
}

@ -13,6 +13,7 @@ enum ReceiverType {
enum ServiceType {
CONSENSUS = 0;
STAKING = 1;
DRAND = 2;
}
// MessageType indicates what is the type of this message.
@ -23,6 +24,8 @@ enum MessageType {
PREPARED = 3;
COMMIT = 4;
COMMITTED = 5;
DRAND_INIT = 6;
DRAND_COMMIT = 7;
}
// This is universal message for all communication protocols.
@ -38,6 +41,7 @@ message Message {
oneof request {
StakingRequest staking = 5;
ConsensusRequest consensus = 6;
DrandRequest drand = 7;
}
}
@ -47,11 +51,15 @@ message StakingRequest {
string node_id = 2;
}
// Consensus request.
// TODO: Will organize more later.
message ConsensusRequest {
uint32 consensus_id = 1;
bytes block_hash = 2;
uint32 sender_id = 3;
bytes payload = 4;
}
message DrandRequest {
uint32 sender_id = 1; // TODO: make it public key
bytes block_hash = 2;
bytes payload = 3;
}
Loading…
Cancel
Save