MCPcopy Create free account
hub / github.com/Tencent/phxqueue / GetQueueByAddrScale

Method GetQueueByAddrScale

phxqueue/test/simpleconsumer.cpp:94–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92}
93
94comm::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
129comm::RetCode SimpleConsumer::GetLockInfo(const comm::proto::GetLockInfoRequest &req,
130 comm::proto::GetLockInfoResponse &resp) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected