galaxy-fuse.py 文件源码

python
阅读 36 收藏 0 点赞 0 评论 0

项目:galaxy_refseq_libraries 作者: gvlproject 项目源码 文件源码
def getattr(self, path, fh=None):
        (typ,kw) = path_type(path)
        now = time.time()
        if typ=='root' or typ=='histories':
            # Simple directory
            st = dict(st_mode=(S_IFDIR | 0555), st_nlink=2)
            st['st_ctime'] = st['st_mtime'] = st['st_atime'] = now
        elif typ=='datasets':
            # Simple directory
            st = dict(st_mode=(S_IFDIR | 0555), st_nlink=2)
            st['st_ctime'] = st['st_mtime'] = st['st_atime'] = now
        elif typ=='historydataorcoll':
            # Dataset or collection
            d = self._dataset(kw)

            if d['history_content_type'] == 'dataset_collection':
                # A collection, will be a simple directory.
                st = dict(st_mode=(S_IFDIR | 0555), st_nlink=2)
                st['st_ctime'] = st['st_mtime'] = st['st_atime'] = now
            else:
                # A file, will be a symlink to a galaxy dataset.
                t = time.mktime(time.strptime(d['update_time'],'%Y-%m-%dT%H:%M:%S.%f'))
                fname = esc_filename(d.get('file_path', d['file_name']))
                st = dict(st_mode=(S_IFLNK | 0444), st_nlink=1,
                                  st_size=len(fname), st_ctime=t, st_mtime=t,
                                  st_atime=t)
        elif typ=='collectiondataset':
            # A file within a collection, will be a symlink to a galaxy dataset.
            d = self._dataset(kw, display=False)
            t = time.mktime(time.strptime(d['update_time'],'%Y-%m-%dT%H:%M:%S.%f'))
            fname = esc_filename(d.get('file_path', d['file_name']))
            st = dict(st_mode=(S_IFLNK | 0444), st_nlink=1,
                              st_size=len(fname), st_ctime=t, st_mtime=t,
                              st_atime=t)
        else:
            raise FuseOSError(ENOENT)
        return st

    # Return a symlink for the given dataset
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号