| 270 | """Virtual filesystem based on archive(s) to provide information to fuse""" |
| 271 | |
| 272 | def __init__(self, manifest, args, decrypted_repository): |
| 273 | self._args = args |
| 274 | self.numeric_ids = args.numeric_ids |
| 275 | self._manifest = manifest |
| 276 | self.repo_objs = manifest.repo_objs |
| 277 | self.repository_uncached = manifest.repository |
| 278 | # Maps inode numbers to Item instances. This is used for synthetic inodes, i.e. file-system objects that are |
| 279 | # made up and are not contained in the archives. For example archive directories or intermediate directories |
| 280 | # not contained in archives. |
| 281 | self._items = {} |
| 282 | # cache up to <FILES> Items |
| 283 | self._inode_cache = LRUCache(capacity=FILES) |
| 284 | # _inode_count is the current count of synthetic inodes, i.e. those in self._items |
| 285 | self.inode_count = 0 |
| 286 | # Maps inode numbers to the inode number of the parent |
| 287 | self.parent = {} |
| 288 | # Maps inode numbers to a dictionary mapping byte directory entry names to their inode numbers, |
| 289 | # i.e. this contains all dirents of everything that is mounted. (It becomes really big). |
| 290 | self.contents = defaultdict(dict) |
| 291 | self.default_uid = os.getuid() |
| 292 | self.default_gid = os.getgid() |
| 293 | self.default_dir = None |
| 294 | # Archives to be loaded when first accessed, mapped by their placeholder inode |
| 295 | self.pending_archives = {} |
| 296 | self.cache = ItemCache(decrypted_repository) |
| 297 | self.allow_damaged_files = False |
| 298 | self.versions = False |
| 299 | self.uid_forced = None |
| 300 | self.gid_forced = None |
| 301 | self.umask = 0 |
| 302 | self.archive_root_dir = {} # archive ID --> directory name |
| 303 | |
| 304 | def _create_filesystem(self): |
| 305 | self._create_dir(parent=1) # first call, create root dir (inode == 1) |