@@ -390,7 +390,8 @@ def isDir(self):
390390 def isFile (self ):
391391 return not self .isDir ()
392392
393- def children (self ):
393+ @property
394+ def children (self ) -> List [int ]:
394395 if self ._children is None :
395396 self ._children = []
396397 childrenNames = self .fs .stage .listdir (self .getStagePath ())
@@ -400,6 +401,10 @@ def children(self):
400401 self ._children .append (childInode .id )
401402
402403 return self ._children
404+
405+ def unlink (self , id ):
406+ assert self ._children is not None
407+ self ._children .remove (id )
403408
404409class SinglestoreFS (pyfuse3 .Operations ):
405410 def __init__ (self , fileLocation : FileLocation ):
@@ -453,7 +458,7 @@ async def lookup(self, parent_id, name, ctx=None):
453458
454459 assert parent_inode .isDir ()
455460
456- for child_id in parent_inode .children () :
461+ for child_id in parent_inode .children :
457462 child_inode = self .inodes [child_id ]
458463 if child_inode .getNameWithoutTrailingSlash () == name .decode ():
459464 return await self .getattr (child_id )
@@ -472,7 +477,7 @@ async def readdir(self, fh, start_id, token):
472477
473478 assert inode .isDir ()
474479
475- children = {child : self .inodes [child ] for child in inode .children () if child > start_id }
480+ children = {child : self .inodes [child ] for child in inode .children if child > start_id }
476481
477482 for child in children .values ():
478483 pyfuse3 .readdir_reply (
@@ -519,7 +524,7 @@ async def unlink(self, parent_id, name, ctx):
519524 inode = self .inodes [attr .st_ino ]
520525 assert inode .isFile ()
521526 self .stage .remove (inode .getStagePath ())
522- parent_inode ._children . remove (inode .id )
527+ parent_inode .unlink (inode .id )
523528 del self .inodes [inode .id ]
524529 return
525530
@@ -544,7 +549,7 @@ async def rename(self, parent_id, name, newparent_id, newname, ctx):
544549 inode .parent = newparent_inode
545550 inode .name = newname .decode ()
546551 newparent_inode ._children .append (inode .id )
547- parent_inode ._children . remove (inode .id )
552+ parent_inode .unlink (inode .id )
548553 return
549554
550555 async def rmdir (self , parent_id , name , ctx ):
@@ -554,7 +559,7 @@ async def rmdir(self, parent_id, name, ctx):
554559 inode = self .inodes [attr .st_ino ]
555560 assert inode .isDir ()
556561 self .stage .rmdir (inode .getStagePath ())
557- parent_inode ._children . remove (inode .id )
562+ parent_inode .unlink (inode .id )
558563 del self .inodes [inode .id ]
559564 return
560565
@@ -686,7 +691,7 @@ def mount(self, mountpoint) -> None:
686691 fs = SinglestoreFS (self )
687692 fuse_options = set (pyfuse3 .default_options )
688693 # fuse_options.add('fsname=singlestore_fs')
689- # fuse_options.add('debug')
694+ fuse_options .add ('debug' )
690695 pyfuse3 .init (fs , mountpoint , fuse_options )
691696
692697 try :
0 commit comments