handler

package
Version: v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2021 License: Apache-2.0 Imports: 15 Imported by: 35

Documentation

Overview

Package handler contains root level handlers.

Index

Constants

View Source
const (
	// ReadyURL is the url to check for readiness.
	ReadyURL = "/ready"

	// ReadyHTTPMethod is the HTTP method used with this resource.
	ReadyHTTPMethod = http.MethodGet
)
View Source
const (
	// SearchURL is the url to search for metric ids
	SearchURL = "/search"

	// SearchHTTPMethod is the HTTP method used with this resource.
	SearchHTTPMethod = http.MethodPost
)
View Source
const (
	// HeaderKey is the key which headers will be added to in the request context.
	HeaderKey HeaderKeyType = iota

	// RoutePrefixV1 is the v1 prefix for all coordinator routes.
	RoutePrefixV1 = "/api/v1"

	// RoutePrefixExperimental is the experimental prefix for all coordinator routes.
	RoutePrefixExperimental = "/api/experimental"
)

Variables

This section is empty.

Functions

func CloseWatcher

func CloseWatcher(
	ctx context.Context,
	cancel context.CancelFunc,
	w http.ResponseWriter,
	instrumentOpts instrument.Options,
)

CloseWatcher watches for CloseNotify and context timeout. It is best effort and may sometimes not close the channel relying on GC.

func NewReadyHandler added in v1.0.1

func NewReadyHandler(opts options.HandlerOptions) http.Handler

NewReadyHandler returns a new instance of handler.

func NewSearchHandler

func NewSearchHandler(opts options.HandlerOptions) http.Handler

NewSearchHandler returns a new instance of handler

Types

type CancelWatcher added in v0.15.0

type CancelWatcher interface {
	// WatchForCancel watches on the given context, and applies
	// the given cancellation function.
	WatchForCancel(context.Context, context.CancelFunc)
}

CancelWatcher is an interface that wraps a WatchForCancel method. TODO: make this generic middleware, rather than applied per function.

func NewResponseWriterCanceller added in v0.15.0

func NewResponseWriterCanceller(
	w http.ResponseWriter,
	iOpts instrument.Options,
) CancelWatcher

NewResponseWriterCanceller creates a canceller on the given context with the given response writer.

type HeaderKeyType added in v0.4.5

type HeaderKeyType int

HeaderKeyType is the type for the header key.

type ReadyHandler added in v1.0.1

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

ReadyHandler tests whether the service is connected to underlying storage.

func (*ReadyHandler) ServeHTTP added in v1.0.1

func (h *ReadyHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP serves HTTP handler. This comment only here so doesn't break lint by not being "ServeHTTP" as the comment above this function which needs // nolint:gocyclo. nolint:gocyclo

type SearchHandler

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

SearchHandler represents a handler for the search endpoint

func (*SearchHandler) ServeHTTP

func (h *SearchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Directories

Path Synopsis
Package database contains API endpoints for managing the database.
Package database contains API endpoints for managing the database.
Package prom provides custom handlers that support the prometheus query endpoints.
Package prom provides custom handlers that support the prometheus query endpoints.

Jump to

Keyboard shortcuts

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