openfaas

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2020 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is used for interacting with Open FaaS

func NewClient

func NewClient(client *http.Client, creds *auth.BasicAuthCredentials, gatewayURL string) *Client

NewClient creates a new instance of an OpenFaaS Client using the provided informations

func (*Client) GetFunctions

func (c *Client) GetFunctions(ctx context.Context, namespace string) ([]types.FunctionStatus, error)

GetFunctions TODO:

func (*Client) GetNamespaces

func (c *Client) GetNamespaces(ctx context.Context) ([]string, error)

GetNamespaces TODO:

func (*Client) HasNamespaceSupport

func (c *Client) HasNamespaceSupport(ctx context.Context) (bool, error)

HasNamespaceSupport TODO:

func (*Client) InvokeAsync

func (c *Client) InvokeAsync(ctx context.Context, name string, payload []byte) (bool, error)

InvokeAsync TODO:

func (*Client) InvokeSync

func (c *Client) InvokeSync(ctx context.Context, name string, payload []byte) ([]byte, error)

InvokeSync TODO:

type Controller

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

Controller is responsible for building up and maintaining a Cache with all of the deployed OpenFaaS Functions across all namespaces

func NewController

func NewController(conf *config.Controller, client FunctionCrawler) *Controller

NewController returns a new instance

func (*Controller) Invoke

func (c *Controller) Invoke(topic string, message []byte)

Invoke triggers a call to all functions registered to the specified topic

func (*Controller) Start

func (c *Controller) Start(ctx context.Context)

Start setups the cache and starts continous caching

type FunctionCrawler

type FunctionCrawler interface {
	NamespaceFetcher
	FunctionFetcher
	Invoker
}

FunctionCrawler defines interfaces required to crawl OpenFaaS for functions

type FunctionFetcher

type FunctionFetcher interface {
	GetFunctions(ctx context.Context, namespace string) ([]types.FunctionStatus, error)
}

FunctionFetcher defines interface to explore deployed function of an OpenFaaS installation.

type FunctionMapBuilder

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

FunctionMapBuilder convienient construct to build a map of function <=> topic

func NewFunctionMapBuilder

func NewFunctionMapBuilder() *FunctionMapBuilder

NewFunctionMapBuilder returns a new instance with an empty build target

func (*FunctionMapBuilder) Append

func (b *FunctionMapBuilder) Append(topic string, function string)

Append the provided function to the specified topic

func (*FunctionMapBuilder) Build

func (b *FunctionMapBuilder) Build() map[string][]string

Build returns a map containing values based on privous Append calls

type Invoker

type Invoker interface {
	InvokeSync(ctx context.Context, name string, payload []byte) ([]byte, error)
	InvokeAsync(ctx context.Context, name string, payload []byte) (bool, error)
}

Invoker defines interfaces that invoke deployed OpenFaaS Functions.

type NamespaceFetcher

type NamespaceFetcher interface {
	HasNamespaceSupport(ctx context.Context) (bool, error)
	GetNamespaces(ctx context.Context) ([]string, error)
}

NamespaceFetcher defines interfaces to explore namespaces of an OpenFaaS installation.

type TopicFunctionCache

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

TopicFunctionCache TODO:

func NewTopicFunctionCache

func NewTopicFunctionCache() *TopicFunctionCache

NewTopicFunctionCache return a new instance

func (*TopicFunctionCache) GetCachedValues

func (m *TopicFunctionCache) GetCachedValues(name string) []string

GetCachedValues TODO:

func (*TopicFunctionCache) Refresh

func (m *TopicFunctionCache) Refresh(update map[string][]string)

Refresh TODO:

type TopicMap

type TopicMap interface {
	GetCachedValues(name string) []string
	Refresh(update map[string][]string)
}

TopicMap defines a interface for a topic map

type TopicMapBuilder

type TopicMapBuilder interface {
	Append(topic string, function string)
	Build() map[string][]string
}

TopicMapBuilder defines an interface that allows to build a TopicMap

Jump to

Keyboard shortcuts

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