api

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 3, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package api hosts VORTEX's management HTTP server. In M1.2 this is just a health endpoint that reports liveness and the active config hash, so a reload can be verified externally (e.g. curl localhost:9090/health). It is built on net/http from the standard library (Non-Negotiable Rule #10).

Index

Constants

View Source
const DefaultAddr = ":9090"

DefaultAddr is the management server's default listen address.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is the management HTTP server.

func New

func New(addr string, holder *config.Holder, version string, log *slog.Logger) *Server

New constructs a management Server. holder supplies the live config so /health always reports the currently active hash, including after a reload.

func (*Server) Addr

func (s *Server) Addr() string

Addr returns the configured listen address.

func (*Server) SetReloadFunc

func (s *Server) SetReloadFunc(fn func() error)

SetReloadFunc registers the callback invoked by POST /internal/reload. It should re-read and re-validate the config and return an error if invalid.

func (*Server) SetShutdownFunc

func (s *Server) SetShutdownFunc(fn func())

SetShutdownFunc registers the callback invoked by POST /internal/shutdown to begin a graceful shutdown.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully stops the server, respecting ctx's deadline.

func (*Server) Start

func (s *Server) Start()

Start begins serving in a background goroutine. It returns immediately; serve errors other than graceful shutdown are logged.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL