retryhttp

package module
v0.0.0-...-c1bda69 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2016 License: Apache-2.0 Imports: 12 Imported by: 0

README

retryhttp

Provides RetryRoundTripper used by Baggageclaim client and ATC garden client.

Retries on network errors, does not retry if request body was already read from (e.g. streaming request)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BasicHijackableClient

type BasicHijackableClient struct {
	Dial                  func(network, addr string) (net.Conn, error)
	DoHijackCloserFactory DoHijackCloserFactory
}

func (*BasicHijackableClient) Do

type Conn

type Conn interface {
	Read(b []byte) (n int, err error)
	Write(b []byte) (n int, err error)
	Close() error
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	SetDeadline(t time.Time) error
	SetReadDeadline(t time.Time) error
	SetWriteDeadline(t time.Time) error
}

type DoHijackCloser

type DoHijackCloser interface {
	Do(req *http.Request) (resp *http.Response, err error)
	Hijack() (c net.Conn, r *bufio.Reader)
	Close() error
}

type DoHijackCloserFactory

type DoHijackCloserFactory interface {
	NewDoHijackCloser(c net.Conn, r *bufio.Reader) DoHijackCloser
}
var DefaultDoHijackCloserFactory DoHijackCloserFactory = defaultDoHijackCloserFactory{}

type ExponentialRetryPolicy

type ExponentialRetryPolicy struct {
	Timeout time.Duration
}

func (ExponentialRetryPolicy) DelayFor

func (policy ExponentialRetryPolicy) DelayFor(attempts uint) (time.Duration, bool)

type HijackCloser

type HijackCloser interface {
	Hijack() (c net.Conn, r *bufio.Reader)
	Close() error
}

type HijackableClient

type HijackableClient interface {
	Do(req *http.Request) (*http.Response, HijackCloser, error)
}
var DefaultHijackableClient HijackableClient = &BasicHijackableClient{
	Dial: (&net.Dialer{
		Timeout:   30 * time.Second,
		KeepAlive: 30 * time.Second,
	}).Dial,
	DoHijackCloserFactory: DefaultDoHijackCloserFactory,
}

type RetryHijackableClient

type RetryHijackableClient struct {
	Logger           lager.Logger
	Sleeper          Sleeper
	RetryPolicy      RetryPolicy
	HijackableClient HijackableClient
}

func (*RetryHijackableClient) Do

type RetryPolicy

type RetryPolicy interface {
	DelayFor(uint) (time.Duration, bool)
}

type RetryReadCloser

type RetryReadCloser struct {
	io.ReadCloser
	IsRead bool
}

func (*RetryReadCloser) Read

func (rrc *RetryReadCloser) Read(p []byte) (n int, err error)

type RetryRoundTripper

type RetryRoundTripper struct {
	Logger       lager.Logger
	Sleeper      Sleeper
	RetryPolicy  RetryPolicy
	RoundTripper RoundTripper
}

func (*RetryRoundTripper) RoundTrip

func (d *RetryRoundTripper) RoundTrip(request *http.Request) (*http.Response, error)

type RoundTripper

type RoundTripper interface {
	RoundTrip(request *http.Request) (*http.Response, error)
}

type Sleeper

type Sleeper interface {
	Sleep(time.Duration)
}

Directories

Path Synopsis
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter
This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter This file was generated by counterfeiter

Jump to

Keyboard shortcuts

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