| 73 | |
| 74 | |
| 75 | comm::RetCode ConsumerConfig::Rebuild() { |
| 76 | bool need_check = NeedCheck(); |
| 77 | |
| 78 | impl_->addr2consumer.clear(); |
| 79 | |
| 80 | auto &&proto = GetProto(); |
| 81 | |
| 82 | for (int i{0}; i < proto.consumers_size(); ++i) { |
| 83 | const auto &consumer(proto.consumers(i)); |
| 84 | if (need_check) PHX_ASSERT(impl_->addr2consumer.end() == impl_->addr2consumer.find(comm::utils::EncodeAddr(consumer.addr())), ==, true); |
| 85 | impl_->addr2consumer.emplace(comm::utils::EncodeAddr(consumer.addr()), make_shared<proto::Consumer>(consumer)); |
| 86 | } |
| 87 | return comm::RetCode::RET_OK; |
| 88 | } |
| 89 | |
| 90 | comm::RetCode ConsumerConfig::GetAllConsumer(std::vector<shared_ptr<const proto::Consumer>> &consumers) const { |
| 91 | for (auto &&it : impl_->addr2consumer) { |
nothing calls this directly
no test coverage detected