Documentation
¶
Overview ¶
Package runtime supervises project-local service processes.
Index ¶
- func InheritedEnvironment() []string
- func TailnetHostVariable() string
- type Manager
- func (manager Manager) LogPath(name string) (string, error)
- func (manager Manager) Recover(ctx context.Context, candidates []RecoveryCandidate) error
- func (manager Manager) RecoveryCandidates(names []string) ([]RecoveryCandidate, error)
- func (manager Manager) Restart(ctx context.Context, names []string) error
- func (manager Manager) Services(names []string) ([]config.Service, error)
- func (manager Manager) Start(ctx context.Context, names []string) error
- func (manager Manager) Status(ctx context.Context) ([]Status, error)
- func (manager Manager) Stop(ctx context.Context, names []string) error
- type ProgressEvent
- type ProgressObserver
- type ProgressObserverFunc
- type ProgressStage
- type RecoveryCandidate
- type State
- type Status
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InheritedEnvironment ¶
func InheritedEnvironment() []string
InheritedEnvironment returns the baseline, so that documentation describing it is built from the same list the runtime uses rather than from a second copy.
func TailnetHostVariable ¶
func TailnetHostVariable() string
TailnetHostVariable is the name grat sets a machine's tailnet host under, so documentation naming it is built from the same constant the runtime uses.
Types ¶
type Manager ¶
type Manager struct {
Root string
Config config.Config
ListenerLookup ports.ListenerLookup
HTTPClient *http.Client
Observer ProgressObserver
// TailnetHost is this machine's name inside the tailnet, or empty where the
// machine belongs to none. A development server that checks the Host header
// needs it to accept a request arriving through a funnel, and only the
// caller can find it out, so the runtime is told rather than asking.
TailnetHost string
}
Manager owns state and lifecycle operations for exactly one project root.
func (Manager) Recover ¶
func (manager Manager) Recover(ctx context.Context, candidates []RecoveryCandidate) error
Recover explicitly adopts only the confirmed V1 candidate snapshot long enough to stop its isolated process groups. It leaves regular lifecycle methods fail-closed.
func (Manager) RecoveryCandidates ¶
func (manager Manager) RecoveryCandidates(names []string) ([]RecoveryCandidate, error)
RecoveryCandidates reports recorded V1 service states that are eligible for explicit recovery. It never changes a state file or signals a process.
func (Manager) Restart ¶
Restart stops selected services before starting them with new detached sessions.
func (Manager) Services ¶
Services returns the configured services selected by names. An empty name list selects every configured service in declaration order.
func (Manager) Start ¶
Start launches selected services and waits until each reaches its configured readiness boundary. An empty names list selects all configured services.
type ProgressEvent ¶
type ProgressEvent struct {
Service config.Service
Stage ProgressStage
Detail string
}
ProgressEvent describes one lifecycle transition for a service.
type ProgressObserver ¶
type ProgressObserver interface {
ObserveProgress(ProgressEvent)
}
ProgressObserver receives ordered lifecycle events from a Manager.
type ProgressObserverFunc ¶
type ProgressObserverFunc func(ProgressEvent)
ProgressObserverFunc adapts a function to ProgressObserver.
func (ProgressObserverFunc) ObserveProgress ¶
func (function ProgressObserverFunc) ObserveProgress(event ProgressEvent)
ObserveProgress delivers event to the wrapped function.
type ProgressStage ¶
type ProgressStage string
ProgressStage identifies an actual lifecycle transition observed by a Manager. Events are emitted once per stage, not on a timer.
const ( // ProgressInspecting indicates that the manager is reading recorded state. ProgressInspecting ProgressStage = "inspecting" // ProgressAlreadyReady indicates a selected service was already healthy. ProgressAlreadyReady ProgressStage = "already-ready" // ProgressAlreadyStopped indicates a selected service had no recorded process. ProgressAlreadyStopped ProgressStage = "already-stopped" // ProgressStopping indicates graceful process termination has begun. ProgressStopping ProgressStage = "stopping" // ProgressStopped indicates state removal completed after termination. ProgressStopped ProgressStage = "stopped" // ProgressLaunching indicates the isolated command process is being started. ProgressLaunching ProgressStage = "launching" // ProgressWaitingForHealth indicates listener ownership and HTTP readiness // are being checked. ProgressWaitingForHealth ProgressStage = "waiting-for-health" // ProgressReady indicates the full configured readiness boundary passed. ProgressReady ProgressStage = "ready" // ProgressFailed indicates a lifecycle operation could not complete. ProgressFailed ProgressStage = "failed" )
type RecoveryCandidate ¶
type RecoveryCandidate struct {
Service config.Service
PID int
ProcessGroup int
Command string
Live bool
// contains filtered or unexported fields
}
RecoveryCandidate is a legacy process state that can be reviewed before explicit recovery. Live candidates have passed the V1 identity validation.
type State ¶
type State string
State describes the observed lifecycle state of one configured service.
const ( // StateStopped means no live managed process exists. StateStopped State = "stopped" // StateRunning means the process, listener, and health boundary are ready. StateRunning State = "running" // StateUnhealthy means a recorded process is live but fails readiness checks. StateUnhealthy State = "unhealthy" )