From 4b7d72629bb5b913b312769bd1757e141928b2de Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期五, 16 四月 2021 14:27:02 +0800
Subject: [PATCH] add status box function; center run single inst.

---
 proto/source/bhome_msg.proto |  120 ++++++++++++++++++++++++++++++-----------------------------
 1 files changed, 61 insertions(+), 59 deletions(-)

diff --git a/proto/source/bhome_msg.proto b/proto/source/bhome_msg.proto
index 149d8ee..11ff5a2 100644
--- a/proto/source/bhome_msg.proto
+++ b/proto/source/bhome_msg.proto
@@ -1,76 +1,78 @@
 syntax = "proto3";
-
 option optimize_for = LITE_RUNTIME;
+
+// import "google/protobuf/descriptor.proto";
+import "bhome_msg_api.proto";
+import "error_msg.proto";
 
 package bhome.msg;
 
-message BHAddress {
-	bytes mq_id = 1; // mqid, uuid
-	bytes ip = 2;   //
-	int32 port = 3;
+
+// message format : head_len(4) + head(BHMsgHead) + body_len(4) + body(variable types)
+
+message BHMsgHead {
+	bytes msg_id = 1;
+	repeated BHAddress route = 2; // for reply and proxy.
+	int64 timestamp = 3;
+	int32 type = 4;
+	bytes proc_id = 5;
+	bytes topic = 6; // for request route
 }
 
-message BHMsg {
-	bytes msg_id = 1;
-	int64 timestamp = 2;
-	int32 type = 3;
-	repeated BHAddress route = 4; // for reply and proxy.
-	bytes body = 5;
+message MsgRequest {
+	MsgType type = 1;
+	// oneof body;
+}
+
+message MsgReply {
+	ErrorMsg err_msg = 1;
+	// oneof reply
+}
+
+message BHMsgBody {
+	oneof reqrep {
+		MsgRequest request = 1;
+		MsgReply reply = 2;
+	}
 }
 
 enum MsgType {
 	kMsgTypeInvalid = 0;
-	kMsgTypeRequest = 1;
-	kMsgTypeReply = 2;
-	kMsgTypePublish = 3;
-	kMsgTypeSubscribe = 4;
-	kMsgTypeUnsubscribe = 5;
+	kMsgTypeRawData = 1;
 
-	kMsgTypeProcQueryTopic = 6;
-	kMsgTypeProcQueryTopicReply = 7;
-	kMsgTypeProcRegisterTopics = 8;
-	kMsgTypeProcHeartbeat = 9;
+	kMsgTypeCommonReply = 2;
+
+	kMsgTypeRegister= 10;
+	// kMsgTypeRegisterReply= 11;
+	kMsgTypeHeartbeat = 12;
+	// kMsgTypeHeartbeatReply = 13;
+	kMsgTypeQueryTopic = 14;
+	kMsgTypeQueryTopicReply = 15;
+	kMsgTypeRequestTopic = 16;
+	kMsgTypeRequestTopicReply = 17;
+	kMsgTypeRegisterRPC = 18;
+	// reply
+
+	kMsgTypePublish = 20;
+	// kMsgTypePublishReply = 21;
+	kMsgTypeSubscribe = 22;
+	// kMsgTypeSubscribeReply = 23;
+	kMsgTypeUnsubscribe = 24;
+	// kMsgTypeUnsubscribeReply = 25;
+
 }
 
-message DataPub {
-	bytes topic = 1;
-	bytes data = 2; 
+message MsgSubscribe {
+	MsgTopicList topics = 1;
+}
+message MsgUnsubscribe {
+	MsgTopicList topics = 1;
+}
+message MsgRegisterRPC {
+	MsgTopicList topics = 1;
 }
 
-message DataSub {
-	repeated bytes topics = 1;
-}
-
-message DataRequest {
-	bytes topic = 1;
-	bytes data = 2; 
-}
-
-message DataReply {
-	bytes data = 1; 
-}
-
-message ProcInfo
-{
-	bytes name = 1;
-	bytes info = 2;
-}
-
-message DataProcRegister
-{
-	ProcInfo proc = 1;
-	repeated bytes topics = 2;
-}
-
-message DataProcHeartbeat
-{
-	ProcInfo proc = 1;
-}
-
-message DataProcQueryTopic {
-	bytes topic = 1;
-}
-
-message DataProcQueryTopicReply {
-	BHAddress address = 1;
+service TopicRPC {
+	rpc Query (MsgQueryTopic) returns (MsgQueryTopicReply);
+	rpc Request (MsgRequestTopic) returns (MsgQueryTopicReply);
 }

--
Gitblit v1.8.0