web

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 13 Imported by: ? 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 web serves a factorymeter/v1 report as a local page. It reads what a Source hands it and nothing else: it holds no token, calls no host, and answers only requests that name this machine.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoData = errors.New("nothing to report")

ErrNoData is the error a Source wraps when it holds nothing to report.

Functions

func Handler

func Handler(src Source, opt Options) http.Handler

Handler serves the page at / and the same report as JSON at /report.json.

Types

type Options

type Options struct {
	// Hosts are names, besides localhost and the loopback addresses, that a
	// request may carry in its Host header.
	Hosts []string
}

Options sets who the server answers.

type Query

type Query struct {
	// Weeks is the length of the window.
	Weeks int
	// Until ends the window. Zero means the last sync.
	Until time.Time
	// Repos narrows an owner to some of its repositories. Empty means
	// every one.
	Repos []string
}

Query is what a request asks for.

type Source

type Source interface {
	// Report builds the report a query asks for.
	Report(q Query) (*contract.Report, error)
	// Repos lists the repositories a query may name. It is empty when the
	// target is one repository, and when names must stay out of the page.
	Repos() ([]string, error)
}

Source builds the reports the server shows.

Jump to

Keyboard shortcuts

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