In class IDiskRemote, all metadata file system operations use os file system api directly.
There is little extendiability if we want store the metadata of HDFS or S3 into distributed file system.
So I suggest change this way by using DiskPtr and will propose a pull request.

In addition, metadata of HDFS or S3 only store local FS which is not sharable.

void processRestoreFiles(const String & source_bucket, const String & source_path, std::vector<String> keys);
    void restoreFileOperations(const RestoreInformation & restore_information);
    
    
    static String shrinkKey(const String & path, const String & key);
    std::tuple<UInt64, String> extractRevisionAndOperationFromKey(const String & key);
    
    static String pathToDetached(const String & source_path);
    const String bucket;
    MultiVersion<DiskS3Settings> current_settings;
    
    GetDiskSettings settings_getter;
    std::atomic<UInt64> revision_counter = 0;
    static constexpr UInt64 LATEST_REVISION = std::numeric_limits<UInt64>::max();
    static constexpr UInt64 UNKNOWN_REVISION = 0;
    
    inline static const String RESTORE_FILE_NAME = "restore";
    
    const re2::RE2 key_regexp {".*/r(\\d+)-(\\w+).*"};
    
    inline static const String SCHEMA_VERSION_OBJECT = ".SCHEMA_VERSION";
    
    static constexpr int RESTORABLE_SCHEMA_VERSION = 1;
    
    const std::vector<String> data_roots {"data", "store"};
    ContextPtr context;
};
}
#endif