"""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