MCPcopy Create free account
hub / github.com/apache/arrow / AsGoogleCloudOptions

Function AsGoogleCloudOptions

cpp/src/arrow/filesystem/gcsfs_internal.cc:317–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

315auto constexpr kUploadBufferSize = 256 * 1024;
316
317google::cloud::Options AsGoogleCloudOptions(const GcsOptions& o) {
318 auto options = google::cloud::Options{};
319 std::string scheme = o.scheme;
320 if (scheme.empty()) scheme = "https";
321 if (scheme == "https") {
322 options.set<google::cloud::UnifiedCredentialsOption>(
323 google::cloud::MakeGoogleDefaultCredentials());
324 } else {
325 options.set<google::cloud::UnifiedCredentialsOption>(
326 google::cloud::MakeInsecureCredentials());
327 }
328 options.set<gcs::UploadBufferSizeOption>(kUploadBufferSize);
329 if (!o.endpoint_override.empty()) {
330 options.set<gcs::RestEndpointOption>(scheme + "://" + o.endpoint_override);
331 }
332 if (o.credentials.holder() && o.credentials.holder()->credentials) {
333 options.set<google::cloud::UnifiedCredentialsOption>(
334 o.credentials.holder()->credentials);
335 }
336 if (o.retry_limit_seconds.has_value()) {
337 options.set<gcs::RetryPolicyOption>(
338 gcs::LimitedTimeRetryPolicy(
339 std::chrono::milliseconds(static_cast<int>(*o.retry_limit_seconds * 1000)))
340 .clone());
341 }
342 if (o.project_id.has_value()) {
343 options.set<gcs::ProjectIdOption>(*o.project_id);
344 }
345 return options;
346}
347
348} // namespace internal
349} // namespace fs

Callers 2

TESTFunction · 0.85
ImplMethod · 0.85

Calls 2

cloneMethod · 0.80
emptyMethod · 0.45

Tested by 1

TESTFunction · 0.68