Documentation
¶
Overview ¶
Package modeldprobe detects whether the modeld daemon (the separate CGO inference binary) is installed, running, or dead, so the runtime can fail honestly and the setup wizard can guide the user.
It is pure Go and self-contained: it locates the binary and inspects the owner lease via liblease. It deliberately does not import modeld — the only shared facts are the lease file name and the endpoint metadata key, mirrored here as constants (see cmd/modeld and modeld/owner.EndpointMetaKey).
Liveness via lease freshness is a proxy, not a health check: a wedged process can still hold a fresh lease. A real reachability ping rides on the IPC transport and is added when that exists. See docs/blueprints/modeld-provisioning-detection.md.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotInstalled = errors.New("modeld is not installed") ErrNotRunning = errors.New("modeld is not running") ErrStale = errors.New("modeld owner is stale (the daemon may have crashed)") )
Typed, actionable errors. Status.Err returns one of these (or nil) so callers can branch with errors.Is.
Functions ¶
func DefaultDataRoot ¶
func DefaultDataRoot() string
DefaultDataRoot resolves the contenox data root: $CONTENOX_DATA_ROOT, else ~/.contenox.
Types ¶
type Detector ¶
type Detector struct {
// contains filtered or unexported fields
}
Detector resolves the modeld state. Construct it with New; the now and lookPath fields are injectable for tests.
func New ¶
New returns a Detector for the given data root (where the owner lease lives). An empty dataRoot falls back to DefaultDataRoot.
func (*Detector) Detect ¶
Detect resolves the current modeld state. A live lease takes precedence (the daemon is running regardless of whether we can locate the binary locally, e.g. when an extension started it from its own directory); binary presence then distinguishes stale/not-running from not-installed.
type State ¶
type State int
State is the detected condition of the modeld daemon.
const ( // StateNotInstalled means no modeld binary could be located. StateNotInstalled State = iota // StateNotRunning means the binary exists but no owner lease is present. StateNotRunning // StateStale means an owner lease exists but has expired: the daemon // likely crashed or was killed. StateStale // StateRunning means a live owner holds a fresh lease. StateRunning )