Documentation
¶
Overview ¶
Package serve holds the serve process orchestration (BP2): it builds the runtime Core, starts the periodic sweepers / health probe / SIGHUP reload loops, wires the httpapi server and blocks until the server stops. The commands layer keeps only flag binding + a thin call into serve.Start, so the process编排 lives below the entry layer (D-B2/D-B3: serve depends on core/job/runner/httpapi/metrics/config, and is never imported back by them).
Index ¶
Constants ¶
const ExitErr = 2
ExitErr is the process exit code used when serve fails to start or run. gcli derives the process exit code from errorx.ErrorCoder errors, so serve returns coded errors to guarantee a non-zero exit (plan §11: refuse to start without a token).
Variables ¶
This section is empty.
Functions ¶
func Start ¶
Start runs the serve process: assemble Core, start the sweeper / probe / reload loops, wire the httpapi server and block until it stops. It keeps the *gcli.Command so the c.Printf operator logging is byte-for-byte unchanged (zero behaviour change). cfg is the already-loaded config (the caller passes the discovered path via opts.CfgPath).
Types ¶
type Opts ¶
type Opts struct {
Addr string
Token string
AllowEmptyTok bool
NoWeb bool
WebDir string
CfgPath string
// DEPRECATED(v0.94): remove in v0.97; callers should pass the resolved
// startup path in CfgPath. Kept temporarily for embedded callers.
ReloadPath string
Build buildinfo.Info
}
Opts collects the serve flags + resolved config paths the commands layer passes into Start. The config itself is loaded by the caller (so it can print the discovered path and apply overlays before assembling Core); CfgPath is the loaded config file (empty = defaults + discovery), ReloadPath is the path the SIGHUP reload loop re-loads from (config.InputCfgFile).