@@ -417,18 +417,6 @@ Status CloudFileSystemOptions::Serialize(const ConfigOptions& config_options,
417
417
reinterpret_cast <const char *>(this ), value);
418
418
}
419
419
420
- CloudFileSystemEnv::CloudFileSystemEnv (const CloudFileSystemOptions& options,
421
- const std::shared_ptr<FileSystem>& base,
422
- const std::shared_ptr<Logger>& logger)
423
- : cloud_fs_options(options), base_fs_(base), info_log_(logger) {
424
- RegisterOptions (&cloud_fs_options, &cloud_fs_option_type_info);
425
- }
426
-
427
- CloudFileSystemEnv::~CloudFileSystemEnv () {
428
- cloud_fs_options.cloud_log_controller .reset ();
429
- cloud_fs_options.storage_provider .reset ();
430
- }
431
-
432
420
Status CloudFileSystemEnv::NewAwsFileSystem (
433
421
const std::shared_ptr<FileSystem>& base_fs,
434
422
const std::string& src_cloud_bucket, const std::string& src_cloud_object,
@@ -492,12 +480,13 @@ void CloudFileSystemEnv::RegisterCloudObjects(const std::string& arg) {
492
480
});
493
481
}
494
482
495
- std::unique_ptr<Env> CloudFileSystemEnv::NewCompositeEnvFromThis (Env* env) {
483
+ std::unique_ptr<Env> CloudFileSystemEnv::NewCompositeEnvFromFs (FileSystem* fs,
484
+ Env* env) {
496
485
// We need a shared_ptr<FileSystem> pointing to "this", to initialize the
497
486
// env wrapper, but we don't want that shared_ptr to own the lifecycle for
498
487
// "this". Creating a shared_ptr with a custom no-op deleter instead.
499
- std::shared_ptr<FileSystem> fs ( this , [](auto * /* p*/ ) { /* noop*/ });
500
- return std::make_unique<CompositeEnvWrapper>(env, fs );
488
+ std::shared_ptr<FileSystem> fsPtr (fs , [](auto * /* p*/ ) { /* noop*/ });
489
+ return std::make_unique<CompositeEnvWrapper>(env, fsPtr );
501
490
}
502
491
503
492
Status CloudFileSystemEnv::CreateFromString (
@@ -529,13 +518,13 @@ Status CloudFileSystemEnv::CreateFromString(
529
518
copy.invoke_prepare_options = false ; // Prepare here, not there
530
519
s = ObjectRegistry::NewInstance ()->NewUniqueObject <FileSystem>(id, &fs);
531
520
if (s.ok ()) {
532
- auto * cfs = dynamic_cast <CloudFileSystemEnv *>(fs.get ());
521
+ auto * cfs = dynamic_cast <CloudFileSystemImpl *>(fs.get ());
533
522
assert (cfs);
534
523
if (!options.empty ()) {
535
524
s = cfs->ConfigureFromMap (copy, options);
536
525
}
537
526
if (s.ok () && config_options.invoke_prepare_options ) {
538
- auto env = cfs-> NewCompositeEnvFromThis ( copy.env );
527
+ auto env = NewCompositeEnvFromFs (cfs, copy.env );
539
528
copy.invoke_prepare_options = config_options.invoke_prepare_options ;
540
529
copy.env = env.get ();
541
530
s = cfs->PrepareOptions (copy);
@@ -583,15 +572,15 @@ Status CloudFileSystemEnv::CreateFromString(
583
572
copy.invoke_prepare_options = false ; // Prepare here, not there
584
573
s = ObjectRegistry::NewInstance ()->NewUniqueObject <FileSystem>(id, &fs);
585
574
if (s.ok ()) {
586
- auto * cfs = dynamic_cast <CloudFileSystemEnv *>(fs.get ());
575
+ auto * cfs = dynamic_cast <CloudFileSystemImpl *>(fs.get ());
587
576
assert (cfs);
588
577
auto copts = cfs->GetOptions <CloudFileSystemOptions>();
589
578
*copts = cloud_options;
590
579
if (!options.empty ()) {
591
580
s = cfs->ConfigureFromMap (copy, options);
592
581
}
593
582
if (s.ok () && config_options.invoke_prepare_options ) {
594
- auto env = cfs-> NewCompositeEnvFromThis ( copy.env );
583
+ auto env = NewCompositeEnvFromFs (cfs, copy.env );
595
584
copy.invoke_prepare_options = config_options.invoke_prepare_options ;
596
585
copy.env = env.get ();
597
586
s = cfs->PrepareOptions (copy);
0 commit comments