transport

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

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

Go to latest
Published: Feb 25, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) *rolling.Aggregate

FromContext extracts an aggregate from the context after a request has been rejected.

func New

func New(l loadshed.Doer, options ...Option) func(c http.RoundTripper) http.RoundTripper

New takes in a loadshed Doer and transport options and returns a RoundTripper wrapper

func NewContext

func NewContext(ctx context.Context, val *rolling.Aggregate) context.Context

NewContext inserts an aggregate into the context after a request has been rejected.

func NewErrCodes

func NewErrCodes(errorCodes []int) func(http.RoundTripper) http.RoundTripper

NewErrCodes returns a transport wrapper around the error codes transport

Types

type Option

type Option func(*Transport) *Transport

Option is a wrapper around the transport modifying its behavior

func Callback

func Callback(cb func(*http.Request) (*http.Response, error)) Option

Callback option adds a callback for error

func ErrorCodes

func ErrorCodes(errorCodes []int) Option

ErrorCodes option wraps the errorcodes transport

type Transport

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

Transport is an HTTP client wrapper that provides circuit breaker functionality for the outgoing request.

func (*Transport) RoundTrip

func (c *Transport) RoundTrip(r *http.Request) (*http.Response, error)

RoundTrip circuit breaks the outgoing request if needed and calls the wrapped Client.

Jump to

Keyboard shortcuts

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