Beispiel #1
0
    async def lookup(
            self,
            inode_p: int,
            name: bytes,
            ctx: pyfuse3.RequestContext = None) -> pyfuse3.EntryAttributes:
        """
        Look up a directory entry by name and get its attributes.

        This method should return an EntryAttributes instance for the directory entry name in the
        directory with inode parent_inode.

        If there is no such entry, the method should either return an EntryAttributes instance with
        zero st_ino value (in which case the negative lookup will be cached as specified by
        entry_timeout), or it should raise FUSEError with an errno of errno.ENOENT (in this case
        the negative result will not be cached).

        ctx will be a RequestContext instance.

        The file system must be able to handle lookups for . and .., no matter if these entries are
        returned by readdir or not.

        (Successful) execution of this handler increases the lookup count for the returned inode by one.
        """

        if name == '.':
            info = Inode.by_inode(inode_p)
        elif name == '..':
            info = Inode.by_inode(inode_p)
            info = info.parent_obj()
        else:
            info = Inode.by_name(inode_p, name.decode())

        return self._getattr(info, ctx)