What a process holds

What a process holds

A wait on a lock file whose file names its holder as "pid": <n> — every product installation's surface lock — is also an edge of the machine's wait-for graph: beside the register, <register>.graph/<id> (~/.stado/waits.graph/<id>) holds the wait's resource, here lock:<path>, until the wait ends. A lock is one kind of resource the graph knows; a wait can await any of them, each written <kind>:<id>:

kind what it is who holds it
lock a lock file the "pid" its own file names, and any recorded holding
host a fleet host a process keeps a channel to or waits to reach a recorded holding
service a service by name the process serving it, as recorded
revision a product revision, <product>@<revision> the operation delivering it, as recorded
unit a service-manager unit the process managing it, as recorded
port a listening port, <address>:<port> the process bound to it, as recorded

What a process holds beside a lock file's own record lives beside the register too, <register>.holds/<pid>-<n> (~/.stado/waits.holds/…), one resource per file. A Rust program records its own holding with stado_wait::hold(&resource), released when the answer is dropped; any other program records it for a process that holds something:

stado waits hold --resource <kind>:<id> --pid <pid> [--json]
stado waits release <id> [--json]
stado waits holds [--json]

hold prints recorded <id>: process <pid> holds <kind> <id> ({"id", "pid", "resource"}); release prints released <id>, or <id> was no longer recorded: it had been released or its process was gone ({"id", "removed"}); holds lists every holding of a running process ({"holds": [{"id", "pid", "resource"}]}) and removes those of processes that ended. A wait registered for another process awaits a resource with stado waits open … --awaits <kind>:<id>, which adds "awaits" to its answer and , awaiting <kind> <id> to its line.

Source: this website