| 92 | } |
| 93 | |
| 94 | comm::RetCode SimpleConsumer::GetQueueByAddrScale(const std::vector<consumer::Queue_t> &queues, |
| 95 | const consumer::AddrScales &addr_scales, |
| 96 | std::set<size_t> &queue_idxs) { |
| 97 | queue_idxs.clear(); |
| 98 | |
| 99 | auto opt = GetConsumerOption(); |
| 100 | |
| 101 | comm::proto::Addr addr; |
| 102 | addr.set_ip(opt->ip); |
| 103 | addr.set_port(opt->port); |
| 104 | addr.set_paxos_port(opt->paxos_port); |
| 105 | |
| 106 | size_t i; |
| 107 | for (i = 0; i < addr_scales.size(); ++i) { |
| 108 | auto &&addr_scale = addr_scales[i]; |
| 109 | if (addr.ip() == addr_scale.addr().ip() && |
| 110 | addr.port() == addr_scale.addr().port() && |
| 111 | addr.paxos_port() == addr_scale.addr().paxos_port()) { |
| 112 | break; |
| 113 | } |
| 114 | } |
| 115 | if (i == addr_scales.size()) { |
| 116 | QLErr("local addr not found"); |
| 117 | } |
| 118 | |
| 119 | for (size_t j{0}; j < queues.size(); ++j) { |
| 120 | auto &&queue = queues[j]; |
| 121 | if (i == (queue.queue_id % addr_scales.size())) { |
| 122 | queue_idxs.insert(j); |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | return comm::RetCode::RET_OK; |
| 127 | } |
| 128 | |
| 129 | comm::RetCode SimpleConsumer::GetLockInfo(const comm::proto::GetLockInfoRequest &req, |
| 130 | comm::proto::GetLockInfoResponse &resp) { |
nothing calls this directly
no outgoing calls
no test coverage detected