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.

ReservationPtr reserve(UInt64 bytes) override;
    String getUniqueId(const String & path) const override;
    bool checkUniqueId(const String & id) const override = 0;
    virtual void removeFromRemoteFS(RemoteFSPathKeeperPtr fs_paths_keeper) = 0;
    virtual RemoteFSPathKeeperPtr createFSPathKeeper() const = 0;
    static AsynchronousReaderPtr getThreadPoolReader();
protected:
    Poco::Logger * log;
    const String name;
    const String remote_fs_root_path;
    const String metadata_path;
private:
    void removeMeta(const String & path, RemoteFSPathKeeperPtr fs_paths_keeper);
    void removeMetaRecursive(const String & path, RemoteFSPathKeeperPtr fs_paths_keeper);
    bool tryReserve(UInt64 bytes);
    UInt64 reserved_bytes = 0;
    UInt64 reservation_count = 0;
    std::mutex reservation_mutex;
};
using RemoteDiskPtr = std::shared_ptr<IDiskRemote>;
struct RemoteMetadata
{
    using PathAndSize = std::pair<String, size_t>;
    
    std::vector<PathAndSize> remote_fs_objects;
    
    const String & remote_fs_root_path;
    
    const String metadata_file_path;
    RemoteMetadata(const String & remote_fs_root_path_, const String & metadata_file_path_)