Documentation
¶
Overview ¶
Package daemon provides the main Vision daemon orchestration. It coordinates the config, supervisor, registry, and HTTP servers.
Index ¶
- Variables
- func DefaultPIDPath() string
- func GracefulShutdown(d *Daemon, logger *slog.Logger) error
- type Config
- type Daemon
- func (d *Daemon) Config() *config.Config
- func (d *Daemon) IsRunning() bool
- func (d *Daemon) Registry() *server.Registry
- func (d *Daemon) Reload() error
- func (d *Daemon) ServerMetricsSnapshot(serverName string) *metrics.ServerMetricsSnapshot
- func (d *Daemon) SessionLifecycleSnapshot(serverName string) *admin.SessionLifecycleSnapshot
- func (d *Daemon) Start() error
- func (d *Daemon) Status() DaemonStatus
- func (d *Daemon) Stop(timeout time.Duration) error
- func (d *Daemon) Wait()
- type DaemonStatus
- type PIDFile
- type SignalHandler
Constants ¶
This section is empty.
Variables ¶
var ( ErrDaemonRunning = errors.New("daemon already running") ErrStalePID = errors.New("stale PID file") )
Errors for PID file operations.
Functions ¶
func DefaultPIDPath ¶
func DefaultPIDPath() string
DefaultPIDPath returns the default PID file path.
Types ¶
type Config ¶
type Config struct {
ConfigPath string // Path to servers.yaml
ManagementPort int // Port for management API (default: 6275)
Logger *slog.Logger
}
Config configures the daemon.
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
Daemon is the main Vision daemon that coordinates all components.
func (*Daemon) Reload ¶
Reload reloads the configuration from disk. It starts new servers, stops removed servers, and updates changed servers.
func (*Daemon) ServerMetricsSnapshot ¶ added in v1.2.5
func (d *Daemon) ServerMetricsSnapshot(serverName string) *metrics.ServerMetricsSnapshot
ServerMetricsSnapshot returns per-server session metrics for the named server. Implements admin.ServerMetricsAccessor.
func (*Daemon) SessionLifecycleSnapshot ¶ added in v1.3.3
func (d *Daemon) SessionLifecycleSnapshot(serverName string) *admin.SessionLifecycleSnapshot
SessionLifecycleSnapshot returns the bounded secret-safe managed HTTP lifecycle projection used by both admin MCP and /v1 status surfaces.
func (*Daemon) Status ¶
func (d *Daemon) Status() DaemonStatus
Status returns the current daemon status.
type DaemonStatus ¶
type DaemonStatus struct {
Running bool `json:"running"`
ConfigPath string `json:"config_path"`
Registry server.RegistryStatus `json:"registry"`
}
DaemonStatus contains daemon state information.
type PIDFile ¶
type PIDFile struct {
// contains filtered or unexported fields
}
PIDFile manages a PID file for the daemon.
func (*PIDFile) Acquire ¶
Acquire creates the PID file if no daemon is running. Returns ErrDaemonRunning if another daemon instance is active.
func (*PIDFile) AcquireOrFail ¶
func (p *PIDFile) AcquireOrFail()
AcquireOrFail is a helper that acquires the PID file or exits with an error message.
type SignalHandler ¶
type SignalHandler struct {
// contains filtered or unexported fields
}
SignalHandler manages OS signal handling for the daemon.
func NewSignalHandler ¶
func NewSignalHandler(d *Daemon, logger *slog.Logger) *SignalHandler
NewSignalHandler creates a new signal handler for the daemon.
func (*SignalHandler) Start ¶
func (h *SignalHandler) Start(ctx context.Context)
Start begins listening for OS signals. - SIGTERM, SIGINT: Graceful shutdown - SIGHUP: Configuration reload