protocol

package
v0.0.0-...-89a27c5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsStreamable

func IsStreamable(p string) (bool, error)

IsStreamable says whether the given protocol can be used for streaming into hot functions.

Types

type ContainerIO

type ContainerIO interface {
	IsStreamable() bool
	Dispatch(ctx context.Context, t task.Request) error
}

ContainerIO defines the interface used to talk to a hot function. Internally, a protocol must know when to alternate between stdin and stdout. It returns any protocol error, if present.

func New

func New(p Protocol, in io.Writer, out io.Reader) (ContainerIO, error)

New creates a valid protocol handler from a I/O pipe representing containers stdin/stdout.

type DefaultProtocol

type DefaultProtocol struct {
}

DefaultProtocol is the protocol used by cold-containers

func (*DefaultProtocol) Dispatch

func (p *DefaultProtocol) Dispatch(ctx context.Context, t task.Request) error

func (*DefaultProtocol) IsStreamable

func (p *DefaultProtocol) IsStreamable() bool

type HTTPProtocol

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

HTTPProtocol converts stdin/stdout streams into HTTP/1.1 compliant communication. It relies on Content-Length to know when to stop reading from containers stdout. It also mandates valid HTTP headers back and forth, thus returning errors in case of parsing problems.

func (*HTTPProtocol) Dispatch

func (p *HTTPProtocol) Dispatch(ctx context.Context, t task.Request) error

func (*HTTPProtocol) IsStreamable

func (p *HTTPProtocol) IsStreamable() bool

type Protocol

type Protocol string

Protocol defines all protocols that operates a ContainerIO.

const (
	Default Protocol = models.FormatDefault
	HTTP    Protocol = models.FormatHTTP
	Empty   Protocol = ""
)

hot function protocols

Jump to

Keyboard shortcuts

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