| 114 | } |
| 115 | |
| 116 | void MultiGetCommand::OnMultiGetCommandOneResponse(int resp_code, std::string& key, std::string& value) { |
| 117 | if (resp_code == PROTOCOL_BINARY_RESPONSE_SUCCESS || resp_code == PROTOCOL_BINARY_RESPONSE_KEY_ENOENT) { |
| 118 | auto& result_map = get_handler()->get_result(); |
| 119 | auto it = result_map.find(key); |
| 120 | assert(it != result_map.end()); |
| 121 | auto& get_result = it->second; |
| 122 | get_result.code = resp_code; |
| 123 | get_result.value.swap(value); |
| 124 | } else { //返回值不带key,将serverid对应的key都设置为resp_code |
| 125 | auto& keys = get_handler()->FindKeysByid(vbucket_id()); |
| 126 | auto& result_map = get_handler()->get_result(); |
| 127 | auto k = result_map.begin(); |
| 128 | for (auto& it : keys) { |
| 129 | k = result_map.find(it); |
| 130 | assert(k != result_map.end()); |
| 131 | k->second.code = resp_code; |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | void MultiGetCommand::PacketRequest(const std::vector<std::string>& keys, |
| 137 | const std::vector<uint16_t>& vbuckets, const uint32_t id, std::string& buf) { |
no test coverage detected