提交 b33706cc authored 作者: blu's avatar blu

revisiting all TODOs

上级 e4c1e6c7
...@@ -26,7 +26,7 @@ string _config_default_tmpl = "{\"time\":0,\"code\":0,\"data\":{\"<SN_MGR>\":{\" ...@@ -26,7 +26,7 @@ string _config_default_tmpl = "{\"time\":0,\"code\":0,\"data\":{\"<SN_MGR>\":{\"
const string _sn_tmpl[] = {"<SN_MGR>", "<SN_PULLER>", "<SN_PUSHER>", "<SN_SLICER>", "<SN_ML>"}; const string _sn_tmpl[] = {"<SN_MGR>", "<SN_PULLER>", "<SN_PUSHER>", "<SN_SLICER>", "<SN_ML>"};
const string _addr_tmpl[] = {"<ADDR_CAMERA>"}; const string _addr_tmpl[] = {"<ADDR_CAMERA>"};
// TODO: // TODO: move to evcloudsvc ?
string getStrRand(int length) string getStrRand(int length)
{ {
static bool bRand = false; static bool bRand = false;
......
...@@ -250,8 +250,8 @@ private: ...@@ -250,8 +250,8 @@ private:
} }
if(this->configMap.count(k) ^ this->peerData["config"].count(k)) { if(this->configMap.count(k) ^ this->peerData["config"].count(k)) {
spdlog::warn("evcloudsvc inconsistent configuration for cluster {}", k); spdlog::warn("evcloudsvc inconsistent configuration for cluster {}", k);
// TODO: handle this situation gracefully. // TODO: improvements?
// rmeove both // remove both
this->configMap.erase(k); this->configMap.erase(k);
this->peerData["config"].erase(k); this->peerData["config"].erase(k);
} }
...@@ -491,7 +491,6 @@ private: ...@@ -491,7 +491,6 @@ private:
} }
} }
else { else {
// TODO:
spdlog::warn("evcloudsvc {} received unknown meta {} from {}", devSn, meta, selfId); spdlog::warn("evcloudsvc {} received unknown meta {} from {}", devSn, meta, selfId);
} }
} }
...@@ -805,15 +804,13 @@ public: ...@@ -805,15 +804,13 @@ public:
this->configMap["mod2mgr"].erase(k); this->configMap["mod2mgr"].erase(k);
} }
} }
// TODO: clear peerData
this->configMap.erase(sn); this->configMap.erase(sn);
this->peerData.erase(sn); this->peerData.erase(sn);
spdlog::info("evcloudsvc removed sn: {}", sn); spdlog::info("evcloudsvc removed sn: {}", sn);
// TODO: send config diff to sn
int iret = LVDB::setValue(this->configMap, KEY_CONFIG_MAP); int iret = LVDB::setValue(this->configMap, KEY_CONFIG_MAP);
} }
res.set_content(this->configMap.dump(), "text/json"); res.set_content(this->configMap.dump(), "text/json");
}); });
......
...@@ -520,7 +520,6 @@ private: ...@@ -520,7 +520,6 @@ private:
} }
} }
else { else {
// TODO:
spdlog::warn("evdaemon {} received unknown meta {} from {}", devSn, meta, selfId); spdlog::warn("evdaemon {} received unknown meta {} from {}", devSn, meta, selfId);
} }
} }
...@@ -579,7 +578,6 @@ private: ...@@ -579,7 +578,6 @@ private:
} }
if(bBootstrap) { if(bBootstrap) {
// TODO: wait for previous started modules to connecting
startSubSystems(); startSubSystems();
} }
else { else {
...@@ -665,8 +663,6 @@ public: ...@@ -665,8 +663,6 @@ public:
else { else {
json info; json info;
info["sn"] = sn; info["sn"] = sn;
// TODO:
info["lastboot"] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count(); info["lastboot"] = chrono::duration_cast<chrono::seconds>(chrono::system_clock::now().time_since_epoch()).count();
LVDB::setSn(info); LVDB::setSn(info);
} }
...@@ -689,8 +685,6 @@ public: ...@@ -689,8 +685,6 @@ public:
LVDB::setLocalConfig(newConfig); LVDB::setLocalConfig(newConfig);
spdlog::info("evmgr new config: {}", newConfig.dump()); spdlog::info("evmgr new config: {}", newConfig.dump());
// TODO: restart other components
//
} }
catch(exception &e) { catch(exception &e) {
ret.clear(); ret.clear();
......
...@@ -112,8 +112,6 @@ private: ...@@ -112,8 +112,6 @@ private:
addr = "tcp://*:" + to_string(config["portRouter"]); addr = "tcp://*:" + to_string(config["portRouter"]);
// setup zmq // setup zmq
// TODO: connect to cloud
// router service // router service
pRouterCtx = zmq_ctx_new(); pRouterCtx = zmq_ctx_new();
pRouter = zmq_socket(pRouterCtx, ZMQ_ROUTER); pRouter = zmq_socket(pRouterCtx, ZMQ_ROUTER);
......
...@@ -181,7 +181,6 @@ private: ...@@ -181,7 +181,6 @@ private:
int init() int init()
{ {
int ret = 0; int ret = 0;
// TODO: req config
bool found = false; bool found = false;
try { try {
spdlog::info("evmlmotion boot config: {} -> {}", selfId, config.dump()); spdlog::info("evmlmotion boot config: {} -> {}", selfId, config.dump());
...@@ -364,7 +363,6 @@ private: ...@@ -364,7 +363,6 @@ private:
ret = z_send_multiple(pDealer, body); ret = z_send_multiple(pDealer, body);
if(ret < 0) { if(ret < 0) {
spdlog::error("evmlmotion {} failed to send multiple: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evmlmotion {} failed to send multiple: {}", selfId, zmq_strerror(zmq_errno()));
//TODO:
} }
else { else {
spdlog::info("evmlmotion {} sent hello to router: {}", selfId, mgrSn); spdlog::info("evmlmotion {} sent hello to router: {}", selfId, mgrSn);
...@@ -518,7 +516,6 @@ private: ...@@ -518,7 +516,6 @@ private:
cv::absdiff(gray, avg, thresh); cv::absdiff(gray, avg, thresh);
avg = gray.clone(); avg = gray.clone();
if(!detect || fent < detPara.entropy) { if(!detect || fent < detPara.entropy) {
return; return;
} }
......
...@@ -116,7 +116,6 @@ private: ...@@ -116,7 +116,6 @@ private:
{ {
int ret = 0; int ret = 0;
{ {
// TODO: disable message response before openned input stream
unique_lock<mutex> lk(this->mutMsg); unique_lock<mutex> lk(this->mutMsg);
this->cvMsg.wait(lk, [this] {return this->gotFormat;}); this->cvMsg.wait(lk, [this] {return this->gotFormat;});
} }
...@@ -124,7 +123,7 @@ private: ...@@ -124,7 +123,7 @@ private:
spdlog::info("evpuller {} got inputformat", selfId); spdlog::info("evpuller {} got inputformat", selfId);
try { try {
// rep framectx // rep framectx
// TODO: verify sender id // TODO: verify sender id?
string sMeta = body2str(v[1]); string sMeta = body2str(v[1]);
string peerId = body2str(v[0]); string peerId = body2str(v[0]);
auto meta = json::parse(sMeta); auto meta = json::parse(sMeta);
...@@ -414,7 +413,6 @@ protected: ...@@ -414,7 +413,6 @@ protected:
free(pAVFmtCtxBytes); free(pAVFmtCtxBytes);
} }
// TODO:
if(ret < 0 && !bStopSig) { if(ret < 0 && !bStopSig) {
// reconnect // reconnect
} }
......
...@@ -179,7 +179,6 @@ private: ...@@ -179,7 +179,6 @@ private:
ret = z_send_multiple(pDealer, body); ret = z_send_multiple(pDealer, body);
if(ret < 0) { if(ret < 0) {
spdlog::error("evpusher {} {} failed to send multiple: {}", devSn, iid, zmq_strerror(zmq_errno())); spdlog::error("evpusher {} {} failed to send multiple: {}", devSn, iid, zmq_strerror(zmq_errno()));
//TODO:
} }
else { else {
spdlog::info("evpusher {} sent hello to router: {}", selfId, mgrSn); spdlog::info("evpusher {} sent hello to router: {}", selfId, mgrSn);
......
...@@ -394,7 +394,6 @@ private: ...@@ -394,7 +394,6 @@ private:
ret = z_send_multiple(pDealer, body); ret = z_send_multiple(pDealer, body);
if(ret < 0) { if(ret < 0) {
spdlog::error("evslicer {} failed to send multiple: {}", selfId, zmq_strerror(zmq_errno())); spdlog::error("evslicer {} failed to send multiple: {}", selfId, zmq_strerror(zmq_errno()));
//TODO:
} }
else { else {
spdlog::info("evslicer {} sent hello to router: {}", selfId, mgrSn); spdlog::info("evslicer {} sent hello to router: {}", selfId, mgrSn);
...@@ -929,7 +928,6 @@ public: ...@@ -929,7 +928,6 @@ public:
auto tse = jEvt["end"].get<long>(); auto tse = jEvt["end"].get<long>();
long offsetS = 0; long offsetS = 0;
long offsetE = 0; long offsetE = 0;
// TODO: async
if(tss < this->bootTime) { if(tss < this->bootTime) {
spdlog::warn("evslicer {} should we discard old msg? {} < bootTime {}", selfId, evt, this->bootTime); spdlog::warn("evslicer {} should we discard old msg? {} < bootTime {}", selfId, evt, this->bootTime);
...@@ -1004,8 +1002,7 @@ public: ...@@ -1004,8 +1002,7 @@ public:
cvEvent.notify_one(); cvEvent.notify_one();
} }
}else if(resp["code"] == 6) { }else if(resp["code"] == 6) {
// cloud storage issue // TODO: cloud storage issue. need stratigy policy
// TODO:
} }
} }
} }
......
...@@ -154,7 +154,6 @@ int getPeerId(string modName, json& modElem, string &peerId, string &peerName) ...@@ -154,7 +154,6 @@ int getPeerId(string modName, json& modElem, string &peerId, string &peerName)
json getModuleGidsFromCfg(string sn, json &data, string caller, int ipcIdx) json getModuleGidsFromCfg(string sn, json &data, string caller, int ipcIdx)
{ {
json ret; json ret;
bool hasError = false;
ret["code"] = 0; ret["code"] = 0;
ret["msg"] = "ok"; ret["msg"] = "ok";
ret["data"] = json(); ret["data"] = json();
...@@ -162,7 +161,6 @@ json getModuleGidsFromCfg(string sn, json &data, string caller, int ipcIdx) ...@@ -162,7 +161,6 @@ json getModuleGidsFromCfg(string sn, json &data, string caller, int ipcIdx)
try { try {
// lock_guard<mutex> lock(cacheLock); // lock_guard<mutex> lock(cacheLock);
string peerId; string peerId;
pid_t pid;
for(auto &[k,v]:data.items()) { for(auto &[k,v]:data.items()) {
if(v.count("sn") == 0|| v["sn"].size() == 0 || v.count("ipcs") == 0 || v["ipcs"].size() == 0) { if(v.count("sn") == 0|| v["sn"].size() == 0 || v.count("ipcs") == 0 || v["ipcs"].size() == 0) {
msg += fmt::format( "\t\tcluster {} has no sn/ipcs field {}:{}", v.dump(), __FILE__, __LINE__); msg += fmt::format( "\t\tcluster {} has no sn/ipcs field {}:{}", v.dump(), __FILE__, __LINE__);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论