| 1205 | } |
| 1206 | |
| 1207 | Result<std::string> ResolveRegion(const std::string& bucket) { |
| 1208 | std::unique_lock<std::mutex> lock(cache_mutex_); |
| 1209 | auto it = cache_.find(bucket); |
| 1210 | if (it != cache_.end()) { |
| 1211 | return it->second; |
| 1212 | } |
| 1213 | // Cache miss: do the actual region lookup |
| 1214 | lock.unlock(); |
| 1215 | ARROW_ASSIGN_OR_RAISE(auto region, ResolveRegionUncached(bucket)); |
| 1216 | lock.lock(); |
| 1217 | // Note we don't cache a nonexistent bucket, as the bucket could be created later |
| 1218 | cache_[bucket] = region; |
| 1219 | return region; |
| 1220 | } |
| 1221 | |
| 1222 | Result<std::string> ResolveRegionUncached(const std::string& bucket) { |
| 1223 | ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock()); |
no test coverage detected