Documentation
¶
Overview ¶
Package modeldprobe detects whether the modeld daemon / embedded engine 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).
Detect() reports lease-based liveness, a network-free proxy: a wedged process can still hold a fresh lease. Probe() adds the real reachability ping over the runtime's gRPC transport — it confirms the lease holder actually answers and is the instance serving the endpoint, downgrading a wedged owner to unreachable. Probe imports the runtime transport client (not modeld).
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)") ErrUnreachable = errors.New("modeld holds a lease but does not answer a health probe") )
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.
func PreferredBackend ¶
PreferredBackend reads the native backend selected by onboarding; absent state returns empty.
func SetBackendPreference ¶
SetBackendPreference records the native backend used by successful onboarding.
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) LauncherArgs ¶
LauncherArgs returns the standalone daemon's startup arguments.
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 // StateUnreachable means a fresh lease names a live owner, but its advertised // endpoint does not answer a health probe: the daemon is wedged, still // bringing up its transport, or the advertised endpoint is wrong. Only Probe // (not Detect) can report this, because it requires a network round-trip. StateUnreachable )
type Status ¶
type Status struct {
State State
Binary string // resolved binary path, when located
Endpoint string // advertised IPC endpoint, when running
Instance string // owner instance UUID, when a lease is present
Backend string // inference backend the owner serves ("llama"/"openvino"/"none"), when running
}
Status is the result of a detection.