aboutsummaryrefslogtreecommitdiffstats
path: root/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py
diff options
context:
space:
mode:
authorChristophe Besson <cbesson@gmail.com>2026-09-24 01:44:17 +0200
committerChristophe Besson <cbesson@gmail.com>2026-09-24 16:45:37 +0200
commit7216c1779a799652a8fb4d9301bbf05952b33661 (patch)
tree8644234c0966e9f78d1ed9519bf3cad1395c7b63 /packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py
parent15e7084bad34edb60a5999994731a8a2ed1dc6c8 (diff)
downloadmeshbay-7216c1779a799652a8fb4d9301bbf05952b33661.tar.gz
refactor(node): move the subtitle handler out of webrtc_server
SubtitlesMixin in transport/webrtc/apps/subtitles.py; _locate, which it shares with the files, music and streaming handlers, in 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.py23
1 files changed, 23 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
new file mode 100644
index 0000000..fd3184c
--- /dev/null
+++ b/packages/meshbay-node/src/meshbay_node/transport/webrtc/disk.py
@@ -0,0 +1,23 @@
+"""Blocking disk work the session hands to `off_disk`."""
+
+from pathlib import Path
+
+from meshbay_node.roots import ROOT_NOT_SERVED, RootSet, entry_abs_path
+
+
+def _locate(roots: RootSet, entry) -> tuple[Path | None, str | None]:
+ """
+ Where an entry is, and whether it is readable — or the refusal to send.
+
+ Both halves are syscalls: `resolve()` walks the path and `exists()` stats
+ it, and a stat is what *wakes* a sleeping disk. Leaving either on the event
+ loop and offloading only the read would move the stall rather than remove
+ it, and the read would then find the disk already awake. Blocking; called
+ through `off_disk`.
+ """
+ path = entry_abs_path(roots, entry)
+ if path is None:
+ return None, ROOT_NOT_SERVED
+ if not path.exists():
+ return None, "File not on disk"
+ return path, None