stream

package
v0.0.0-...-a79519d Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// CacheTTL is timeout after which tokens become invalid.
	CacheTTL = 1 * time.Minute
	// MaxInFlight is the maximum number of in-flight requests to allow.
	MaxInFlight = 1000
	// TokenLen is the length of the random base64 encoded token identifying the request.
	TokenLen = 8
)

Functions

func ErrorStreamingDisabled

func ErrorStreamingDisabled(method string) error

ErrorStreamingDisabled returns error when the streaming method is disabled.

func ErrorTooManyInFlight

func ErrorTooManyInFlight() error

ErrorTooManyInFlight returns error when the maximum number of in-flight requests is exceeded.

func WriteError

func WriteError(err error, w http.ResponseWriter) error

WriteError translates a CRI streaming error into an appropriate HTTP response.

Types

type Request

type Request interface{}

Request representing an *ExecRequest, *AttachRequest, or *PortForwardRequest Type.

type RequestCache

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

RequestCache caches streaming (exec/attach/port-forward) requests and generates a single-use random token for their retrieval. The requestCache is used for building streaming URLs without the need to encode every request parameter in the URL.

func NewRequestCache

func NewRequestCache() *RequestCache

NewRequestCache return a RequestCache

func (*RequestCache) Consume

func (c *RequestCache) Consume(token string) (req Request, found bool)

Consume the token (remove it from the cache) and return the cached request, if found.

func (*RequestCache) Insert

func (c *RequestCache) Insert(req Request) (token string, err error)

Insert the given request into the cache and returns the token used for fetching it out.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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