| | |
| | | bool Heartbeat(ProcInfo &proc, MsgCommonReply &reply_body, const int timeout_ms); |
| | | bool Heartbeat(const int timeout_ms); |
| | | bool QueryTopicAddress(BHAddress &dest, MsgQueryTopic &query, MsgQueryTopicReply &reply_body, const int timeout_ms); |
| | | bool QueryProcs(BHAddress &dest, MsgQueryProc &query, MsgQueryProcReply &reply_body, const int timeout_ms); |
| | | |
| | | // topic rpc server |
| | | typedef std::function<bool(const std::string &client_proc_id, const MsgRequestTopic &request, MsgRequestTopicReply &reply)> ServerSyncCB; |
| | |
| | | int proc_index_ = -1; |
| | | |
| | | TopicQueryCache topic_query_cache_; |
| | | |
| | | class RecvQ |
| | | { |
| | | public: |
| | | void Write(BHMsgHead &&head, std::string &&body) { q_.push_back({std::move(head), std::move(body)}); } |
| | | bool Read(BHMsgHead &head, std::string &body) |
| | | { |
| | | if (q_.empty()) { |
| | | return false; |
| | | } else { |
| | | head = std::move(q_.front().head); |
| | | body = std::move(q_.front().body); |
| | | q_.pop_front(); |
| | | return true; |
| | | } |
| | | } |
| | | |
| | | private: |
| | | struct MsgData { |
| | | BHMsgHead head; |
| | | std::string body; |
| | | }; |
| | | std::deque<MsgData> q_; |
| | | }; |
| | | Synced<RecvQ> server_buffer_; |
| | | Synced<RecvQ> sub_buffer_; |
| | | }; |
| | | |
| | | #endif // end of include guard: TOPIC_NODE_YVKWA6TF |