From 64bff0caaf665c65125cdab2b144f3594d520002 Mon Sep 17 00:00:00 2001 From: lichao <lichao@aiotlink.com> Date: 星期二, 20 四月 2021 18:39:52 +0800 Subject: [PATCH] go api works. refactor. --- proto/source/bhome_msg.proto | 50 +++++++++++++++++++++++++++++++++----------------- 1 files changed, 33 insertions(+), 17 deletions(-) diff --git a/proto/source/bhome_msg.proto b/proto/source/bhome_msg.proto index 5056a26..aabe372 100644 --- a/proto/source/bhome_msg.proto +++ b/proto/source/bhome_msg.proto @@ -1,11 +1,12 @@ syntax = "proto3"; option optimize_for = LITE_RUNTIME; +option go_package="./bhome_msg"; // import "google/protobuf/descriptor.proto"; import "bhome_msg_api.proto"; import "error_msg.proto"; -package bhome.msg; +package bhome_msg; // message format : head_len(4) + head(BHMsgHead) + body_len(4) + body(variable types) @@ -19,22 +20,6 @@ bytes topic = 6; // for request route } -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; @@ -62,7 +47,38 @@ } +message MsgSubscribe { + MsgTopicList topics = 1; +} +message MsgUnsubscribe { + MsgTopicList topics = 1; +} +message MsgRegisterRPC { + MsgTopicList topics = 1; +} + service TopicRPC { rpc Query (MsgQueryTopic) returns (MsgQueryTopicReply); rpc Request (MsgRequestTopic) returns (MsgQueryTopicReply); } + +message MsgRequest { + // oneof body; + oneof request { + MsgRegister register = 1; + MsgRequestTopic topic_request = 2; + MsgQueryTopic topic_query = 3; + } +} + +message MsgReply { + ErrorMsg err_msg = 1; + // oneof reply +} + +message BHMsgBody { + oneof reqrep { + MsgRequest request = 1; + MsgReply reply = 2; + } +} -- Gitblit v1.8.0