pub fn run(data_root: PathBuf, command: Command) -> Result<()>Expand description
Dispatch a server verb. The one entry point both this crate’s binary and
gunnar-cli’s run() route server commands through, so the wiring lives
exactly once (one implementation).
The trailing catch-all is there only so this compiles inside a gunnar-solo
build, where feature unification gives gunnar_common::cli::Command the
client/control variants too. It is never reached: a server-only binary has no
other variants, and gunnar-cli routes only the server ones here.
§It also closes the stores, and that is why the dispatch is wrapped
storage::shutdown runs on the way out, on the error path as well as the
success path. Being the server dispatch is what makes one call site enough:
gunnar-server’s main and every gunnar-cli binary’s server verbs both
arrive here, so neither main has to remember. Both of those mains end in
std::process::exit(1) on error, which unwinds nothing and drops nothing —
hence a call, before the value is returned to them, rather than a guard.
See storage::shutdown and storage::znippy_engine::shutdown for what is
being released and what it costs not to.