@@ -97,14 +97,9 @@ struct JobHandle;
9797class AwsEnv : public CloudEnvImpl {
9898 public:
9999 // A factory method for creating S3 envs
100- static Status NewAwsEnv (Env* env, const std::string& src_cloud_storage,
101- const std::string& src_cloud_object_prefix,
102- const std::string& src_cloud_region,
103- const std::string& dest_cloud_storage,
104- const std::string& dest_cloud_object_prefix,
105- const std::string& dest_cloud_region,
100+ static Status NewAwsEnv (Env* env,
106101 const CloudEnvOptions& env_options,
107- std::shared_ptr<Logger> info_log, CloudEnv** cenv);
102+ const std::shared_ptr<Logger> & info_log, CloudEnv** cenv);
108103
109104 virtual ~AwsEnv ();
110105
@@ -123,7 +118,7 @@ class AwsEnv : public CloudEnvImpl {
123118 std::unique_ptr<SequentialFile>* result,
124119 const EnvOptions& options) override ;
125120
126- virtual Status NewSequentialFileCloud (const std::string& bucket_prefix ,
121+ virtual Status NewSequentialFileCloud (const std::string& bucket ,
127122 const std::string& fname,
128123 std::unique_ptr<SequentialFile>* result,
129124 const EnvOptions& options) override ;
@@ -238,27 +233,28 @@ class AwsEnv : public CloudEnvImpl {
238233
239234 virtual uint64_t GetThreadID () const override { return AwsEnv::gettid (); }
240235
241- virtual Status EmptyBucket (const std::string& bucket_prefix ,
242- const std::string& path_prefix ) override ;
236+ virtual Status EmptyBucket (const std::string& bucket ,
237+ const std::string& path ) override ;
243238
244239 // get the posix env
245240 Env* GetPosixEnv () const { return base_env_; }
246241
247242 bool IsRunning () const { return running_; }
248243
249- const std::string& GetSrcBucketPrefix () override {
250- return src_bucket_prefix_ ;
244+ const std::string& GetSrcBucketName () const override {
245+ return cloud_env_options. src_bucket . GetBucketName () ;
251246 }
252- const std::string& GetSrcObjectPrefix () override {
253- return src_object_prefix_ ;
247+ const std::string& GetSrcObjectPath () const override {
248+ return cloud_env_options. src_bucket . GetObjectPath () ;
254249 }
255- const std::string& GetDestBucketPrefix () override {
256- return dest_bucket_prefix_;
250+
251+ const std::string& GetDestBucketName () const override {
252+ return cloud_env_options.dest_bucket .GetBucketName ();
257253 }
258- const std::string& GetDestObjectPrefix () override {
259- return dest_object_prefix_ ;
254+ const std::string& GetDestObjectPath () const override {
255+ return cloud_env_options. dest_bucket . GetObjectPath () ;
260256 }
261-
257+
262258 const CloudEnvOptions& GetCloudEnvOptions () override {
263259 return cloud_env_options;
264260 }
@@ -274,48 +270,44 @@ class AwsEnv : public CloudEnvImpl {
274270 std::shared_ptr<Aws::Transfer::TransferManager> awsTransferManager_;
275271
276272 // Configurations for this cloud environent
277- const CloudEnvOptions cloud_env_options;
273+ CloudEnvOptions cloud_env_options;
278274
279275 //
280276 // Get credentials for running unit tests
281277 //
282278 static Status GetTestCredentials (std::string* aws_access_key_id,
283- std::string* aws_secret_access_key,
284- std::string* region);
285-
286- // Create a specific bucketname suffix so that all unit tests can
287- // use a single bucket.
288- static std::string GetTestBucketSuffix ();
279+ std::string* aws_secret_access_key,
280+ std::string* region);
289281
290282 Status StartTailingStream ();
291283
292284 // Saves and retrieves the dbid->dirname mapping in S3
293285 Status SaveDbid (const std::string& dbid, const std::string& dirname) override ;
294- Status GetPathForDbid (const std::string& bucket_prefix ,
286+ Status GetPathForDbid (const std::string& bucket ,
295287 const std::string& dbid, std::string* dirname) override ;
296- Status GetDbidList (const std::string& bucket_prefix ,
288+ Status GetDbidList (const std::string& bucket ,
297289 DbidList* dblist) override ;
298- Status DeleteDbid (const std::string& bucket_prefix ,
290+ Status DeleteDbid (const std::string& bucket ,
299291 const std::string& dbid) override ;
300- Status ListObjects (const std::string& bucket_name_prefix ,
301- const std::string& bucket_object_prefix ,
292+ Status ListObjects (const std::string& bucket_name ,
293+ const std::string& bucket_object ,
302294 BucketObjectMetadata* meta) override ;
303- Status DeleteObject (const std::string& bucket_name_prefix ,
295+ Status DeleteObject (const std::string& bucket_name ,
304296 const std::string& bucket_object_path) override ;
305- Status ExistsObject (const std::string& bucket_name_prefix ,
297+ Status ExistsObject (const std::string& bucket_name ,
306298 const std::string& bucket_object_path) override ;
307- Status GetObjectSize (const std::string& bucket_name_prefix ,
299+ Status GetObjectSize (const std::string& bucket_name ,
308300 const std::string& bucket_object_path,
309301 uint64_t * filesize) override ;
310- Status CopyObject (const std::string& bucket_name_prefix_src ,
302+ Status CopyObject (const std::string& bucket_name_src ,
311303 const std::string& bucket_object_path_src,
312- const std::string& bucket_name_prefix_dest ,
304+ const std::string& bucket_name_dest ,
313305 const std::string& bucket_object_path_dest) override ;
314- Status GetObject (const std::string& bucket_name_prefix ,
306+ Status GetObject (const std::string& bucket_name ,
315307 const std::string& bucket_object_path,
316308 const std::string& local_path) override ;
317309 Status PutObject (const std::string& local_path,
318- const std::string& bucket_name_prefix ,
310+ const std::string& bucket_name ,
319311 const std::string& bucket_object_path) override ;
320312 Status DeleteCloudFileFromDest (const std::string& fname) override ;
321313
@@ -331,14 +323,9 @@ class AwsEnv : public CloudEnvImpl {
331323 // The AWS credentials are specified to the constructor via
332324 // access_key_id and secret_key.
333325 //
334- explicit AwsEnv (Env* underlying_env, const std::string& src_bucket_prefix,
335- const std::string& src_object_prefix,
336- const std::string& src_bucket_region,
337- const std::string& dest_bucket_prefix,
338- const std::string& dest_object_prefix,
339- const std::string& dest_bucket_region,
326+ explicit AwsEnv (Env* underlying_env,
340327 const CloudEnvOptions& cloud_options,
341- std::shared_ptr<Logger> info_log = nullptr );
328+ const std::shared_ptr<Logger> & info_log = nullptr );
342329
343330 struct GetObjectResult {
344331 bool success{false };
@@ -370,13 +357,6 @@ class AwsEnv : public CloudEnvImpl {
370357 // The pathname that contains a list of all db's inside a bucket.
371358 static constexpr const char * dbid_registry_ = " /.rockset/dbid/" ;
372359
373- std::string src_bucket_prefix_;
374- std::string src_object_prefix_;
375- std::string src_bucket_region_;
376- std::string dest_bucket_prefix_;
377- std::string dest_object_prefix_;
378- std::string dest_bucket_region_;
379-
380360 Status create_bucket_status_;
381361
382362 // Background thread to tail stream
@@ -404,23 +384,23 @@ class AwsEnv : public CloudEnvImpl {
404384 Status status ();
405385
406386 // Delete the specified path from S3
407- Status DeletePathInS3 (const std::string& bucket_prefix ,
387+ Status DeletePathInS3 (const std::string& bucket ,
408388 const std::string& fname);
409389
410390 // Validate options
411391 Status CheckOption (const EnvOptions& options);
412392
413393 // Return the list of children of the specified path
414394 Status GetChildrenFromS3 (const std::string& path,
415- const std::string& bucket_prefix ,
395+ const std::string& bucket ,
416396 std::vector<std::string>* result);
417397
418398 // If metadata, size or modtime is non-nullptr, returns requested data
419- Status HeadObject (const std::string& bucket_prefix , const std::string& path,
399+ Status HeadObject (const std::string& bucket , const std::string& path,
420400 Aws::Map<Aws::String, Aws::String>* metadata = nullptr ,
421401 uint64_t * size = nullptr , uint64_t * modtime = nullptr );
422402
423- Status NewS3ReadableFile (const std::string& bucket_prefix ,
403+ Status NewS3ReadableFile (const std::string& bucket ,
424404 const std::string& fname,
425405 unique_ptr<S3ReadableFile>* result);
426406
0 commit comments