| 64 | |
| 65 | |
| 66 | comm::RetCode BaseMgr::Add(const uint64_t cursor_id, const comm::proto::AddRequest &req) { |
| 67 | QLVerb("Add. req: topic_id %d store_id %d queue_id %d", req.topic_id(), req.store_id(), req.queue_id()); |
| 68 | comm::RetCode ret; |
| 69 | |
| 70 | //__OssAttrQueue(req.queue()); |
| 71 | |
| 72 | const int topic_id = impl_->store->GetTopicID(); |
| 73 | |
| 74 | shared_ptr<const config::TopicConfig> topic_config; |
| 75 | if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(topic_id, topic_config))) { |
| 76 | QLErr("GetTopicConfigByTopicID ret %d topic_id %d", as_integer(ret), topic_id); |
| 77 | return ret; |
| 78 | } |
| 79 | |
| 80 | shared_ptr<const config::proto::QueueInfo> queue_info; |
| 81 | if (comm::RetCode::RET_OK != (ret = topic_config->GetQueueInfoByQueue(req.queue_id(), queue_info))) { |
| 82 | QLErr("GetQueueInfoByQueue ret %d", as_integer(ret)); |
| 83 | return ret; |
| 84 | } |
| 85 | |
| 86 | comm::StoreBaseMgrBP::GetThreadInstance()->OnAdd(req, queue_info->queue_info_id()); |
| 87 | |
| 88 | if (0 == req.items_size()) return comm::RetCode::RET_OK; |
| 89 | |
| 90 | if (NeedSkipAdd(cursor_id, req)) { |
| 91 | comm::StoreBaseMgrBP::GetThreadInstance()->OnAddSkip(req); |
| 92 | //if (ossid) OssAttrInc(ossid, phxqueue::ossattr::store::ADD_SKIP, req.items_size()); |
| 93 | return comm::RetCode::RET_ADD_SKIP; |
| 94 | } |
| 95 | |
| 96 | auto &&meta_queue = impl_->meta_queues[req.queue_id()]; |
| 97 | meta_queue.PushBack(std::move(StoreMeta(cursor_id))); |
| 98 | |
| 99 | comm::StoreBaseMgrBP::GetThreadInstance()->OnAddSucc(req, cursor_id); |
| 100 | |
| 101 | return comm::RetCode::RET_OK; |
| 102 | } |
| 103 | |
| 104 | bool BaseMgr::NeedSkipAdd(const uint64_t cursor_id, const comm::proto::AddRequest &req) { |
| 105 | comm::RetCode ret; |
nothing calls this directly
no test coverage detected