MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetBucketLocation

Method GetBucketLocation

tensorflow/core/platform/cloud/gcs_file_system.cc:1272–1291  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1270}
1271
1272Status GcsFileSystem::GetBucketLocation(const string& bucket,
1273 string* location) {
1274 auto compute_func = [this](const string& bucket, string* location) {
1275 std::vector<char> result_buffer;
1276 Status status = GetBucketMetadata(bucket, &result_buffer);
1277 Json::Value result;
1278 TF_RETURN_IF_ERROR(ParseJson(result_buffer, &result));
1279 string bucket_location;
1280 TF_RETURN_IF_ERROR(
1281 GetStringValue(result, kBucketMetadataLocationKey, &bucket_location));
1282 // Lowercase the GCS location to be case insensitive for allowed locations.
1283 *location = absl::AsciiStrToLower(bucket_location);
1284 return Status::OK();
1285 };
1286
1287 TF_RETURN_IF_ERROR(
1288 bucket_location_cache_->LookupOrCompute(bucket, location, compute_func));
1289
1290 return Status::OK();
1291}
1292
1293Status GcsFileSystem::GetBucketMetadata(const string& bucket,
1294 std::vector<char>* result_buffer) {

Callers

nothing calls this directly

Calls 3

GetStringValueFunction · 0.85
LookupOrComputeMethod · 0.80
ParseJsonFunction · 0.70

Tested by

no test coverage detected