diff options
| author | Christophe Besson <cbesson@gmail.com> | 2026-09-24 10:12:37 +0200 |
|---|---|---|
| committer | Christophe Besson <cbesson@gmail.com> | 2026-09-24 16:45:38 +0200 |
| commit | 02aeb0a751dce80fac1bfca31b6f736558953b77 (patch) | |
| tree | 99c3accd0adab829e07256e36459a36f0516c143 /packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py | |
| parent | 219f3f7d1caafb45a9f7118f9792f6881501b3e7 (diff) | |
| download | meshbay-02aeb0a751dce80fac1bfca31b6f736558953b77.tar.gz | |
refactor(node): move uploads out of webrtc_server
UploadMixin in transport/webrtc/upload_handlers.py, with the upload cap;
_upload_chunk moved unchanged, _append_chunk joins webrtc/disk.py.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py')
| -rw-r--r-- | packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py b/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py index bc8d33f..2e484de 100644 --- a/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py +++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py @@ -74,3 +74,9 @@ def _read_and_encrypt( f.seek(chunk_index * CHUNK_SIZE) plaintext = f.read(CHUNK_SIZE) return file_chunk_wire(gek, plaintext, chunk_index, file_hash, file_id) + + +def _append_chunk(tmp_path: Path, chunk_bytes: bytes, first: bool) -> None: + """Add one chunk to a partial upload. Blocking; called through `off_disk`.""" + with open(tmp_path, "wb" if first else "ab") as f: + f.write(chunk_bytes) |