corwhisk

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const MaxPullRetries = 4
View Source
const MaxRetries = 3

MaxLambdaRetries is the number of times to try invoking a function before giving up and returning an error

Variables

This section is empty.

Functions

func GetQualifiedName

func GetQualifiedName(functioname string) (string, string)

returns name and namespace based on function name

Types

type BatchRequest

type BatchRequest struct {
	Payloads []WhiskPayload `json:"payloads"`
}

type ConcurrentRateLimiter

type ConcurrentRateLimiter struct {
	TokenPerMinute  int64
	ConcurrentToken int
	// contains filtered or unexported fields
}

func NewConcurrentRateLimiter

func NewConcurrentRateLimiter(tokenPerMinute int64, concurrentToken int) (*ConcurrentRateLimiter, error)

func (*ConcurrentRateLimiter) Allow

func (c *ConcurrentRateLimiter) Allow()

func (*ConcurrentRateLimiter) Wait

type Limiter

type Limiter interface {
	//Wait acquires a single token from the limiter, blocks until token is availibe or context is canceled.
	Wait(ctx context.Context) error

	//Allow releases a single token to the limiter
	Allow()
}

type OWInfoResponse

type OWInfoResponse struct {
	Features struct {
		BatchRequestFeature bool `json:"batch"`
		CallbackFeature     bool `json:"feedback"`
		LCHFeature          bool `json:"lch"`
	} `json:"features,omitempty"`
	Limits struct {
		ActionsPerMinute  int64 `json:"actions_per_minute"`
		ConcurrentActions int   `json:"concurrent_actions"`
		MaxActionDuration int64 `json:"max_action_duration"`
		MaxActionMemory   int64 `json:"max_action_memory"`
		MinActionDuration int64 `json:"min_action_duration"`
		MinActionMemory   int64 `json:"min_action_memory"`
	} `json:"limits,omitempty"`
}

type WhiskCacheConfigInjector

type WhiskCacheConfigInjector interface {
	api.CacheConfigInjector
	ConfigureWhisk(action *whisk.Action) error
}

type WhiskClient

type WhiskClient struct {
	Client *whisk.Client

	ConcurrencyLimit *int
	// contains filtered or unexported fields
}

func (*WhiskClient) Close

func (l *WhiskClient) Close() error

func (*WhiskClient) DeleteFunction

func (l *WhiskClient) DeleteFunction(name string) error

func (*WhiskClient) DeployFunction

func (l *WhiskClient) DeployFunction(conf WhiskFunctionConfig) error

func (*WhiskClient) Invoke

func (l *WhiskClient) Invoke(name string, payload interface{}) (io.ReadCloser, error)

func (*WhiskClient) InvokeAsBatch

func (l *WhiskClient) InvokeAsBatch(name string, payloads []interface{}) ([]interface{}, error)

func (*WhiskClient) InvokeAsync

func (l *WhiskClient) InvokeAsync(name string, payload interface{}) (interface{}, error)

func (*WhiskClient) ReceiveUntil

func (l *WhiskClient) ReceiveUntil(when func() bool) chan io.ReadCloser

ReciveUnitl will copy all io.ReadCloser received until the when function is true or until the client context is closed. In these cases the channal will be closed to singal the end to the consumer.

type WhiskClientApi

type WhiskClientApi interface {
	Invoke(name string, payload interface{}) (io.ReadCloser, error)

	InvokeAsBatch(name string, payload []interface{}) ([]interface{}, error)
	InvokeAsync(name string, payload interface{}) (interface{}, error)
	ReceiveUntil(when func() bool) chan io.ReadCloser

	DeployFunction(conf WhiskFunctionConfig) error
	DeleteFunction(name string) error
}

func NewWhiskClient

func NewWhiskClient(conf WhiskClientConfig) WhiskClientApi

NewWhiskClient initializes a new openwhisk client

type WhiskClientConfig

type WhiskClientConfig struct {
	RequestPerMinute int64
	ConcurrencyLimit int

	Host      string
	Token     string
	Namespace string

	Context           context.Context
	RemoteLoggingHost string

	BatchRequestFeature    bool
	MultiDeploymentFeature bool
	DataPreloadingFeature  bool

	WriteMetrics bool

	Address *string
}

type WhiskFunctionConfig

type WhiskFunctionConfig struct {
	Memory              int
	Timeout             int
	FunctionName        string
	CacheConfigInjector api.CacheConfigInjector
}

type WhiskPayload

type WhiskPayload struct {
	Value interface{}        `json:"value"`
	Env   map[string]*string `json:"env"`
}

Jump to

Keyboard shortcuts

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