Documentation
¶
Overview ¶
Package procreg is the saved worker registry (ADR-0167): the process driver and the dev catalog engine record every process they start, so the next open reaps what a crashed run left behind. An entry is reaped only when the live pid's start time and argv both match it, so a reused pid is never signalled.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Entry ¶
type Entry struct {
ID string `json:"id"`
PID int `json:"pid"`
PGID int `json:"pgid"`
StartTime uint64 `json:"startTime"` // OS-native: clock ticks since boot (Linux), µs since epoch (macOS)
Token string `json:"token"` // substring of one argv element: "--funcd-instance=<id>" or "funcd-engine-<id>"
Files []string `json:"files"` // driver-owned temp files deleted at reap
}
Entry is one process a registry owner started.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is the saved set of entries in <dir>/<name>.json, owned by one process through the lock on <dir>/<name>.lock. It has no mutex of its own: the caller serializes Put, Delete and Close.
func Open ¶
Open takes the registry at <dir>/<name>.json, creating dir, and loads its entries. It fails with fault.Conflict while another owner holds the lock.
func (*Registry) Close ¶
Close empties the registry and releases the lock; a second Close does nothing.
func (*Registry) Reap ¶
Reap ends every saved process that is still ours: SIGTERM to each owned process group, up to grace for all of them together, then SIGKILL to the ones still alive. A group whose leader exits gets SIGKILL at once, as a worker's exit does (ADR-0011 C4): its other members outlive the leader, and its pgid is not reused while one lives. It deletes every entry's files, owned or not, and empties the registry. killed counts the process groups it signalled.