提交 48d2f886 authored 作者: blu's avatar blu

upload video files

上级 d7ccb6c0
...@@ -93,7 +93,9 @@ ...@@ -93,7 +93,9 @@
"*.tcc": "cpp", "*.tcc": "cpp",
"memory_resource": "cpp", "memory_resource": "cpp",
"csignal": "cpp", "csignal": "cpp",
"__functional_03": "cpp" "__functional_03": "cpp",
"variant": "cpp",
"format": "cpp"
}, },
"C_Cpp.errorSquiggles": "Disabled" "C_Cpp.errorSquiggles": "Disabled"
} }
\ No newline at end of file
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
], ],
"evpusher":[ "evpusher":[
{ {
"enabled":0, "enabled":1,
"iid":1, "iid":1,
"password":"", "password":"",
"sn":"PSBV7GKN", "sn":"PSBV7GKN",
......
...@@ -162,8 +162,9 @@ set or change configuration for edge device ...@@ -162,8 +162,9 @@ set or change configuration for edge device
} }
``` ```
2. patch configure (POST /config?patch=true&sn=NMXH73Y2) 2. patch configure (POST /config?patch=true&sn=NMXH73Y2)
- SN in path may not be same with sn in param. since a module on this device may connects cluster mgr on other deivce.
``` ```
[{"op":"add","path":"/ipcs/0/modules/evpuller/0/enabled","value":1}] [{"op":"add","path":"/RBKJ62Z1/ipcs/0/modules/evpuller/0/enabled","value":1}]
``` ```
##### return ##### return
- type: json - type: json
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include <iterator> #include <iterator>
#include <vector> #include <vector>
#include <string> #include <string>
#include <fstream>
#include <set> #include <set>
#include "json.hpp" #include "json.hpp"
#include <spdlog/spdlog.h> #include <spdlog/spdlog.h>
...@@ -18,8 +19,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st ...@@ -18,8 +19,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
ret["msg"] = "ok"; ret["msg"] = "ok";
ret["data"] = json(); ret["data"] = json();
bool hasError = false; bool hasError = false;
spdlog::info("matching {}", diff.dump());
try{ try{
for(auto &d: diff) { for(auto &d: diff.array()) {
spdlog::info("d :{}, {}", d.dump(), d.size());
if(d.count("path") != 0) { if(d.count("path") != 0) {
string path_ = d["path"]; string path_ = d["path"];
bool matched = false; bool matched = false;
...@@ -32,8 +35,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st ...@@ -32,8 +35,10 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
string ipcRegStr = string("/") + sn + "/ipcs/(\\d+)/(\\w+)"; string ipcRegStr = string("/") + sn + "/ipcs/(\\d+)/(\\w+)";
std::smatch results; std::smatch results;
std::regex ipcRegex(ipcRegStr); std::regex ipcRegex(ipcRegStr);
spdlog::info("x diff: {}", diff.dump());
if (std::regex_match(path_, results, ipcRegex)) { if (std::regex_match(path_, results, ipcRegex)) {
if (results.size() == 3) { if (results.size() == 3) {
spdlog::info("matched ipc: {}",path_);
matched = true; matched = true;
int ipcIdx = stoi(results[1].str()); int ipcIdx = stoi(results[1].str());
string tag = results[2].str(); string tag = results[2].str();
...@@ -71,7 +76,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st ...@@ -71,7 +76,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
} }
} }
} }
}else{
for(auto &i: results) {
spdlog::info("\t{}", i.str());
}
} }
}else{
spdlog::info("no match for ipc", path_);
} }
// match module config // match module config
...@@ -82,6 +93,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st ...@@ -82,6 +93,7 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
std::smatch results2; std::smatch results2;
if (std::regex_match(path_, results2, moduleRegex)) { if (std::regex_match(path_, results2, moduleRegex)) {
if (results2.size() == 5) { if (results2.size() == 5) {
spdlog::info("matched module: {}",path_);
int ipcIdx = stoi(results2[1].str()); int ipcIdx = stoi(results2[1].str());
int modIdx = stoi(results[3].str()); int modIdx = stoi(results[3].str());
string modName = results[2].str(); string modName = results[2].str();
...@@ -131,7 +143,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st ...@@ -131,7 +143,13 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
} }
} }
} }
}else{
for(auto &i: results) {
spdlog::info("\t{}", i.str());
}
} }
}else{
spdlog::info("no match for module {}", path_);
} }
} }
...@@ -151,30 +169,15 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st ...@@ -151,30 +169,15 @@ json getModulesOperFromConfDiff(json& oldConfig, json &newConfig, json &diff, st
int main(){ int main(){
// (?:addr|password|port|user) std::ifstream iff("deployment/config.json");
string ipcPath = "/NMXH73Y2/ipcs/0/addr"; std::ifstream iff2("deployment/config_copy.json");
string ipcRegStr = string("/NMXH73Y2") + "/ipcs/(\\d+)/(\\w+)"; json config, config2;
std::smatch results; iff >> config;
std::regex ipcRegex(ipcRegStr); config = config["data"];
if (std::regex_match(ipcPath, results, ipcRegex)) { iff2 >> config2;
if (results.size() == 3) { config2 = config2["data"];
for(auto &v: results) { json dif = json::diff(config2, config).dump();
cout<< v.str() << endl; spdlog::info("diff: {}", dif.dump());
} auto ret = getModulesOperFromConfDiff(config2, config, dif, "PSBV7GKN");
} spdlog::info("parse: {}", ret.dump());
}
cout << "match2:" << endl;
string modulePath = "/NMXH73Y2/ipcs/0/modules/evpusher/0/urlDest";
string moduleRegStr = "/NMXH73Y2/ipcs/(\\d+)/modules/(\\w+)/(\\d+)/(\\w+)";
std::regex moduleRegex(moduleRegStr);
std::smatch results2;
if (std::regex_match(modulePath, results2, moduleRegex)) {
if (results2.size() == 5) {
for(auto &v: results2) {
cout<< v.str() << endl;
}
}
}
} }
\ No newline at end of file
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论