MCPcopy
hub / github.com/borgbackup/borg / _create_filesystem

Method _create_filesystem

src/borg/hlfuse.py:137–170  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

135 self.inodes[ino] = msgpack.packb(item_dict)
136
137 def _create_filesystem(self):
138 self.set_inode(self.root.ino, self.default_dir)
139 self.versions_index = FuseVersionsIndex()
140
141 if getattr(self._args, "name", None):
142 archives = [self._manifest.archives.get(self._args.name)]
143 else:
144 archives = self._manifest.archives.list_considering(self._args)
145
146 name_counter = Counter(a.name for a in archives)
147 duplicate_names = {a.name for a in archives if name_counter[a.name] > 1}
148
149 for archive in archives:
150 name = f"{archive.name}"
151 if name in duplicate_names:
152 name += f"-{bin_to_hex(archive.id):.8}"
153 self.archive_root_dir[archive.id] = name
154
155 for archive in archives:
156 if self.versions:
157 self._process_archive(archive.id)
158 else:
159 # Create placeholder for archive
160 name = self.archive_root_dir[archive.id]
161 name_bytes = os.fsencode(name)
162
163 archive_node = self._create_node(parent=self.root)
164 # Create a directory item for the archive
165 item = Item(internal_dict=self.default_dir.as_dict())
166 item.mtime = int(archive.ts.timestamp() * 1e9)
167 self.set_inode(archive_node.ino, item)
168
169 self.root.add_child(name_bytes, archive_node)
170 self.pending_archives[archive_node] = archive
171
172 def check_pending_archive(self, node):
173 archive_info = self.pending_archives.pop(node, None)

Callers 1

mountMethod · 0.45

Calls 8

set_inodeMethod · 0.95
_process_archiveMethod · 0.95
_create_nodeMethod · 0.95
bin_to_hexFunction · 0.85
list_consideringMethod · 0.80
as_dictMethod · 0.80
add_childMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected