lichao
2021-04-08 c338820e4db43ad32c20ff429a038b06bcb980f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
syntax = "proto3";
option optimize_for = LITE_RUNTIME;
 
// import "google/protobuf/descriptor.proto";
import "bhome_msg_api.proto";
 
package bhome.msg;
 
 
// 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 { // deprecated
    bytes msg_id = 1;
    int64 timestamp = 2;
    int32 type = 3;
    repeated BHAddress route = 4; // for reply and proxy.
    bytes body = 5;
}
 
enum MsgType {
    kMsgTypeInvalid = 0;
    kMsgTypeRawData = 1;
 
    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;
 
}
 
service TopicRPC {
    rpc Query (MsgQueryTopic) returns (MsgQueryTopicReply);
    rpc Request (MsgRequestTopic) returns (MsgQueryTopicReply);
}