status

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2019 License: MPL-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package status implements the status command.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cache

func Cache() (cache *configdir.Config)

Cache returns the file system path to the cache file storing the ping URLs

Types

type API

type API struct {
	BaseURL string     `json:"baseUrl"`
	Entries []APIEntry `json:"entries"`
}

API defines the subset of fields returned from a taskcluster api definition, that are required to determine the service's name and ping endpoint.

See https://docs.taskcluster.net/manual/integrations/tools/references#api-references for more information.

type APIEntry

type APIEntry struct {
	Name  string `json:"name"`
	Route string `json:"route"`
}

APIEntry defines the subset of fields in a specific taskcluster api endpoint (such as ping) for establishing the endpoint name (function) and url path

See https://docs.taskcluster.net/manual/integrations/tools/references#api-references for more information.

type CachedURLs

type CachedURLs struct {
	LastUpdated time.Time `json:"lastUpdated"`
	PingURLs    PingURLs  `json:"pingURLs"`
}

CachedURLs defines the json data format of the cache.json file used for caching the ping urls (see above)

func ReadCachedURLsFile

func ReadCachedURLsFile(cache *configdir.Config, cachePath string) (cachedURLs *CachedURLs, err error)

ReadCachedURLsFile returns a *CachedURLs based on the contents of the file with the given path.

func (*CachedURLs) Expired

func (cachedURLs *CachedURLs) Expired(d time.Duration) bool

Expired checks if the time since the ping urls were cached is more than the specified duration

type PingResponse

type PingResponse struct {
	Alive  bool    `json:"alive"`
	Uptime float64 `json:"uptime"`
}

PingResponse defines the data format of the http response from the ping url endpoints

type PingURLs

type PingURLs map[string]string

PingURLs maps a service name (e.g. "queue") to the http ping endpoint of that service

func NewPingURLs

func NewPingURLs() (pingURLs PingURLs, err error)

NewPingURLs returns the ping URLs to use. The caller does not need to be concerned about whether these URLs are retrieved from a local cache, or from querying web services.

func RefreshCache

func RefreshCache(manifestURL string, cache *configdir.Config, cachePath string) (pingURLs PingURLs, err error)

RefreshCache will scrape the manifest url for a dictionary of taskcluster services, and cache the results in file at path.

func ScrapePingURLs

func ScrapePingURLs(manifestURL string) (pingURLs PingURLs, err error)

ScrapePingURLs queries manifestURL to return a manifest of services, which are then queried to fetch ping URLs for taskcluster services

func (PingURLs) Cache

func (p PingURLs) Cache(cache *configdir.Config, cachePath string) (cachedURLs *CachedURLs, err error)

Cache writes the pingURLs p to a file at path (replacing if it exists already, and creating parent folders, if required), using the current time for the retrieval timestamp.

Jump to

Keyboard shortcuts

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