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 ¶
var ErrNoData = errors.New("nothing to report")
ErrNoData is the error a Source wraps when it holds nothing to report.
Functions ¶
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.