From 34cd75f77d0ca94dbdba4e6cc9451fe4d33e78b3 Mon Sep 17 00:00:00 2001
From: lichao <lichao@aiotlink.com>
Date: 星期三, 19 五月 2021 19:14:13 +0800
Subject: [PATCH] add api BHQueryProcs.

---
 src/defs.h |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/src/defs.h b/src/defs.h
index 5c770a7..51040e6 100644
--- a/src/defs.h
+++ b/src/defs.h
@@ -19,6 +19,7 @@
 #ifndef DEFS_KP8LKGD0
 #define DEFS_KP8LKGD0
 
+#include "robust.h"
 #include <atomic>
 #include <string>
 
@@ -27,16 +28,16 @@
 int64_t CalcAllocIndex(int64_t size);
 int64_t GetAllocSize(int index);
 
-struct CenterInfo {
-	struct MQInfo {
-		int64_t id_ = 0;
-		int64_t offset_ = 0;
-	};
+struct MQInfo {
+	MQId id_ = 0;
+	int64_t offset_ = 0;
+};
 
+struct CenterInfo {
 	MQInfo mq_center_;
 	MQInfo mq_bus_;
-	MQInfo mq_init_;
 	MQInfo mq_sender_;
+	robust::AtomicReqRep init_rr_;
 	std::atomic<MQId> mqid_;
 	CenterInfo() :
 	    mqid_(100000) {}
@@ -59,9 +60,13 @@
 void GetLastError(int &ec, std::string &msg);
 //TODO center can check shm for previous crash.
 
-uint64_t BHGlobalSenderAddress();
-uint64_t BHTopicCenterAddress();
-uint64_t BHTopicBusAddress();
-uint64_t BHCenterReplyAddress();
+const MQInfo &BHGlobalSenderAddress();
+const MQInfo &BHTopicCenterAddress();
+const MQInfo &BHTopicBusAddress();
+bool BHNodeInit(const int64_t request, int64_t &reply);
+void BHCenterHandleInit(std::function<int64_t(const int64_t)> const &onReq);
+
+// node mq is avail with in timeout; after that may get killed.
+int NodeTimeoutSec();
 
 #endif // end of include guard: DEFS_KP8LKGD0

--
Gitblit v1.8.0