server

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: Apache-2.0, MIT Imports: 20 Imported by: 0

Documentation

Overview

Package server is the proxy core: a data-plane listener that runs the negotiate → decode → one upstream call → encode pipeline, and an ops listener for /metrics, /health, /ready. The bundle is held behind an atomic.Pointer (set once at boot; reserved for future hot-swap).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

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

func New

func New(cfg *config.Config) *Server

func (*Server) Bundle

func (s *Server) Bundle() *bundle.Bundle

func (*Server) DataHandler

func (s *Server) DataHandler() http.Handler

func (*Server) Message

func (s *Server) Message(fullName string) (protoreflect.MessageDescriptor, error)

Message implements adapter.MessageResolver against the current bundle.

func (*Server) OpsHandler

func (s *Server) OpsHandler() http.Handler

OpsHandler serves the ops surface: Prometheus /metrics, liveness/readiness probes (/health, /ready), and pprof. It is intentionally bound to the ops listener (WAVEFRONT_METRICS_ADDR) only — pprof must never be reachable on the data plane, and is registered explicitly on this mux, not the global DefaultServeMux.

func (*Server) ReloadBundle added in v0.4.0

func (s *Server) ReloadBundle() error

ReloadBundle re-reads the bundle directory configured on the server and, on success, atomically swaps the live bundle. On failure, the previous bundle is preserved and the error is both logged and returned so the caller (typically a SIGHUP handler) can decide whether to react further. In-flight requests continue against the bundle they observed at the start of the request — the proxy reads the bundle pointer once per request.

func (*Server) Run

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

Run starts both listeners and shuts them down gracefully when ctx is done.

func (*Server) SetBundle

func (s *Server) SetBundle(b *bundle.Bundle)

SetBundle installs the bundle and marks the proxy ready.

func (*Server) SetLogger added in v0.4.0

func (s *Server) SetLogger(l *slog.Logger)

SetLogger overrides the structured logger used by the request path. The default is slog.Default(). Tests use this to capture per-request log lines.

Jump to

Keyboard shortcuts

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