提交 61bccc25 authored 作者: blu's avatar blu

new feature entropy filter to ignore gray frame without iframe

上级 5c329844
......@@ -4,5 +4,6 @@
"files.associations": {
"chrono": "cpp",
"optional": "cpp"
}
},
"C_Cpp.errorSquiggles": "Disabled"
}
\ No newline at end of file
......@@ -209,6 +209,27 @@ namespace LVDB {
return 0;
}
vector<string> getKeys(string fileName) {
DB* pdb = NULL;
if(fileName.empty()) {
fileName = LVDB_FILE_GENERAL;
}
vector<string> vec;
int ret = 0;
ret = _getDB(fileName, &pdb);
if(ret < 0) {
//
}else{
Iterator* it = pdb->NewIterator(leveldb::ReadOptions());
for (it->SeekToFirst(); it->Valid(); it->Next()) {
vec.push_back(it->key().ToString());
}
delete it;
delete pdb;
}
return vec;
}
int getValue(string &value, string key, string fileName, cb_verify_str cb) {
int ret = 0;
DB* pdb = NULL;
......
......@@ -159,14 +159,18 @@ class HttpSrv{
if(sn.empty()||module.empty()){
throw StrException("no para sn/module");
}
string modname = module.substr(0,4);
string key, modname;
if(module == "evmgr") {
key = sn;
}else {
if(modname == "evml") {
modname = "evml:" + module.substr(4, module.size());
}else{
modname = module;
}
string key = sn + ":" + modname;
key = sn + ":" + modname;
}
if(this->configMap.count(key) == 0){
//
......@@ -181,7 +185,7 @@ class HttpSrv{
// TODO: calc md5
int r;
ret["code"] = 0;
ret["msg"] = "ok";
ret["msg"] = "all ready exist";
string dk = this->configMap[key];
json data;
r = LVDB::getLocalConfig(data, dk);
......@@ -230,7 +234,7 @@ class HttpSrv{
if(!key.empty()) {
json config;
int iret = LVDB::getLocalConfig(config, key);
int iret = LVDB::getLocalConfig(config, this->configMap[key]);
if(iret < 0) {
ret["code"] = 1;
ret["msg"] = "evcloud failed to get config with k, v:" + key + " " + this->configMap[key].get<string>();
......@@ -257,6 +261,26 @@ class HttpSrv{
});
svr.Get("/keys", [](const Request& req, Response& res){
string fileName = req.get_param_value("filename");
auto v = LVDB::getKeys(fileName);
json ret = v;
res.set_content(ret.dump(), "text/json");
});
svr.Get("/value", [](const Request& req, Response& res){
string key = req.get_param_value("key");
string filename = req.get_param_value("filename");
json j;
int ret = LVDB::getValue(j, key, filename);
if(ret < 0) {
j["code"] = 1;
}else{
j["code"] = 0;
}
res.set_content(j.dump(), "text/json");
});
svr.listen("0.0.0.0", 8089);
}
......
......@@ -34,6 +34,8 @@ namespace LVDB {
json * findConfigModule(json &config, string sn, string moduleName, int iid);
//
int delValue(string key, string fileName);
//
vector<string> getKeys(string fileName = "");
// sn, updatetime, boottime
int setSn(json &info,string fileName=LVDB_FILE_GENERAL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论