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

Function TestGetLockInfo

phxqueue/test/test_lock_main.cpp:29–52  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28
29void TestGetLockInfo(lock::Lock &lock, const int topic_id, const int lock_id,
30 const string &lock_key, uint64_t &version) {
31 NLVerb("begin");
32
33 comm::proto::GetLockInfoRequest req;
34 comm::proto::GetLockInfoResponse resp;
35
36 req.set_topic_id(topic_id);
37 req.set_lock_id(lock_id);
38 req.set_lock_key(lock_key);
39
40 comm::RetCode ret{lock.GetLockInfo(req, resp)};
41 if (comm::RetCode::RET_OK != ret) {
42 NLErr("lock GetLockInfo ret %d", as_integer(ret));
43
44 return;
45 }
46
47 NLVerb("lock_key %s version %" PRIu64 " client_id %s lease_time_ms %" PRIu64,
48 resp.lock_info().lock_key().c_str(), resp.lock_info().version(),
49 resp.lock_info().client_id().c_str(), resp.lock_info().lease_time_ms());
50
51 version = resp.lock_info().version();
52}
53
54void TestAcquireLock(lock::Lock &lock, const int topic_id, const int lock_id,
55 const string &lock_key, const uint64_t version) {

Callers 1

LockRunFunction · 0.85

Calls 2

as_integerFunction · 0.85
GetLockInfoMethod · 0.45

Tested by

no test coverage detected