handlers

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2023 License: MPL-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

View Source
const (
	OKMessage       = "OK"
	StartingMessage = "Starting Process"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

func NewConfig

func NewConfig(logger *logging.Logger, ej *errors.Injector, hh *Health) *Config

NewHealth creates a new health handler

func (*Config) Handle

func (c *Config) Handle(rw http.ResponseWriter, r *http.Request)

Handle the request

type FakeServer

type FakeServer struct {
	api.UnimplementedFakeServiceServer
	// contains filtered or unexported fields
}

FakeServer implements the gRPC interface

func NewFakeServer

func NewFakeServer(
	name, message string,
	duration *timing.RequestDuration,
	upstreamURIs []string,
	workerCount int,
	defaultClient client.HTTP,
	grpcClients map[string]client.GRPC,
	i *errors.Injector,
	loadGenerator *load.Generator,
	l *logging.Logger,
	requestGenerator load.RequestGenerator,
	waitTillReady bool,
	readinessHandler *Ready,
) *FakeServer

NewFakeServer creates a new instance of FakeServer

func (*FakeServer) Handle

func (f *FakeServer) Handle(ctx context.Context, in *api.Request) (*api.Response, error)

Handle implements the FakeServer Handle interface method

type Health

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

Health defines the health handler for the service

func NewHealth

func NewHealth(logger *logging.Logger, code int) *Health

NewHealth creates a new health handler

func (*Health) Handle

func (h *Health) Handle(rw http.ResponseWriter, r *http.Request)

Handle the request

func (*Health) SetStatusCode

func (h *Health) SetStatusCode(code int)

type Ready

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

Health defines the health handler for the service

func NewReady

func NewReady(logger *logging.Logger, successCode, failureCode int, delay time.Duration) *Ready

NewReady creates a new ready handler

func (*Ready) Complete

func (h *Ready) Complete() bool

Complete returns true when the readiness hander delay elapses

func (*Ready) Handle

func (h *Ready) Handle(rw http.ResponseWriter, r *http.Request)

Handle the request

type Request

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

Request handles inbound requests and makes any necessary upstream calls

func NewRequest

func NewRequest(
	name, message string,
	duration *timing.RequestDuration,
	upstreamURIs []string,
	workerCount int,
	defaultClient client.HTTP,
	grpcClients map[string]client.GRPC,
	errorInjector *errors.Injector,
	loadGenerator *load.Generator,
	log *logging.Logger,
	requestGenerator load.RequestGenerator,
	waitTillReady bool,
	readinessHandler *Ready,
) *Request

NewRequest creates a new request handler

func (*Request) ServeHTTP

func (rq *Request) ServeHTTP(rw http.ResponseWriter, r *http.Request)

Handle the request and call the upstream servers

Jump to

Keyboard shortcuts

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