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

Method IsValidQueue

phxqueue/config/topicconfig.cpp:337–374  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335
336
337bool TopicConfig::IsValidQueue(const int queue_id, const int pub_id, const int sub_id) const {
338 auto &&f = [&](const int arg_pub_id)->bool {
339 if (-1 != sub_id) {
340 auto &&it = impl_->pub_id2sub_ids.find(arg_pub_id);
341 if (impl_->pub_id2sub_ids.end() == it) return false;
342 auto &&sub_ids = it->second;
343 auto &&it1 = sub_ids.find(sub_id);
344 if (sub_ids.end() == it1) return false;
345 }
346
347 {
348 auto &&it = impl_->pub_id2queue_info_ids.find(arg_pub_id);
349 if (impl_->pub_id2queue_info_ids.end() == it) return false;
350 auto &&queue_info_ids = it->second;
351 for (auto &&queue_info_id : queue_info_ids) {
352 auto &&it1 = impl_->queue_info_id2ranges.find(queue_info_id);
353 if (impl_->queue_info_id2ranges.end() == it1) return false;
354 auto &&ranges = it1->second;
355 for (auto &&range : ranges) {
356 if (range.first <= queue_id && queue_id <= range.second) {
357 return true;
358 }
359 }
360 }
361 }
362 return false;
363 };
364
365 if (-1 != pub_id) {
366 return f(pub_id);
367 } else {
368 for (auto &&kv : impl_->pub_id2pub) {
369 if (f(kv.first)) return true;
370 }
371 }
372
373 return false;
374}
375
376comm::RetCode TopicConfig::GetQueuesByQueueInfoID(const int queue_info_id, set<int> &queues) const {
377 queues.clear();

Callers 9

NeedSkipAddMethod · 0.80
CheckRequestCommMethod · 0.80
ClearSyncCtrlMethod · 0.80
MakeCheckPointMethod · 0.80
QueueNeedReplayMethod · 0.80
GetAllLocalQueueMethod · 0.80
CheckTopicConfigMethod · 0.80
TestTopicConfigMethod · 0.80
ProcessMethod · 0.80

Calls

no outgoing calls

Tested by 2

CheckTopicConfigMethod · 0.64
TestTopicConfigMethod · 0.64