async def _getattr(self, inode, ctx=None): entry = fuse.EntryAttributes() if inode in self.write_buffers: entry.st_mode = (stat.S_IFREG | 0o644) entry.st_size = 0 stamp = int(now().timestamp() * 1e9) else: item = await self.get_by_id(self.get_id(inode)) if isinstance(item, Document): entry.st_mode = (stat.S_IFREG | 0o444) # TODO: Permissions? if self.mode == FSMode.raw: entry.st_size = await item.raw_size() elif self.mode == FSMode.annot or (self.mode == FSMode.orig and await item.type() == FileType.notes): entry.st_size = await item.annotated_size() elif self.mode == FSMode.orig: entry.st_size = await item.size() else: entry.st_size = 0 elif isinstance(item, Folder): entry.st_mode = (stat.S_IFDIR | 0o755) entry.st_size = 0 elif isinstance(item, ModeFile): entry.st_mode = (stat.S_IFREG | 0o644) entry.st_size = await item.size() stamp = int(item.mtime.timestamp() * 1e9) entry.st_atime_ns = stamp entry.st_ctime_ns = stamp entry.st_mtime_ns = stamp entry.st_gid = os.getgid() entry.st_uid = os.getuid() entry.st_ino = inode return entry
def mtime(self): return now()