| 414 | } |
| 415 | |
| 416 | comm::RetCode TopicConfig::GetQueueByRank(const int queue_info_id, const uint64_t rank, int &queue) const { |
| 417 | auto &&it = impl_->queue_info_id2ranges.find(queue_info_id); |
| 418 | if (it == impl_->queue_info_id2ranges.end()) return comm::RetCode::RET_ERR_RANGE_QUEUE_INFO; |
| 419 | auto &&ranges = it->second; |
| 420 | |
| 421 | if (0 == ranges.size()) return comm::RetCode::RET_ERR_RANGE_RANK; |
| 422 | |
| 423 | uint64_t r{rank}; |
| 424 | for (auto &&range : ranges) { |
| 425 | uint64_t w{range.second - range.first + 1}; |
| 426 | if (r >= w) r -= w; |
| 427 | else { |
| 428 | queue = (int)(range.first + r); |
| 429 | return comm::RetCode::RET_OK; |
| 430 | } |
| 431 | } |
| 432 | return comm::RetCode::RET_ERR_RANGE_RANK; |
| 433 | } |
| 434 | |
| 435 | comm::RetCode TopicConfig::GetQueueByLoopRank(const int queue_info_id, const uint64_t rank, int &queue) const { |
| 436 | comm::RetCode ret; |
no outgoing calls