| 4004 | } |
| 4005 | |
| 4006 | void HandleClientSetLimit(const std::vector<std::string> parts, |
| 4007 | ::fedb::client::TabletClient* client) { |
| 4008 | if (parts.size() < 3) { |
| 4009 | std::cout << "Bad set limit format" << std::endl; |
| 4010 | return; |
| 4011 | } |
| 4012 | try { |
| 4013 | std::string key = parts[1]; |
| 4014 | if (std::isupper(key[0])) { |
| 4015 | std::string subname = key.substr(1); |
| 4016 | for (char e : subname) { |
| 4017 | if (std::isupper(e)) { |
| 4018 | std::cout << "Invalid args name which should be Put , Scan " |
| 4019 | ", Get or Server" |
| 4020 | << std::endl; |
| 4021 | return; |
| 4022 | } |
| 4023 | } |
| 4024 | } else { |
| 4025 | std::cout << "Invalid args name which should be Put , Scan , Get " |
| 4026 | "or Server" |
| 4027 | << std::endl; |
| 4028 | return; |
| 4029 | } |
| 4030 | int32_t limit = boost::lexical_cast<int32_t>(parts[2]); |
| 4031 | bool ok = client->SetMaxConcurrency(key, limit); |
| 4032 | if (ok) { |
| 4033 | std::cout << "Set Limit ok" << std::endl; |
| 4034 | } else { |
| 4035 | std::cout << "Fail to set limit" << std::endl; |
| 4036 | } |
| 4037 | } catch (boost::bad_lexical_cast& e) { |
| 4038 | std::cout << "Bad set limit format" << std::endl; |
| 4039 | } |
| 4040 | } |
| 4041 | |
| 4042 | void HandleClientChangeRole(const std::vector<std::string> parts, |
| 4043 | ::fedb::client::TabletClient* client) { |
no test coverage detected