| 1265 | } |
| 1266 | |
| 1267 | Result<std::string> ResolveRegion(const std::string& bucket) { |
| 1268 | std::unique_lock<std::mutex> lock(cache_mutex_); |
| 1269 | auto it = cache_.find(bucket); |
| 1270 | if (it != cache_.end()) { |
| 1271 | return it->second; |
| 1272 | } |
| 1273 | // Cache miss: do the actual region lookup |
| 1274 | lock.unlock(); |
| 1275 | ARROW_ASSIGN_OR_RAISE(auto region, ResolveRegionUncached(bucket)); |
| 1276 | lock.lock(); |
| 1277 | // Note we don't cache a nonexistent bucket, as the bucket could be created later |
| 1278 | cache_[bucket] = region; |
| 1279 | return region; |
| 1280 | } |
| 1281 | |
| 1282 | Result<std::string> ResolveRegionUncached(const std::string& bucket) { |
| 1283 | ARROW_ASSIGN_OR_RAISE(auto client_lock, holder_->Lock()); |
no test coverage detected