Add fs implementation and add to trove

This commit is contained in:
Andrew Mulbrook 2026-03-19 22:43:11 -05:00
parent 2cfe32b333
commit f80f4d12a2
5 changed files with 308 additions and 8 deletions

View file

@ -213,6 +213,36 @@ class TroveFuseOps(pyfuse3.Operations):
raise pyfuse3.FUSEError(errno.EISDIR)
parent.unlink(name_str)
async def rename(self, parent_inode_old, name_old, parent_inode_new, name_new, flags, ctx):
old_parent = self._note_or_error(parent_inode_old)
new_parent = self._note_or_error(parent_inode_new)
if not isinstance(old_parent, TroveTree) or not isinstance(new_parent, TroveTree):
raise pyfuse3.FUSEError(errno.ENOTDIR)
name_old_str = name_old.decode()
name_new_str = name_new.decode()
old_entries = old_parent.list()
if name_old_str not in old_entries:
raise pyfuse3.FUSEError(errno.ENOENT)
child_id = old_entries[name_old_str]
child = self._trove.get_raw_note(child_id)
if child is None:
raise pyfuse3.FUSEError(errno.ENOENT)
# Remove existing target if present
new_entries = new_parent.list()
if name_new_str in new_entries:
target = self._trove.get_raw_note(new_entries[name_new_str])
if target is not None and isinstance(target, TroveTree):
if target.list():
raise pyfuse3.FUSEError(errno.ENOTEMPTY)
new_parent.unlink(name_new_str)
new_parent.link(name_new_str, child)
old_parent.unlink(name_old_str)
# ------------------------------------------------------------------
# Serve