Scille / parsec-cloud

Open source Dropbox-like file sharing with full client encryption !
https://parsec.cloud
Other
270 stars 40 forks source link

`WorkspaceOps::fd_write` should not return number of bytes written since the whole buffer is always written #8075

Open touilleMan opened 2 months ago

touilleMan commented 2 months ago

see https://github.com/Scille/parsec-cloud/pull/7937#discussion_r1724280329

so signature should be changed to:

    pub async fn fd_write(
        &self,
        fd: FileDescriptor,
        offset: u64,
        data: &[u8],
    ) -> Result<(), WorkspaceFdWriteError>

Not WorkspaceOps::fd_write_constrained_io still requires the number of bytes written to be returned (given, in this case, a subset of the provided buffer can be written). Hence the fd_write function at the transaction level shouldn't change it signature (given it is used by both WorkspaceOps::fd_write and WorkspaceOps::fd_write_constrained_io)

FirelightFlagboy commented 2 months ago

If that the case, I propose to rename fd_write to fd_write_all to be similar to Write::write_all