MCPcopy Create free account
hub / github.com/baidu/tera / TryLock

Method TryLock

src/observer/rowlocknode/rowlocknode_impl.cc:41–53  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39bool RowlockNodeImpl::Exit() { return true; }
40
41void RowlockNodeImpl::TryLock(const RowlockRequest* request, RowlockResponse* response,
42 google::protobuf::Closure* done) {
43 uint64_t rowlock_key = GetRowlockKey(request->table_name(), request->row());
44 if (rowlock_db_.TryLock(rowlock_key)) {
45 response->set_lock_status(kLockSucc);
46 VLOG(12) << "Lock success: " << request->row();
47 } else {
48 response->set_lock_status(kLockFail);
49 LOG(WARNING) << " table name: " << request->table_name() << " row :" << request->row();
50 }
51
52 done->Run();
53}
54
55void RowlockNodeImpl::UnLock(const RowlockRequest* request, RowlockResponse* response,
56 google::protobuf::Closure* done) {

Callers 2

LockMethod · 0.45
TryLockRowMethod · 0.45

Calls 1

RunMethod · 0.45

Tested by

no test coverage detected