@@ -62,6 +62,10 @@ struct S3AuthParams {
6262
6363 static S3AuthParams ReadFrom (optional_ptr<FileOpener> opener, FileOpenerInfo &info);
6464 static S3AuthParams ReadFrom (S3KeyValueReader &secret_reader, const std::string &file_path);
65+ void SetRegion (string region_p);
66+
67+ private:
68+ void InitializeEndpoint ();
6569};
6670
6771struct AWSEnvironmentCredentialsProvider {
@@ -140,17 +144,7 @@ class S3FileHandle : public HTTPFileHandle {
140144
141145public:
142146 S3FileHandle (FileSystem &fs, const OpenFileInfo &file, FileOpenFlags flags, unique_ptr<HTTPParams> http_params_p,
143- const S3AuthParams &auth_params_p, const S3ConfigParams &config_params_p)
144- : HTTPFileHandle(fs, file, flags, std::move(http_params_p)), auth_params(auth_params_p),
145- config_params (config_params_p), uploads_in_progress(0 ), parts_uploaded(0 ), upload_finalized(false ),
146- uploader_has_error(false ), upload_exception(nullptr ) {
147- auto_fallback_to_full_file_download = false ;
148- if (flags.OpenForReading () && flags.OpenForWriting ()) {
149- throw NotImplementedException (" Cannot open an HTTP file for both reading and writing" );
150- } else if (flags.OpenForAppending ()) {
151- throw NotImplementedException (" Cannot open an HTTP file for appending" );
152- }
153- }
147+ const S3AuthParams &auth_params_p, const S3ConfigParams &config_params_p);
154148 ~S3FileHandle () override ;
155149
156150 S3AuthParams auth_params;
@@ -163,6 +157,10 @@ class S3FileHandle : public HTTPFileHandle {
163157
164158 shared_ptr<S3WriteBuffer> GetBuffer (uint16_t write_buffer_idx);
165159
160+ protected:
161+ void InitializeFromCacheEntry (const HTTPMetadataCacheEntry &cache_entry) override ;
162+ HTTPMetadataCacheEntry GetCacheEntry () const override ;
163+
166164protected:
167165 string multipart_upload_id;
168166 size_t part_size;
@@ -258,6 +256,7 @@ class S3FileSystem : public HTTPFileSystem {
258256 }
259257
260258 static string GetS3BadRequestError (const S3AuthParams &s3_auth_params, string correct_region = " " );
259+ static string ParseS3Error (const string &error);
261260 static string GetS3AuthError (const S3AuthParams &s3_auth_params);
262261 static string GetGCSAuthError (const S3AuthParams &s3_auth_params);
263262 static HTTPException GetS3Error (const S3AuthParams &s3_auth_params, const HTTPResponse &response,
@@ -289,7 +288,7 @@ class S3FileSystem : public HTTPFileSystem {
289288
290289// Helper class to do s3 ListObjectV2 api call https://docs.aws.amazon.com/AmazonS3/latest/API/API_ListObjectsV2.html
291290struct AWSListObjectV2 {
292- static string Request (const string &path, HTTPParams &http_params, const S3AuthParams &s3_auth_params,
291+ static string Request (const string &path, HTTPParams &http_params, S3AuthParams &s3_auth_params,
293292 string &continuation_token, optional_idx max_keys = optional_idx());
294293 static void ParseFileList (string &aws_response, vector<OpenFileInfo> &result);
295294 static vector<string> ParseCommonPrefix (string &aws_response);
0 commit comments