OmniSciDB  471d68cefb
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
omnisci_aws_sdk Namespace Reference

Classes

struct  SslConfig
 

Functions

void init_sdk ()
 
void shutdown_sdk ()
 
SslConfig get_ssl_config ()
 

Function Documentation

SslConfig omnisci_aws_sdk::get_ssl_config ( )

Definition at line 57 of file OmniSciAwsSdk.cpp.

References omnisci_aws_sdk::SslConfig::ca_file, and omnisci_aws_sdk::SslConfig::ca_path.

Referenced by init_sdk().

57  {
58  SslConfig ssl_config;
59  /*
60  Fix a wrong ca path established at building libcurl on Centos being carried to
61  Ubuntu. To fix the issue, this is this sequence of locating ca file: 1) if
62  `SSL_CERT_DIR` or `SSL_CERT_FILE` is set, set it to S3 ClientConfiguration. 2) if
63  none ^ is set, omnisci_server searches a list of known ca file paths. 3) if 2)
64  finds nothing, it is users' call to set correct SSL_CERT_DIR or SSL_CERT_FILE. S3
65  c++ sdk: "we only want to override the default path if someone has explicitly told
66  us to."
67  */
68  std::list<std::string> v_known_ca_paths({
69  "/etc/ssl/certs/ca-certificates.crt",
70  "/etc/pki/tls/certs/ca-bundle.crt",
71  "/usr/share/ssl/certs/ca-bundle.crt",
72  "/usr/local/share/certs/ca-root.crt",
73  "/etc/ssl/cert.pem",
74  "/etc/ssl/ca-bundle.pem",
75  });
76  char* env;
77  if (nullptr != (env = getenv("SSL_CERT_DIR"))) {
78  ssl_config.ca_path = env;
79  }
80  if (nullptr != (env = getenv("SSL_CERT_FILE"))) {
81  v_known_ca_paths.push_front(env);
82  }
83  for (const auto& known_ca_path : v_known_ca_paths) {
84  if (boost::filesystem::exists(known_ca_path)) {
85  ssl_config.ca_file = known_ca_path;
86  break;
87  }
88  }
89  return ssl_config;
90 }

+ Here is the caller graph for this function:

void omnisci_aws_sdk::init_sdk ( )

Definition at line 32 of file OmniSciAwsSdk.cpp.

References CHECK, and get_ssl_config().

Referenced by startMapdServer().

32  {
33  auto ssl_config = omnisci_aws_sdk::get_ssl_config();
34  arrow::fs::FileSystemGlobalOptions global_options;
35  global_options.tls_ca_dir_path = ssl_config.ca_path;
36  global_options.tls_ca_file_path = ssl_config.ca_file;
37  arrow::fs::Initialize(global_options);
38  arrow::fs::S3GlobalOptions s3_global_options;
39  auto status = arrow::fs::InitializeS3(s3_global_options);
40  CHECK(status.ok()) << "InitializeS3 resulted in an error: " << status.message();
41 #ifdef ARROW_HAS_PRIVATE_AWS_SDK
42  // Directly initialize the AWS SDK, if Arrow uses a private version of the SDK
43  Aws::InitAPI(awsapi_options);
44 #endif
45 }
SslConfig get_ssl_config()
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void omnisci_aws_sdk::shutdown_sdk ( )

Definition at line 47 of file OmniSciAwsSdk.cpp.

References CHECK.

Referenced by startMapdServer().

47  {
48  auto status = arrow::fs::FinalizeS3();
49  CHECK(status.ok()) << "FinalizeS3 resulted in an error: " << status.message();
50 #ifdef ARROW_HAS_PRIVATE_AWS_SDK
51  // Directly shutdown the AWS SDK, if Arrow uses a private version of the SDK
52  Aws::ShutdownAPI(awsapi_options);
53 #endif
54 }
#define CHECK(condition)
Definition: Logger.h:209

+ Here is the caller graph for this function: