transport

package
Version: v0.0.0-...-7fe2f0a Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2019 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingTransport

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

CachingTransport is a redis-based caching wrapper around the custom rate-limited ESITransport

func NewCachingTransport

func NewCachingTransport(esiTransport *ESITransport, redisClient *redis.Client) *CachingTransport

NewCachingTransport generates a new custom transport

func (*CachingTransport) RoundTrip

func (transport *CachingTransport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip tries to fetch the request from cache, otherwise it is fetched via ESITransport

type ESITransport

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

ESITransport is a custom transport for rate-limiting requests to ESI

func NewESITransport

func NewESITransport(userAgent string, timeout time.Duration, concurrencyLimit int64) *ESITransport

NewESITransport generates a new custom transport

func (*ESITransport) RoundTrip

func (transport *ESITransport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip uses a default transport which blocks when the client is being blocked by ESI or we're close to the limit. Waiting requests will pile-up! Having backpressure in place should be considered.

type Transport

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

Transport is a custom transport for Element43 which simply sets the user agent

func NewTransport

func NewTransport(userAgent string) *Transport

NewTransport generates a new custom transport

func (*Transport) RoundTrip

func (transport *Transport) RoundTrip(request *http.Request) (*http.Response, error)

RoundTrip automatically sets the user agent

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL