@8000ff Really appreciate your doing this! A few high-level comments:
The guts of the rename function here look right to me (I'll leave a few comments about error handling, but the big picture is right). Since renaming is useful in Hyperdrive generally, I'd move the rename logic over there, and have hyperdrive-fuse's rename call out to that (so that rename looks a lot like truncate).
The tests you wrote are great to have. If you don't mind, one more test that shows that renaming a directory fails with an EISDIR (as you mentioned in the Discord) would be ideal.
Let me know if you're up for doing those things. If not, I'd be happy to go ahead and do it for you too. Thanks again :)
Just one more follow-up: if this code's moved to Hyperdrive, then the error handling will have to be slightly different, but I can help out with that in the Hyperdrive PR.
@8000ff Really appreciate your doing this! A few high-level comments:
The guts of the
rename
function here look right to me (I'll leave a few comments about error handling, but the big picture is right). Since renaming is useful in Hyperdrive generally, I'd move therename
logic over there, and have hyperdrive-fuse'srename
call out to that (so that rename looks a lot liketruncate
).The tests you wrote are great to have. If you don't mind, one more test that shows that renaming a directory fails with an EISDIR (as you mentioned in the Discord) would be ideal.
Let me know if you're up for doing those things. If not, I'd be happy to go ahead and do it for you too. Thanks again :)