| 117 | } |
| 118 | |
| 119 | comm::RetCode LockConfig::GetLockIDByAddr(const comm::proto::Addr &addr, int &lock_id) const { |
| 120 | auto &&encoded_addr = comm::utils::EncodeAddr(addr); |
| 121 | auto &&it = impl_->addr2lock_id.find(encoded_addr); |
| 122 | if (impl_->addr2lock_id.end() == it) return comm::RetCode::RET_ERR_RANGE_ADDR; |
| 123 | lock_id = it->second; |
| 124 | return comm::RetCode::RET_OK; |
| 125 | } |
| 126 | |
| 127 | comm::RetCode LockConfig::GetLockByAddr(const comm::proto::Addr &addr, std::shared_ptr<const proto::Lock> &lock) const { |
| 128 | comm::RetCode ret; |