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

Method Add

phxqueue/store/basemgr.cpp:66–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64
65
66comm::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
104bool BaseMgr::NeedSkipAdd(const uint64_t cursor_id, const comm::proto::AddRequest &req) {
105 comm::RetCode ret;

Callers

nothing calls this directly

Calls 9

as_integerFunction · 0.85
StoreMetaClass · 0.85
GetQueueInfoByQueueMethod · 0.80
OnAddSkipMethod · 0.80
PushBackMethod · 0.80
OnAddSuccMethod · 0.80
GetTopicIDMethod · 0.45
OnAddMethod · 0.45

Tested by

no test coverage detected