service

package
v0.0.0-...-adc8916 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2024 License: AGPL-3.0, Apache-2.0, CC-BY-SA-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package service provides a cmd.Handler that brings up a system service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Command

func Command(svcName arvados.ServiceName, newHandler NewHandlerFunc) cmd.Handler

Command returns a cmd.Handler that loads site config, calls newHandler with the current cluster and node configs, and brings up an http server with the returned handler.

The handler is wrapped with server middleware (adding X-Request-ID headers, logging requests/responses, etc).

func URLFromContext

func URLFromContext(ctx context.Context) (arvados.URL, bool)

Types

type Handler

type Handler interface {
	http.Handler
	CheckHealth() error
	// Done returns a channel that closes when the handler shuts
	// itself down, or nil if this never happens.
	Done() <-chan struct{}
}

func ErrorHandler

func ErrorHandler(ctx context.Context, _ *arvados.Cluster, err error) Handler

ErrorHandler returns a Handler that reports itself as unhealthy and responds 500 to all requests. ErrorHandler itself logs the given error once, and the handler logs it again for each incoming request.

type LogPrefixer

type LogPrefixer struct {
	io.Writer
	Prefix []byte
	// contains filtered or unexported fields
}

func (*LogPrefixer) Write

func (lp *LogPrefixer) Write(p []byte) (int, error)

type NewHandlerFunc

type NewHandlerFunc func(_ context.Context, _ *arvados.Cluster, token string, registry *prometheus.Registry) Handler

Jump to

Keyboard shortcuts

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