apisrv

package
v0.0.0-...-9ca37e5 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExampleHTTPEndpoint

func NewExampleHTTPEndpoint(apiServer ApiServer) http.Handler

NewExampleHTTPEndpoint creates a new HTTP handler

Types

type ApiServer

type ApiServer interface {
	// Launch initializes and launches the server
	Launch() error

	// AwaitShutdown blocks until the server is shut down
	AwaitShutdown() error

	// Address returns the address the server is listening on
	Address() net.Addr

	// MetricsAddress returns the address the metrics server is listening on
	MetricsAddress() net.Addr

	// Shutdown appoints a server shutdown and blocks until the server
	// is gracefully stopped
	Shutdown() error
}

ApiServer defines the API server interface

func NewApiServer

func NewApiServer(conf config.Config) (ApiServer, error)

NewApiServer initializes a new API server instance

type ExampleHTTPEndpoint

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

ExampleHTTPEndpoint represents an HTTP handler example used alongside the webwire endpoint

func (*ExampleHTTPEndpoint) ServeHTTP

func (hand *ExampleHTTPEndpoint) ServeHTTP(
	resp http.ResponseWriter,
	req *http.Request,
)

ServeHTTP implements the http.Handler interface

type MetricsHandler

type MetricsHandler struct{}

MetricsHandler represents the handler used for handling metric requests

func NewMetricsHandler

func NewMetricsHandler() *MetricsHandler

NewMetricsHandler creates a new metrics handler instance

func (*MetricsHandler) ServeHTTP

func (handler *MetricsHandler) ServeHTTP(
	w http.ResponseWriter,
	r *http.Request,
)

ServeHTTP handles incoming metrics export requests

Directories

Path Synopsis
modules

Jump to

Keyboard shortcuts

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