| 68 | } |
| 69 | |
| 70 | TryLockResult RpcClient::TryLock(const std::string& name) { |
| 71 | { |
| 72 | std::unique_lock<std::mutex> lck(done_names_mtx_); |
| 73 | if (done_names_.find(name) != done_names_.end()) { return TryLockResult::kDone; } |
| 74 | } |
| 75 | ClientCall<CtrlMethod::kTryLock> call; |
| 76 | call.mut_request()->set_name(name); |
| 77 | call(GetResponsibleStub(name)); |
| 78 | if (call.response().result() == TryLockResult::kDone) { |
| 79 | std::unique_lock<std::mutex> lck(done_names_mtx_); |
| 80 | done_names_.insert(name); |
| 81 | } |
| 82 | return call.response().result(); |
| 83 | } |
| 84 | |
| 85 | void RpcClient::NotifyDone(const std::string& name) { |
| 86 | ClientCall<CtrlMethod::kNotifyDone> call; |
nothing calls this directly
no test coverage detected