MCPcopy Create free account
hub / github.com/4paradigm/OpenMLDB / HandleClientCount

Function HandleClientCount

src/cmd/fedb.cc:4365–4476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4363}
4364
4365void HandleClientCount(const std::vector<std::string>& parts,
4366 ::fedb::client::TabletClient* client) {
4367 if (parts.size() < 4) {
4368 std::cout << "count format error! eg. count tid pid key [col_name] "
4369 "[filter_expired_data] | count tid=xxx pid=xxx key=xxx "
4370 "index_name=xxx ts=xxx ts_name=xxx [filter_expired_data]"
4371 << std::endl;
4372 return;
4373 }
4374 std::map<std::string, std::string> parameter_map;
4375 if (!GetParameterMap("tid", parts, "=", parameter_map)) {
4376 std::cout << "count format erro! eg. count tid=xxx pid=xxx key=xxx "
4377 "index_name=xxx ts=xxx ts_name=xxx [filter_expired_data]"
4378 << std::endl;
4379 return;
4380 }
4381 bool is_pair_format = parameter_map.empty() ? false : true;
4382 uint32_t tid = 0;
4383 uint32_t pid = 0;
4384 bool filter_expired_data = false;
4385 std::string key;
4386 std::string index_name;
4387 std::string ts_name;
4388 uint64_t value = 0;
4389 auto iter = parameter_map.begin();
4390 try {
4391 if (is_pair_format) {
4392 iter = parameter_map.find("tid");
4393 if (iter != parameter_map.end()) {
4394 tid = boost::lexical_cast<uint32_t>(iter->second);
4395 } else {
4396 std::cout << "count format error: tid does not exist!"
4397 << std::endl;
4398 return;
4399 }
4400 iter = parameter_map.find("pid");
4401 if (iter != parameter_map.end()) {
4402 pid = boost::lexical_cast<uint32_t>(iter->second);
4403 } else {
4404 std::cout << "count format error: pid does not exist!"
4405 << std::endl;
4406 return;
4407 }
4408 iter = parameter_map.find("key");
4409 if (iter != parameter_map.end()) {
4410 key = iter->second;
4411 } else {
4412 std::cout << "count format error: key does not exist!"
4413 << std::endl;
4414 return;
4415 }
4416 iter = parameter_map.find("index_name");
4417 if (iter != parameter_map.end()) {
4418 index_name = iter->second;
4419 }
4420 iter = parameter_map.find("ts_name");
4421 if (iter != parameter_map.end()) {
4422 ts_name = iter->second;

Callers 1

StartClientFunction · 0.85

Calls 4

GetParameterMapFunction · 0.85
sizeMethod · 0.45
emptyMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected