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

Method DoInitialize

cpp/src/arrow/filesystem/s3fs.cc:3532–3574  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3530
3531 private:
3532 void DoInitialize(const S3GlobalOptions& options) {
3533 Aws::Utils::Logging::LogLevel aws_log_level;
3534
3535#define LOG_LEVEL_CASE(level_name) \
3536 case S3LogLevel::level_name: \
3537 aws_log_level = Aws::Utils::Logging::LogLevel::level_name; \
3538 break;
3539
3540 switch (options.log_level) {
3541 LOG_LEVEL_CASE(Fatal)
3542 LOG_LEVEL_CASE(Error)
3543 LOG_LEVEL_CASE(Warn)
3544 LOG_LEVEL_CASE(Info)
3545 LOG_LEVEL_CASE(Debug)
3546 LOG_LEVEL_CASE(Trace)
3547 default:
3548 aws_log_level = Aws::Utils::Logging::LogLevel::Off;
3549 }
3550
3551#undef LOG_LEVEL_CASE
3552
3553 aws_options_.ioOptions.clientBootstrap_create_fn =
3554 [ev_threads = options.num_event_loop_threads]() {
3555 // https://github.com/aws/aws-sdk-cpp/blob/1.11.15/src/aws-cpp-sdk-core/source/Aws.cpp#L65
3556 Aws::Crt::Io::EventLoopGroup event_loop_group(ev_threads);
3557 Aws::Crt::Io::DefaultHostResolver default_host_resolver(
3558 event_loop_group, /*maxHosts=*/8, /*maxTTL=*/30);
3559 auto client_bootstrap = Aws::MakeShared<Aws::Crt::Io::ClientBootstrap>(
3560 "Aws_Init_Cleanup", event_loop_group, default_host_resolver);
3561 client_bootstrap->EnableBlockingShutdown();
3562 return client_bootstrap;
3563 };
3564 aws_options_.loggingOptions.logLevel = aws_log_level;
3565 // By default the AWS SDK logs to files, log to console instead
3566 aws_options_.loggingOptions.logger_create_fn = [this] {
3567 return std::make_shared<Aws::Utils::Logging::ConsoleLogSystem>(
3568 aws_options_.loggingOptions.logLevel);
3569 };
3570 // ARROW-18290: escape all special chars for compatibility with non-AWS S3 backends.
3571 aws_options_.httpOptions.compliantRfc3986Encoding = true;
3572 aws_options_.httpOptions.installSigPipeHandler = options.install_sigpipe_handler;
3573 Aws::InitAPI(aws_options_);
3574 }
3575
3576 Aws::SDKOptions aws_options_;
3577 std::atomic<bool> is_initialized_;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected