pub(crate) fn check_source(
src: &Source,
on_a_tty: bool,
) -> Result<(), Box<dyn Error>>Expand description
The guards serve_with runs, for a mira mira --data-dir that maps exactly
the same blocks with no server in front of it.
Without them mira_core::block::scan reads ENOENT as an empty directory,
so a typo or a volume that never mounted prints no rows in this window · 0/0 blocks — indistinguishable from a healthy empty store, and “is the data
gone” is the question this feature exists to answer at 3am. A network
filesystem is worse: it reaches mmap and leaves on SIGBUS, with nothing
printed at all, where the server would have refused with a paragraph naming
the mount.
check_writable is deliberately not here. The TUI writes nothing, and a
read-only mount is the normal way to look at a detached volume.
The two cases with nothing to check are decided here rather than at the call
site, because both of them are rules about this check and not about the
caller. A remote source is somebody else’s directory: the server answering
on that address ran these on its own way up, and this process never maps one
of its blocks. And off a terminal tui::run refuses a redirected stdin or
stdout on its first line, which outranks a diagnosis of a directory nothing
was going to be drawn from anyway.