What needs to be done to add more file operation support to SFTP?

This question is mostly directed to @ncw.

In regard to this: SMB vs rclone mount file operation compatibility - #10 by ncw

Can you briefly describe what would need to be done to add support for all operations for the SFTP remote without a VFS cache?

    Files can't be opened for both read AND write
    Files opened for write can't be seeked
    Existing files opened for write must have O_TRUNC set
    Files open for read with O_TRUNC will be opened write only
    Files open for write only will behave as if O_TRUNC was supplied
    Open modes O_APPEND, O_TRUNC are ignored

This needs a new internal interface to the backends.

Rclone has one called OpenWriterAt which would almost do. This is implemented by the local backend to implement multipart streaming.

It needs a slightly more general interface, maybe the equivalent of os.OpenFile opening, returning a file handle which can read and write.

The VFS cache could then find this interface and use it directly.

I'm thinking about the next evolution of the vfs cache and this could be part of the changes.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.