Documentation ¶
Index ¶
- type Client
- func (c *Client) GetFunctions(ctx context.Context, namespace string) ([]types.FunctionStatus, error)
- func (c *Client) GetNamespaces(ctx context.Context) ([]string, error)
- func (c *Client) HasNamespaceSupport(ctx context.Context) (bool, error)
- func (c *Client) InvokeAsync(ctx context.Context, name string, invocation *types2.OpenFaaSInvocation) (bool, error)
- func (c *Client) InvokeSync(ctx context.Context, name string, invocation *types2.OpenFaaSInvocation) ([]byte, error)
- type Controller
- type FunctionCrawler
- type FunctionFetcher
- type FunctionMapBuilder
- type Invoker
- type NamespaceFetcher
- type TopicFunctionCache
- type TopicMap
- type TopicMapBuilder
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 ¶
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 returns a list of all functions in the given namespace or in the default namespace
func (*Client) GetNamespaces ¶
GetNamespaces returns all namespaces where Functions are deployed on
func (*Client) HasNamespaceSupport ¶
HasNamespaceSupport Checks if the version of OpenFaaS does support Namespace
func (*Client) InvokeAsync ¶
func (c *Client) InvokeAsync(ctx context.Context, name string, invocation *types2.OpenFaaSInvocation) (bool, error)
InvokeAsync calls a given function in a asynchronous way waiting for the response using the provided payload while considering the provided context
func (*Client) InvokeSync ¶
func (c *Client) InvokeSync(ctx context.Context, name string, invocation *types2.OpenFaaSInvocation) ([]byte, error)
InvokeSync calls a given function in a synchronous way waiting for the response using the provided payload while considering the provided context
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, cache TopicMap) *Controller
NewController returns a new instance
func (*Controller) Invoke ¶
func (c *Controller) Invoke(topic string, invocation *types2.OpenFaaSInvocation)
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 convenient 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, invocation *types2.OpenFaaSInvocation) ([]byte, error) InvokeAsync(ctx context.Context, name string, invocation *types2.OpenFaaSInvocation) (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 contains a map of of topics to functions
func NewTopicFunctionCache ¶
func NewTopicFunctionCache() *TopicFunctionCache
NewTopicFunctionCache return a new instance
func (*TopicFunctionCache) GetCachedValues ¶
func (m *TopicFunctionCache) GetCachedValues(name string) []string
GetCachedValues reads the cached functions for a given topic
func (*TopicFunctionCache) Refresh ¶
func (m *TopicFunctionCache) Refresh(update map[string][]string)
Refresh updates the existing cache with new values while syncing ensuring no read conflicts