Skip to main content

elect

Function elect 

Source
pub fn elect(repo: &Repository) -> Result<Role, Error>
Expand description

Decide whether this process serves the repository or attaches to the process that does.

An existing file is read on every attempt and classified: the lease of a live server (it answers for this root) is attached to; a stale one (its server does not answer), a corrupt one (not a lease document), an empty one, or an abandoned one (no URL after BIND_GRACE) is taken over; a fresh lease without a URL means its owner is still binding, and this process waits for it. Nothing a client leaves behind can lock the others out; when the file can neither be created nor removed within JOIN_TIMEOUT, the error names the path and the caller serves its client alone.