Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetCredentials ¶
func GetCredentials() *auth.BasicAuthCredentials
Types ¶
type Controller ¶
type Controller interface { Subscribe(subscriber ResponseSubscriber) Invoke(topic string, message *[]byte) InvokeWithContext(ctx context.Context, topic string, message *[]byte) BeginMapBuilder() Topics() []string }
Controller is used to invoke functions on a per-topic basis and to subscribe to responses returned by said functions.
func NewController ¶
func NewController(credentials *auth.BasicAuthCredentials, config *ControllerConfig) Controller
NewController create a new connector SDK controller
type ControllerConfig ¶
type ControllerConfig struct { // UpstreamTimeout controls maximum timeout invoking a function via the gateway UpstreamTimeout time.Duration // GatewayURL is the remote OpenFaaS gateway GatewayURL string // PrintResponse if true prints the function responses PrintResponse bool // PrintResponseBody if true prints the function response body to stdout PrintResponseBody bool // RebuildInterval the interval at which the topic map is rebuilt RebuildInterval time.Duration // TopicAnnotationDelimiter defines the character upon which to split the Topic annotation value TopicAnnotationDelimiter string // AsyncFunctionInvocation if true points to the asynchronous function route AsyncFunctionInvocation bool // PrintSync indicates whether the sync should be logged. PrintSync bool }
ControllerConfig configures a connector SDK controller
type FunctionLookupBuilder ¶
type FunctionLookupBuilder struct { GatewayURL string Client *http.Client Credentials *auth.BasicAuthCredentials TopicDelimiter string }
FunctionLookupBuilder builds a list of OpenFaaS functions
type Invoker ¶
type Invoker struct { PrintResponse bool Client *http.Client GatewayURL string Responses chan InvokerResponse }
func NewInvoker ¶
type InvokerResponse ¶
type ResponsePrinter ¶
type ResponsePrinter struct {
PrintResponseBody bool
}
ResponsePrinter prints function results
func (*ResponsePrinter) Response ¶
func (rp *ResponsePrinter) Response(res InvokerResponse)
Response is triggered by the controller when a message is received from the function invocation
type ResponseSubscriber ¶
type ResponseSubscriber interface { // Response is triggered by the controller when a message is // received from the function invocation Response(InvokerResponse) }
ResponseSubscriber enables connector or another client in connector to receive results from the function invocation. Note: when implementing this interface, you must not perform any costly or high-latency operations, or should off-load them to another go-routine to prevent blocking.
type TopicMap ¶
type TopicMap struct {
// contains filtered or unexported fields
}
func NewTopicMap ¶
func NewTopicMap() TopicMap