Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 17 additions & 2 deletions src/borg/fuse.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
"""
FUSE filesystem implementation for `borg mount`.

IMPORTANT
=========

This code is only safe for single-threaded and synchronous (non-async) usage.

- llfuse is synchronous and used with workers=1, so there is only 1 thread,
and we are safe.
- pyfuse3 uses Trio, which only uses 1 thread, but could use this code in an
asynchronous manner. However, as long as we do not use any asynchronous
operations (like using "await") in this code, it is still de facto
synchronous, and we are safe.
"""
import errno
import functools
import io
Expand Down Expand Up @@ -162,7 +177,7 @@ def iter_archive_items(self, archive_item_ids, filter=None, consider_part_files=
for key, (csize, data) in zip(archive_item_ids, self.decrypted_repository.get_many(archive_item_ids)):
# Store the chunk ID in the meta-array
if write_offset + 32 >= len(meta):
self.meta = meta = meta + bytes(self.GROW_META_BY)
meta.extend(bytes(self.GROW_META_BY))
meta[write_offset:write_offset + 32] = key
current_id_offset = write_offset
write_offset += 32
Expand Down Expand Up @@ -200,7 +215,7 @@ def iter_archive_items(self, archive_item_ids, filter=None, consider_part_files=
msgpacked_bytes = b''

if write_offset + 9 >= len(meta):
self.meta = meta = meta + bytes(self.GROW_META_BY)
meta.extend(bytes(self.GROW_META_BY))

# item entries in the meta-array come in two different flavours, both nine bytes long.
# (1) for items that span chunks:
Expand Down
Loading