Documentation
¶
Overview ¶
Package server wires the HTTP router for Oriel: a small JSON REST surface for actions, SSE channels for live data, and the embedded frontend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HistoryPoint ¶
type HistoryPoint struct {
T int64 `json:"t"` // unix milliseconds
CPU float64 `json:"cpu"`
Mem int64 `json:"mem"`
Down bool `json:"down,omitempty"`
}
HistoryPoint is one aggregate sample of total CPU% and memory at a moment. Down marks a tick where colima/docker was unreachable while the recorder was running, distinct from Oriel itself being offline, which records nothing at all and so leaves a time gap between points. (omitempty keeps the common "up" case compact and lets older persisted files load as up.)
type Job ¶
A Job is a long-running operation (prune, …) that runs on a background context decoupled from any request, so it survives client refresh/disconnect. Progress is buffered for replay and broadcast live to attached SSE subscribers, and the job can be cancelled. Progress comes in two forms: log lines (a few step messages) and a numeric counter (cur/total) that drives a progress bar.
type Outage ¶
type Outage struct {
Kind string `json:"kind"`
Start int64 `json:"start"` // unix ms
End int64 `json:"end"` // unix ms
}
Outage is one recorded downtime, retained far longer than the 30-min pulse buffer. Kind is "down" (colima unreachable while we watched) or "offline" (Oriel itself was not running, inferred from a gap on restart).
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter is what a job's work function uses to report progress. Line adds a log message; Progress sets the cur/total counter (drives the bar).
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server holds shared dependencies and implements http.Handler.
func New ¶
New constructs the router. web is the embedded frontend filesystem; version is the build version ("dev" for local builds, the release tag otherwise).
func (*Server) Close ¶
func (s *Server) Close()
Close stops the recorder and persists the history + outage logs. Call on shutdown.
func (*Server) LogStartup ¶ added in v0.2.0
LogStartup writes a one-line-per-fact config summary to the log on boot, plus a warning when the config looks like it will 403 behind a reverse proxy. Headless operators see this in journalctl and don't have to guess what's configured.