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

Method CheckLockConfig

phxqueue/test/check_config.cpp:268–303  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

266
267
268void CheckConfig::CheckLockConfig(const int topic_id, const config::LockConfig *lock_config) {
269
270 std::vector<std::shared_ptr<const config::proto::Lock> > locks;
271 PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(lock_config->GetAllLock(locks)));
272
273 std::set<int> lock_ids;
274 PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(lock_config->GetAllLockID(lock_ids)));
275 PHX_ASSERT(locks.size(), ==, lock_ids.size());
276
277 for (auto &&lock : locks) {
278 auto lock_id = lock->lock_id();
279
280 PHX_ASSERT(lock_ids.end() != lock_ids.find(lock_id), ==, true);
281
282 {
283 std::shared_ptr<const config::proto::Lock> tmp_lock;
284 PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(lock_config->GetLockByLockID(lock_id, tmp_lock)));
285 PHX_ASSERT(lock_id, ==, tmp_lock->lock_id());
286 }
287
288 for (int i{0}; i < lock->addrs_size(); ++i) {
289 auto &&addr = lock->addrs(i);
290
291 {
292 int tmp_lock_id;
293 PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(lock_config->GetLockIDByAddr(addr, tmp_lock_id)));
294 PHX_ASSERT(tmp_lock_id, ==, lock_id);
295 }
296 {
297 std::shared_ptr<const config::proto::Lock> tmp_lock;
298 PHX_ASSERT(phxqueue::comm::as_integer(comm::RetCode::RET_OK), ==, phxqueue::comm::as_integer(lock_config->GetLockByAddr(addr, tmp_lock)));
299 PHX_ASSERT(tmp_lock->lock_id(), ==, lock_id);
300 }
301 }
302 }
303}
304
305
306} // namespace test

Callers

nothing calls this directly

Calls 6

as_integerFunction · 0.85
GetAllLockMethod · 0.80
GetAllLockIDMethod · 0.80
GetLockByLockIDMethod · 0.80
GetLockIDByAddrMethod · 0.80
GetLockByAddrMethod · 0.80

Tested by

no test coverage detected