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

Function GetPubIDsByStoreID

phxqueue/config/utils/pub_util.cpp:20–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20comm::RetCode GetPubIDsByStoreID(const int topic_id, const int store_id, set<int> &pub_ids) {
21 pub_ids.clear();
22
23 comm::RetCode ret;
24
25 shared_ptr<const StoreConfig> store_config;
26 if (comm::RetCode::RET_OK != (ret = GlobalConfig::GetThreadInstance()->GetStoreConfig(topic_id, store_config))) {
27 NLErr("GetStoreConfig ret %d topic_id %d", comm::as_integer(ret), topic_id);
28 return ret;
29 }
30
31 shared_ptr<const proto::Store> store;
32 if (comm::RetCode::RET_OK != (ret = store_config->GetStoreByStoreID(store_id, store))) {
33 NLErr("GetStoreByStoreID ret %d", comm::as_integer(ret));
34 return ret;
35 }
36
37 shared_ptr<const TopicConfig> topic_config;
38 if (comm::RetCode::RET_OK != (ret = GlobalConfig::GetThreadInstance()->GetTopicConfigByTopicID(topic_id, topic_config))) {
39 NLErr("GetTopicConfig ret %d topic_id %d", comm::as_integer(ret), topic_id);
40 return ret;
41 }
42
43 if (store->pub_ids_size()) {
44 for (int i{0}; i < store->pub_ids_size(); ++i) {
45 auto &&pub_id = store->pub_ids(i);
46 if (topic_config->IsValidPubID(pub_id)) {
47 pub_ids.insert(store->pub_ids(i));
48 }
49 }
50 return comm::RetCode::RET_OK;
51 }
52
53 if (comm::RetCode::RET_OK != (ret = topic_config->GetAllPubID(pub_ids))) {
54 NLErr("GetAllPubID ret %d", comm::as_integer(ret));
55 }
56
57 return ret;
58}
59
60
61} // namespace utils

Callers 7

GetStoreIDMethod · 0.85
ClearSyncCtrlMethod · 0.85
MakeCheckPointMethod · 0.85
ReplayMethod · 0.85
GetAllLocalQueueMethod · 0.85
UpdateLimitInfoMethod · 0.85
GetAllQueuesMethod · 0.85

Calls 6

as_integerFunction · 0.85
GetStoreConfigMethod · 0.80
GetStoreByStoreIDMethod · 0.80
IsValidPubIDMethod · 0.80
GetAllPubIDMethod · 0.80

Tested by

no test coverage detected