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

Method GetQueueInfoIDByCount

phxqueue/config/topicconfig.cpp:481–503  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

479}
480
481comm::RetCode TopicConfig::GetQueueInfoIDByCount(const int pub_id, const int cnt, int &queue_info_id) const {
482 comm::RetCode ret;
483 shared_ptr<const proto::Pub> pub;
484 if (comm::RetCode::RET_OK != (ret = GetPubByPubID(pub_id, pub)) || !pub) {
485 return comm::RetCode::RET_ERR_RANGE_PUB;
486 }
487
488 int c{cnt};
489 for (int i{0}; i < pub->queue_info_ids_size(); ++i) {
490 const int queue_info_id_tmp = pub->queue_info_ids(i);
491 shared_ptr<const proto::QueueInfo> queue_info;
492 if (comm::RetCode::RET_OK != (ret = GetQueueInfoByQueueInfoID(queue_info_id_tmp, queue_info)) || !queue_info) {
493 return comm::RetCode::RET_ERR_RANGE_QUEUE_INFO;
494 }
495 if (-1 != queue_info->count() && c >= queue_info->count()) {
496 c -= queue_info->count();
497 } else {
498 queue_info_id = queue_info_id_tmp;
499 return comm::RetCode::RET_OK;
500 }
501 }
502 return comm::RetCode::RET_ERR_RANGE_CNT;
503}
504
505comm::RetCode TopicConfig::GetHandleIDRank(const int handle_id, int &rank) const {
506 auto &&it = impl_->handle_id2rank.find(handle_id);

Callers 4

GetQueueIDMethod · 0.80
MakeAddRequestsMethod · 0.80
CheckTopicConfigMethod · 0.80
TestTopicConfigMethod · 0.80

Calls

no outgoing calls

Tested by 2

CheckTopicConfigMethod · 0.64
TestTopicConfigMethod · 0.64