pub fn standing_at(
worktree: &Path,
local_half: &str,
) -> (ServerStanding, Option<String>, LeaseFile)Expand description
Where the server of one checkout stands, with the lease the verdict was read from.
standing_of is the decision; this is the one reading that feeds it — the lease file
of worktree under local_half, how old that file is, one probe of the address it
names, against this executable’s version. Every surface that asks where a server stands
asks through here, so that server.status and the server check of health.report
cannot drift into two answers.
Costs one small file read, and one HTTP round trip bounded by the declared probe timeout
(crate::lease::timings) when the lease names an address. Nothing is cached: the
file is written by other processes.
use majordomus_cli::capability::builtin::server::{local_half, standing_at, ServerStanding};
let nowhere = std::path::Path::new("/nonexistent/checkout");
let (standing, reason, lease) = standing_at(nowhere, &local_half(nowhere));
assert_eq!(standing, ServerStanding::Absent);
assert!(reason.is_none(), "there is nothing to explain: no lease, no server");
assert!(lease.document().is_none());