Repository: apache/arrow
File: cpp/src/arrow/filesystem/azurefs.cc (C++)

Code before:
      // reading a source blob in the same storage account.
      auto copy_operation = dest_blob_client.StartCopyFromUri(src_url);
      // For large blobs, the copy operation may be slow so we need to poll until it
      // completes. We use a polling interval of 1 second.
      copy_operation.PollUntilDone(std::chrono::milliseconds(1000));
    } catch (const Storage::StorageException& exception) {
      // StartCopyFromUri failed or a GetProperties call inside PollUntilDone failed.
      return ExceptionToStatus(
          exception, "Failed to start blob copy or poll status of ongoing copy. (",
          src_url, " -> ", dest_blob_client.GetUrl(), ")");
    } catch (const Azure::Core::RequestFailedException& exception) {
      // A GetProperties call inside PollUntilDone returned a failed CopyStatus.
      return ExceptionToStatus(exception, "Failed to copy blob. (", src_url, " -> ",
                               dest_blob_client.GetUrl(), ")");
    }
    return Status::OK();
  }
};

std::atomic<LeaseGuard::SteadyClock::time_point> LeaseGuard::latest_known_expiry_time_ =
    SteadyClock::time_point{SteadyClock::duration::zero()};

// Destructor must be defined here where Impl is a complete type.
// Defining it in the header (even as = default) causes MSVC to fail
// because it tries to instantiate std::default_delete<Impl> before Impl is defined.
AzureFileSystem::~AzureFileSystem() {}

AzureFileSystem::AzureFileSystem(std::unique_ptr<Impl>&& impl)
    : FileSystem(impl->io_context()), impl_(std::move(impl)) {
  default_async_is_sync_ = false;
}

void AzureFileSystem::ForceCachedHierarchicalNamespaceSupport(int hns_support) {
  impl_->ForceCachedHierarchicalNamespaceSupport(hns_support);
}

Result<std::shared_ptr<AzureFileSystem>> AzureFileSystem::Make(
    const AzureOptions& options, const io::IOContext& io_context) {
  ARROW_ASSIGN_OR_RAISE(auto impl, AzureFileSystem::Impl::Make(options, io_context));
  return std::shared_ptr<AzureFileSystem>(new AzureFileSystem(std::move(impl)));
}

const AzureOptions& AzureFileSystem::options() const { return impl_->options(); }

bool AzureFileSystem::Equals(const FileSystem& other) const {
  if (this == &other) {
    return true;
  }
  if (other.type_name() != type_name()) {
    return false;
  }

Review comment (suggestion):
Nit: I think we can still use the "default" idiom here:
```suggestion
AzureFileSystem::~AzureFileSystem() = default;
```

Code after:
      // For large blobs, the copy operation may be slow so we need to poll until it
      // completes. We use a polling interval of 1 second.
      copy_operation.PollUntilDone(std::chrono::milliseconds(1000));
    } catch (const Storage::StorageException& exception) {
      // StartCopyFromUri failed or a GetProperties call inside PollUntilDone failed.
      return ExceptionToStatus(
          exception, "Failed to start blob copy or poll status of ongoing copy. (",
          src_url, " -> ", dest_blob_client.GetUrl(), ")");
    } catch (const Azure::Core::RequestFailedException& exception) {
      // A GetProperties call inside PollUntilDone returned a failed CopyStatus.
      return ExceptionToStatus(exception, "Failed to copy blob. (", src_url, " -> ",
                               dest_blob_client.GetUrl(), ")");
    }
    return Status::OK();
  }
};

std::atomic<LeaseGuard::SteadyClock::time_point> LeaseGuard::latest_known_expiry_time_ =
    SteadyClock::time_point{SteadyClock::duration::zero()};

AzureFileSystem::~AzureFileSystem() = default;

AzureFileSystem::AzureFileSystem(std::unique_ptr<Impl>&& impl)
    : FileSystem(impl->io_context()), impl_(std::move(impl)) {
  default_async_is_sync_ = false;
}

void AzureFileSystem::ForceCachedHierarchicalNamespaceSupport(int hns_support) {
  impl_->ForceCachedHierarchicalNamespaceSupport(hns_support);
}

Result<std::shared_ptr<AzureFileSystem>> AzureFileSystem::Make(
    const AzureOptions& options, const io::IOContext& io_context) {
  ARROW_ASSIGN_OR_RAISE(auto impl, AzureFileSystem::Impl::Make(options, io_context));
  return std::shared_ptr<AzureFileSystem>(new AzureFileSystem(std::move(impl)));
}

const AzureOptions& AzureFileSystem::options() const { return impl_->options(); }

bool AzureFileSystem::Equals(const FileSystem& other) const {
  if (this == &other) {
    return true;
  }
  if (other.type_name() != type_name()) {
    return false;
  }
  const auto& azure_fs = ::arrow::internal::checked_cast<const AzureFileSystem&>(other);
  return options().Equals(azure_fs.options());
}

Result<FileInfo> AzureFileSystem::GetFileInfo(const std::string& path) {