| 95 | } |
| 96 | |
| 97 | comm::RetCode ConsumerConfig::GetConsumerByAddr(const comm::proto::Addr &addr, shared_ptr<const proto::Consumer> &consumer) const { |
| 98 | auto &&encoded_addr = comm::utils::EncodeAddr(addr); |
| 99 | auto &&it = impl_->addr2consumer.find(encoded_addr); |
| 100 | if (impl_->addr2consumer.end() == it) return comm::RetCode::RET_ERR_RANGE_ADDR; |
| 101 | consumer = it->second; |
| 102 | return comm::RetCode::RET_OK; |
| 103 | } |
| 104 | |
| 105 | |
| 106 | } // namespace config |