Skip to content

Commit 70c87b6

Browse files
Merge pull request #9246 from ThomasWaldmann/fuse-fixes-1.4
mount: fuse fs performance fix, docstring
2 parents c935dbe + 4eed3ec commit 70c87b6

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/borg/fuse.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
"""
2+
FUSE filesystem implementation for `borg mount`.
3+
4+
IMPORTANT
5+
=========
6+
7+
This code is only safe for single-threaded and synchronous (non-async) usage.
8+
9+
- llfuse is synchronous and used with workers=1, so there is only 1 thread,
10+
and we are safe.
11+
- pyfuse3 uses Trio, which only uses 1 thread, but could use this code in an
12+
asynchronous manner. However, as long as we do not use any asynchronous
13+
operations (like using "await") in this code, it is still de facto
14+
synchronous, and we are safe.
15+
"""
116
import errno
217
import functools
318
import io
@@ -162,7 +177,7 @@ def iter_archive_items(self, archive_item_ids, filter=None, consider_part_files=
162177
for key, (csize, data) in zip(archive_item_ids, self.decrypted_repository.get_many(archive_item_ids)):
163178
# Store the chunk ID in the meta-array
164179
if write_offset + 32 >= len(meta):
165-
self.meta = meta = meta + bytes(self.GROW_META_BY)
180+
meta.extend(bytes(self.GROW_META_BY))
166181
meta[write_offset:write_offset + 32] = key
167182
current_id_offset = write_offset
168183
write_offset += 32
@@ -200,7 +215,7 @@ def iter_archive_items(self, archive_item_ids, filter=None, consider_part_files=
200215
msgpacked_bytes = b''
201216

202217
if write_offset + 9 >= len(meta):
203-
self.meta = meta = meta + bytes(self.GROW_META_BY)
218+
meta.extend(bytes(self.GROW_META_BY))
204219

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

0 commit comments

Comments
 (0)