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.

{
    
    if (send_metadata && !dst_path.starts_with("shadow/"))
    {
        auto revision = ++revision_counter;
        const ObjectMetadata object_metadata {
            {"src_path", src_path},
            {"dst_path", dst_path}
        };
        createFileOperationObject("hardlink", revision, object_metadata);
    }
    
    auto src = readMeta(src_path);
    ++src.ref_count;
    src.save();
    
    DB::createHardLink(metadata_path + src_path, metadata_path + dst_path);
}
void DiskS3::shutdown()
{
    auto settings = current_settings.get();
    
    
    
    
    settings->client->DisableRequestProcessing();
}
void DiskS3::createFileOperationObject(const String & operation_name, UInt64 revision, const DiskS3::ObjectMetadata & metadata)