17 #ifndef ARCHIVE_S3ARCHIVE_H_
18 #define ARCHIVE_S3ARCHIVE_H_
29 #include <openssl/evp.h>
32 #include <aws/core/Aws.h>
33 #include <aws/s3/S3Client.h>
47 if (0 != (env = getenv(
"AWS_REGION"))) {
50 if (0 != (env = getenv(
"AWS_ACCESS_KEY_ID"))) {
53 if (0 != (env = getenv(
"AWS_SECRET_ACCESS_KEY"))) {
56 if (0 != (env = getenv(
"AWS_SESSION_TOKEN"))) {
60 if (0 != (env = getenv(
"AWS_ENDPOINT"))) {
75 const std::string& s3_temp_dir_path = {})
86 if (s3_temp_dir_path.empty()) {
89 auto env_s3_temp_dir = getenv(
"TMPDIR");
90 s3_temp_dir = env_s3_temp_dir ? env_s3_temp_dir :
"/tmp";
98 for (
auto& thread : threads) {
99 if (thread.joinable()) {
103 #endif // HAVE_AWS_S3
110 throw std::runtime_error(
"AWS S3 support not available");
117 const std::string
land(
const std::string& objkey,
118 std::exception_ptr& teptr,
119 const bool for_detection,
120 const bool allow_named_pipe_use =
true,
121 const bool track_file_paths =
true);
122 void vacuum(
const std::string& objkey);
124 const std::string
land(
const std::string& objkey,
125 std::exception_ptr& teptr,
126 const bool for_detection) {
127 throw std::runtime_error(
"AWS S3 support not available");
130 throw std::runtime_error(
"AWS S3 support not available");
132 #endif // HAVE_AWS_S3
139 static int awsapi_count;
140 static std::mutex awsapi_mtx;
141 static Aws::SDKOptions awsapi_options;
143 std::unique_ptr<Aws::S3::S3Client> s3_client;
144 std::vector<std::thread> threads;
145 #endif // HAVE_AWS_S3
166 const std::string& s3_access_key,
167 const std::string& s3_secret_key,
168 const std::string& s3_session_token,
169 const std::string& s3_region,
170 const std::string& s3_endpoint,
171 const bool plain_text,
172 const std::optional<std::string>& regex_path_filter,
173 const std::optional<std::string>& file_sort_order_by,
174 const std::optional<std::string>& file_sort_regex)
const std::string land(const std::string &objkey, std::exception_ptr &teptr, const bool for_detection)
S3ParquetArchive(const std::string &url, const std::string &s3_access_key, const std::string &s3_secret_key, const std::string &s3_session_token, const std::string &s3_region, const std::string &s3_endpoint, const bool plain_text, const std::optional< std::string > ®ex_path_filter, const std::optional< std::string > &file_sort_order_by, const std::optional< std::string > &file_sort_regex)
std::string s3_access_key
std::map< const std::string, const std::string > file_paths
S3Archive(const std::string &url, const std::string &s3_access_key, const std::string &s3_secret_key, const std::string &s3_session_token, const std::string &s3_region, const std::string &s3_endpoint, const bool plain_text, const std::optional< std::string > ®ex_path_filter, const std::optional< std::string > &file_sort_order_by, const std::optional< std::string > &file_sort_regex, const std::string &s3_temp_dir_path={})
const std::vector< std::string > & get_objkeys()
std::optional< std::string > file_sort_regex
std::optional< std::string > regex_path_filter
void init_for_read() override
std::optional< std::string > file_sort_order_by
std::string s3_session_token
std::string s3_secret_key
S3Archive(const std::string &url, const bool plain_text)
std::vector< std::string > objkeys
void vacuum(const std::string &objkey)
size_t get_total_file_size() const