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

Method GetLockID

phxqueue/scheduler/keepmasterthread.cpp:213–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213comm::RetCode KeepMasterThread::GetLockID(int &lock_id) {
214 const int topic_id{impl_->scheduler->GetTopicID()};
215
216 comm::RetCode ret;
217
218 shared_ptr<const config::LockConfig> lock_config;
219 if (comm::RetCode::RET_OK != (ret = config::GlobalConfig::GetThreadInstance()->GetLockConfig(topic_id, lock_config))) {
220 QLErr("GetLockConfig ret %d", as_integer(ret));
221 return ret;
222 }
223
224 set<int> lock_ids;
225 if (comm::RetCode::RET_OK != (ret = lock_config->GetAllLockID(lock_ids))) {
226 QLErr("GetAllLockID ret %d", as_integer(ret));
227 return ret;
228 }
229
230 if (lock_ids.empty()) {
231 QLErr("GetAllLockID lock_ids empty");
232 return comm::RetCode::RET_ERR_RANGE_LOCK;
233
234 }
235
236 lock_id = *lock_ids.begin();
237 return comm::RetCode::RET_OK;
238}
239
240
241} // namespace scheduler

Callers

nothing calls this directly

Calls 4

as_integerFunction · 0.85
GetLockConfigMethod · 0.80
GetAllLockIDMethod · 0.80
GetTopicIDMethod · 0.45

Tested by

no test coverage detected