sidecar

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2020 License: Apache-2.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const APIVersion = "2018-06-01"

APIVersion for current sidecard

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine interface {
	// Name of current engine
	Name() string

	// Init engine, that function is loaded
	Init(ctx context.Context, fn *types.Function) error
	// RegisterServices exports engine's extended services, will mount at <prefix>/<Engine.Name()>
	RegisterServices(router *mux.Router)
	// ReportInitError runtime encourted a unrecoverable error notify operator to shutdown
	ReportInitError(err error)
	// ReportReady notify operator that we're ready
	ReportReady()
	// ReportExiting notify operator that we're exiting
	ReportExiting()

	// NextC returns a signal channel block and wait for next request
	NextC() <-chan struct{}
	// InvokeRequest consume a request
	InvokeRequest() *messages.InvokeRequest
	// SetResult teminates a reqeust corresponding to its reqeust id (rid)
	SetResult(rid string, body []byte, err error, conentType string) error
}

Engine is car engine implemented by different transport to commnicate with its operator

type Loader

type Loader interface {
	C() <-chan struct{}
	Function() *types.Function
}

Loader discovers and loads function runtime config

type Sidecar

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

Sidecar creates a proxy that implements aws lambda runtimes-api https://docs.aws.amazon.com/lambda/latest/dg/runtimes-api.html

func NewCar

func NewCar(engine Engine, loader Loader) *Sidecar

NewCar returns new sidecar from given engine and loader

func (*Sidecar) Serve

func (sc *Sidecar) Serve(ctx context.Context, address string)

Serve init sidecar waiting for function is ready and listens and serves at given address

func (*Sidecar) ServeListener

func (sc *Sidecar) ServeListener(ctx context.Context, listener net.Listener)

ServeListener init sidecar waiting for function is ready and listens and serves at given listener

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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