Add move operation, fix fuse server

This commit is contained in:
Andrew Mulbrook 2026-03-28 13:25:25 -05:00
parent 41480a39c9
commit 6470aee802
5 changed files with 90 additions and 45 deletions

View file

@ -378,12 +378,15 @@ class TroveFuseOps(pyfuse3.Operations):
self._close_handle(handle)
async def unlink(self, parent_inode: InodeT, name: bytes, ctx) -> None:
parent_note = self._get_inode_note(parent_inode)
name_str = name.decode()
parent_note.rm_child(name_str, False)
try:
parent_note = self._get_inode_note(parent_inode)
name_str = name.decode()
parent_note.rm_child(name_str, False)
except tr.ErrorWithErrno as e:
raise pyfuse3.FUSEError(e.errno) from None
async def rename(self, parent_inode_old: InodeT, name_old: bytes, parent_inode_new: InodeT, name_new: bytes, flags, ctx):
# Decode / validate names
# # Decode / validate names
name_new_str = name_new.decode()
name_old_str = name_old.decode()
@ -395,16 +398,8 @@ class TroveFuseOps(pyfuse3.Operations):
if not isinstance(old_parent, TroveTree):
raise pyfuse3.FUSEError(errno.ENOTDIR)
# We want to maintain the inode - find the note via the internal entity
ent, note = self._lookup_child(parent_inode_old, name_old)
# Remove existing target
new_parent.unlink(name_new_str)
# Link to new parent, unlink from old
new_parent.link(name_new_str, note)
old_parent.unlink(name_old_str)
# Move!
self._trove.move(old_parent, name_old_str, new_parent, name_new_str, overwrite=True)
# ------------------------------------------------------------------
# Serve