Expand description
Who holds a device, what they opened on it, and how to close it after they die.
smix could always tear down what it started, as long as it was the one
doing the tearing. Everything else — Ctrl-C on xcodebuild, closing
Simulator.app, an IDE restart, a CI timeout, another agent’s pkill —
killed the process holding a runner, a recording and a booted simulator,
and nothing anywhere remembered that those three things existed. The
runner died by SIGKILL rather than the SIGINT that lets testmanagerd
end the session cleanly, so macOS put up a crash-report dialog; the
recording lost its mp4 trailer; the simulator stayed booted. Teardown
then went looking for survivors by matching process command lines,
which fails in both directions: it kills another project’s runner, and
it misses the one whose command line reads differently.
A ledger fixes the direction of that question. Instead of “what looks like mine”, the next smix command asks “what did the last holder write down”, and closes exactly those things by the graceful path the holder never got to take. That is the whole idea: a kill that had no graceful path gets one at the next startup.
Looking is separated from judging, in the shape crate::Facts shares
with smix-cli’s readiness module: the caller probes the world, and
everything after that is a pure function. It is what lets the ordering
of a teardown be tested without a device.
Modules§
- held
- Device settings a run changed and owes back.
- owners
- Whose a device’s smix resources are: the task that asked for them.
- store
- Where the ledger lives, and how the world is probed to fill in
Facts. - vanish
- Devices that left without smix hearing about it.
Structs§
- Cleanup
Report - What became of one owed close, as the gate needs to hear it.
- Contention
- Why a lease could not be taken, said with the facts the holder needs.
- Destructive
Refused - Why a destructive action was refused.
- Device
Class - Whether a device is physical, as far as the destructive-action gate is concerned.
- Facts
- What the world looks like. Gathered by the caller; never read from the world in here.
- Held
- A ledger found on disk, together with what its holder’s pid looks like right now.
- Holder
Probe - What a probe found at the holder’s pid.
- Lease
- One device’s ledger: a holder, and what it opened.
- NotAddressable
- Why a device reference was refused before anything ran.
- Proc
Identity - Enough to recognise a process later, or refuse to signal it.
Enums§
- Admission
- The verdict.
- Cleanup
Action - A close this process owes the device, on behalf of a holder that died.
- Known
- What is known about a device reference before anything is done to it.
- Prune
Verdict - Whether a ledger still describes anything, and the sentence for it.
- Resource
- A resource a holder opened on a device, and therefore owes a close.
- Row
- One ledger row: something this binary can name, or something it cannot.
- Stale
Reason - Why a holder was judged gone.
Constants§
- STALE_
AFTER_ SECS - How long a holder may go without a heartbeat before its lease is considered abandoned.
Traits§
- Cleanup
Executor - Something that can perform the closes a plan names.
Functions§
- assess
- Judge the facts.
- is_
process_ backed - Does this resource stand for a process that can die?
- is_
service - Is this resource a service — a thing that exists to be used by the next command, rather than an activity that excludes it?
- may_
address - May this device reference be addressed at all?
- may_
destroy - May a destructive action run on this device?
- may_
shut_ down - plan_
cleanup - The closes a dead holder’s lease owes, in the order they must happen.
- prune_
verdict - Does this ledger still describe something?
- unnamed_
kinds - Is this workspace entitled to shut this device down?