webapi

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package webapi exposes the read-only HTTP contract consumed by the web viewer.

Index

Constants

View Source
const APIVersion = "v1"

Variables

This section is empty.

Functions

func NewHandler

func NewHandler(store *hotsnapshot.SnapshotStore) http.Handler

NewHandler creates an HTTP handler backed by store. A nil store is valid and makes graph-dependent endpoints return INDEX_NOT_READY.

func Run

func Run(ctx context.Context, address string, handler http.Handler, options ...Option) error

Run serves the read-only viewer on address until ctx is canceled. Cancellation performs a bounded graceful shutdown and returns nil.

Types

type Handler

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

Handler serves read-only viewer requests from one published snapshot store. It never accesses LadybugDB directly and never mutates the store.

func (*Handler) ServeHTTP

func (handler *Handler) ServeHTTP(writer http.ResponseWriter, request *http.Request)

type Option

type Option func(*settings)

Option configures Run.

func OnListen

func OnListen(report func(net.Addr)) Option

OnListen reports the address the viewer bound, before it serves anything.

Run owns the listener, so the caller cannot resolve the address itself -- and with a port of zero nobody can know it at all. A viewer whose log never says where it is listening is a viewer you cannot open.

Jump to

Keyboard shortcuts

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