Documentation
¶
Overview ¶
Package runregistry persists discovery records for running docker-agent processes that expose a control plane (see run --listen). Records live as per-pid JSON files under <data dir>/runs so external tools can enumerate live runs and connect to them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoRun = errors.New("no live docker-agent run found; start one with: docker-agent run --listen 127.0.0.1:0")
ErrNoRun is returned when no live run can be found that satisfies the caller's request (empty registry, or no record matches the target).
Functions ¶
func Write ¶
Write atomically persists a record for the current process and returns a cleanup func that removes it. Cleanup is safe to call more than once.
The registry directory is created with 0o700 so other local users cannot enumerate live PIDs/addresses by listing it. Individual records are still written with 0o600 for the same reason. Writes go through a sibling temp file + rename so concurrent readers never see torn JSON.
Types ¶
type Record ¶
type Record struct {
PID int `json:"pid"`
Addr string `json:"addr"`
SessionID string `json:"session_id"`
Agent string `json:"agent,omitempty"`
StartedAt time.Time `json:"started_at"`
}
Record describes a running docker-agent that exposes a control plane.
func Find ¶
Find resolves a target reference to a single live record.
An empty target returns the most recently started run. A numeric target is matched by PID; a target starting with "http://" or "https://" is matched against record addresses; anything else is matched as a (possibly partial) session ID. PID and address matches are exact. Session-ID matching prefers exact equality and only falls back to substring matching when no record matches exactly; ambiguous substring matches return an error so callers don't act on the wrong session.