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.

{
public:
    using ObjectMetadata = std::map<std::string, std::string>;
    using Futures = std::vector<std::future<void>>;
    using SettingsPtr = std::unique_ptr<DiskS3Settings>;
    using GetDiskSettings = std::function<SettingsPtr(const Poco::Util::AbstractConfiguration &, const String, ContextPtr)>;
    struct RestoreInformation;
    DiskS3(
        String name_,
        String bucket_,
        String s3_root_path_,
        String metadata_path_,
        ContextPtr context_,
        SettingsPtr settings_,
        GetDiskSettings settings_getter_);
    std::unique_ptr<ReadBufferFromFileBase> readFile(
        const String & path,
        const ReadSettings & settings,
        std::optional<size_t> size) const override;
    std::unique_ptr<WriteBufferFromFileBase> writeFile(
        const String & path,
        size_t buf_size,
        WriteMode mode) override;
    void removeFromRemoteFS(RemoteFSPathKeeperPtr keeper) override;
    RemoteFSPathKeeperPtr createFSPathKeeper() const override;
    void moveFile(const String & from_path, const String & to_path, bool send_metadata);
    void moveFile(const String & from_path, const String & to_path) override;
    void createHardLink(const String & src_path, const String & dst_path) override;
    void createHardLink(const String & src_path, const String & dst_path, bool send_metadata);
    DiskType getType() const override { return DiskType::S3; }