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

Method GetAllQueues

phxqueue/consumer/hblock.cpp:446–524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

444}
445
446comm::RetCode HeartBeatLock::GetAllQueues(const int sub_id, vector<Queue_t> &all_queues) {
447 all_queues.clear();
448
449 comm::RetCode ret = comm::RetCode::RET_OK;
450
451 auto topic_id = impl_->consumer->GetTopicID();
452
453 shared_ptr<const config::TopicConfig> topic_config;
454 if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(topic_id, topic_config))) {
455 QLErr("ERR: GetTopicConfigByTopicID err. topic_id %u ret %d", topic_id, comm::as_integer(ret));
456 return ret;
457 }
458
459 shared_ptr<const config::StoreConfig> store_config;
460 if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetStoreConfig(topic_id, store_config))) {
461 QLErr("ERR: GetStoreConfigByPubID err. topic_id %d ret %d", topic_id, comm::as_integer(ret));
462 return ret;
463 }
464
465 set<int> store_ids;
466 if (comm::RetCode::RET_OK != (ret = store_config->GetAllStoreID(store_ids))) {
467 QLErr("ERR: GetAllStoreID ret %d", comm::as_integer(ret));
468 return ret;
469 }
470
471 set<pair<int, int> > filter;
472 for (auto &&store_id : store_ids) {
473 set<int> pub_ids;
474 if (comm::RetCode::RET_OK != (ret = config::utils::GetPubIDsByStoreID(topic_id, store_id, pub_ids))) {
475 QLErr("GetPubIDsByStoreID ret %d topic_id %d store_id %d", as_integer(ret), topic_id, store_id);
476 continue;
477 }
478
479 for (auto &&pub_id : pub_ids) {
480 shared_ptr<const config::proto::Pub> pub;
481 if (comm::RetCode::RET_OK != (ret = topic_config->GetPubByPubID(pub_id, pub))) {
482 QLErr("ERR: GetPubByPubID err. ret %d", comm::as_integer(ret));
483 continue;
484 }
485
486 // check pub
487 {
488 size_t i;
489 for (i = 0; i < pub->sub_ids_size(); ++i) {
490 if (sub_id == pub->sub_ids(i)) break;
491 }
492 if (i == pub->sub_ids_size()) continue;
493 }
494
495 for (int i{0}; i < pub->queue_info_ids_size(); ++i) {
496 auto &&queue_info_id = pub->queue_info_ids(i);
497
498 set<int> queue_ids;
499 if (comm::RetCode::RET_OK != (ret = topic_config->GetQueuesByQueueInfoID(queue_info_id, queue_ids))) {
500 QLErr("GetQueuesByQueueInfoID ret %d queue_info_id %d", comm::as_integer(ret), queue_info_id);
501 continue;
502 }
503

Callers

nothing calls this directly

Calls 8

as_integerFunction · 0.85
GetPubIDsByStoreIDFunction · 0.85
GetStoreConfigMethod · 0.80
GetAllStoreIDMethod · 0.80
GetPubByPubIDMethod · 0.80
GetTopicIDMethod · 0.45

Tested by

no test coverage detected