OmniSciDB  94e8789169
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OmniSciAwsSdk.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2020 OmniSci, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "OmniSciAwsSdk.h"
18 
19 #include <arrow/filesystem/s3fs.h>
20 #include <arrow/status.h>
21 
22 #ifdef ARROW_HAS_PRIVATE_AWS_SDK
23 #include <aws/core/Aws.h>
24 #endif
25 
26 #include "Logger/Logger.h"
27 
28 #ifdef ARROW_HAS_PRIVATE_AWS_SDK
29 static Aws::SDKOptions awsapi_options;
30 #endif
31 
33  arrow::fs::S3GlobalOptions s3_global_options;
34  auto status = arrow::fs::InitializeS3(s3_global_options);
35  CHECK(status.ok()) << "InitializeS3 resulted in an error: " << status.message();
36 #ifdef ARROW_HAS_PRIVATE_AWS_SDK
37  // Directly initialize the AWS SDK, if Arrow uses a private version of the SDK
38  Aws::InitAPI(awsapi_options);
39 #endif
40 }
41 
43  auto status = arrow::fs::FinalizeS3();
44  CHECK(status.ok()) << "FinalizeS3 resulted in an error: " << status.message();
45 #ifdef ARROW_HAS_PRIVATE_AWS_SDK
46  // Directly shutdown the AWS SDK, if Arrow uses a private version of the SDK
47  Aws::ShutdownAPI(awsapi_options);
48 #endif
49 }
#define CHECK(condition)
Definition: Logger.h:197