headgateapi

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Package headgateapi serves the control API contract control API as an http.Handler — the Go mirror of crates/headgate-api, response-shape-identical by construction: the cross-language section of scripts/test-admission.sh diffs both APIs' JSON over one store state (control API contract: "the conformance suite asserts identical responses").

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler(store headgate.InspectStore) http.Handler

func HandlerWithConfig

func HandlerWithConfig(store headgate.InspectStore, cfg Config) http.Handler

Types

type Config

type Config struct {
	// ReadOnly (authorization boundary): every mutating route returns 403 — cheap visibility for
	// support staff without a delete button. This is the ENFORCEMENT; the UI's
	// disabled buttons are cosmetics on top.
	ReadOnly bool
	// Backend is what GET /meta reports. it was the literal string
	// "postgres" in BOTH servers, so `/meta` claimed postgres while fronting Redis or
	// MySQL — and the control API contract byte diff could not see it, because the two servers were
	// wrong in exactly the same way. That is the one failure a diff structurally cannot
	// catch, which is why the register keeps literal-bytes assertions beside it.
	// Empty defaults to "postgres" so existing callers are unchanged.
	Backend string
	// EnqueueAuthorizer is called once per envelope before any HTTP enqueue path reaches
	// the store. nil is the documented backward-compatible allow-all default.
	EnqueueAuthorizer headgate.EnqueueAuthorizer
	// EnqueueCircuitBreaker is an optional process-local availability circuit shared by
	// direct and manual-periodic HTTP enqueue. Schedule administration is not gated.
	EnqueueCircuitBreaker *headgate.CircuitBreaker
	// EnqueueMiddleware is the ordered producer chain shared by direct and
	// manual-periodic HTTP enqueue.
	EnqueueMiddleware []headgate.EnqueueMiddleware
	// InsertHooks observe each actual direct or manual-periodic enqueue store attempt.
	InsertHooks []headgate.InsertHook
	// Plugins install middleware and hooks together after standalone components.
	Plugins []headgate.Plugin
}

Handler mounts the API under /api/v1, exactly like the Rust router. Config carries the API's serving posture.

Directories

Path Synopsis
cmd
hg-go-api command
Serve the control API contract control API, Go edition — the handler speaks only to the InspectStore port, so the same binary fronts either backend.
Serve the control API contract control API, Go edition — the handler speaks only to the InspectStore port, so the same binary fronts either backend.

Jump to

Keyboard shortcuts

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