| 52 | } |
| 53 | |
| 54 | void TestAcquireLock(lock::Lock &lock, const int topic_id, const int lock_id, |
| 55 | const string &lock_key, const uint64_t version) { |
| 56 | NLVerb("begin"); |
| 57 | |
| 58 | const string client_id{"test_client_123"}; |
| 59 | const uint64_t lease_time_ms{10000}; |
| 60 | |
| 61 | comm::proto::AcquireLockRequest req; |
| 62 | comm::proto::AcquireLockResponse resp; |
| 63 | |
| 64 | req.set_topic_id(topic_id); |
| 65 | req.set_lock_id(lock_id); |
| 66 | |
| 67 | comm::proto::LockInfo *lock_info{req.mutable_lock_info()}; |
| 68 | lock_info->set_lock_key(lock_key); |
| 69 | lock_info->set_version(version); |
| 70 | lock_info->set_client_id(client_id); |
| 71 | lock_info->set_lease_time_ms(lease_time_ms); |
| 72 | |
| 73 | comm::RetCode ret{lock.AcquireLock(req, resp)}; |
| 74 | if (comm::RetCode::RET_OK != ret) { |
| 75 | NLErr("lock AcquireLock ret %d", as_integer(ret)); |
| 76 | |
| 77 | return; |
| 78 | } |
| 79 | |
| 80 | NLVerb("succ"); |
| 81 | } |
| 82 | |
| 83 | void LockRun(const int vpid) { |
| 84 | comm::RetCode ret; |
no test coverage detected