openfaas

package
v0.0.0-...-9d63ed5 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BLANK_MODIFIER = func(data []byte) ([]byte, error) { return data, nil }
)
View Source
var (
	// Execution specify a edge doesn't forwards a data
	// but rather mention a execution direction
	Execution = InvokeEdge()
)

Functions

This section is empty.

Types

type BranchOption

type BranchOption func(*BranchOptions)

func Aggregator

func Aggregator(aggregator sdk.Aggregator) BranchOption

Aggregator aggregates all outputs into one

func Forwarder

func Forwarder(forwarder sdk.Forwarder) BranchOption

Forwarder encodes request based on need for children vertex by default the data gets forwarded as it is

func InvokeEdge

func InvokeEdge() BranchOption

InvokeEdge denotes a edge doesn't forwards a data, but rather provides only an execution flow

type BranchOptions

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

BranchOptions options for branching in DAG

type Context

type Context sdk.Context

type Dag

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

func NewDag

func NewDag() *Dag

NewDag creates a new dag separately from pipeline

func (*Dag) Append

func (this *Dag) Append(dag *Dag)

Append generalizes a seperate dag by appending its properties into current dag. Provided dag should be mutually exclusive

func (*Dag) ConditionalBranch

func (this *Dag) ConditionalBranch(vertex string, conditions []string, condition sdk.Condition,
	options ...BranchOption) (conditiondags map[string]*Dag)

ConditionalBranch composites multiple dags as a sub-dag which executes for a conditions matched and returns the set of dags based on the condition passed

func (*Dag) Edge

func (this *Dag) Edge(from, to string, opts ...BranchOption)

Edge adds a directed edge between two vertex as <from>-><to>

func (*Dag) ForEachBranch

func (this *Dag) ForEachBranch(vertex string, foreach sdk.ForEach, options ...BranchOption) (dag *Dag)

ForEachBranch composites a sub-dag which executes for each value It returns the sub-dag that will be executed for each value

func (*Dag) Node

func (this *Dag) Node(vertex string, options ...BranchOption) *Node

Node adds a new vertex by id

func (*Dag) SubDag

func (this *Dag) SubDag(vertex string, dag *Dag)

SubDag composites a seperate dag as a node.

type DataStore

type DataStore sdk.DataStore

type FaasOperation

type FaasOperation struct {
	// FaasOperations
	Function       string   // The name of the function
	HttpRequestUrl string   // HttpRequest Url
	Mod            Modifier // Modifier

	// Optional Options
	Header map[string]string   // The HTTP call header
	Param  map[string][]string // The Parameter in Query string

	FailureHandler FuncErrorHandler // The Failure handler of the operation
	Requesthandler ReqHandler       // The http request handler of the operation
	OnResphandler  RespHandler      // The http Resp handler of the operation
}

func (*FaasOperation) Encode

func (operation *FaasOperation) Encode() []byte

func (*FaasOperation) Execute

func (operation *FaasOperation) Execute(data []byte, option map[string]interface{}) ([]byte, error)

func (*FaasOperation) GetHeaders

func (operation *FaasOperation) GetHeaders() map[string]string

func (*FaasOperation) GetId

func (operation *FaasOperation) GetId() string

func (*FaasOperation) GetParams

func (operation *FaasOperation) GetParams() map[string][]string

func (*FaasOperation) GetProperties

func (operation *FaasOperation) GetProperties() map[string][]string

type FuncErrorHandler

type FuncErrorHandler func(error) error

FuncErrorHandler the error handler for OnFailure() options

type Modifier

type Modifier func([]byte) ([]byte, error)

Modifier definition for Modify() call

type Node

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

func (*Node) AddOperation

func (node *Node) AddOperation(operation sdk.Operation) *Node

AddOperation adds an Operation to the given vertex

func (*Node) Apply

func (node *Node) Apply(function string, opts ...Option) *Node

Apply adds a new function to the given vertex

func (*Node) Modify

func (node *Node) Modify(mod Modifier) *Node

Modify adds a new modifier to the given vertex

func (*Node) Request

func (node *Node) Request(url string, opts ...Option) *Node

Request adds a new http Request to the given vertex

type Option

type Option func(*Options)
func Header(key, value string) Option

Header Specify a header in a http call

func OnFailure

func OnFailure(handler FuncErrorHandler) Option

OnFailure Specify a function failure handler

func OnReponse

func OnReponse(handler RespHandler) Option

OnResponse Specify a response handler for function and callback

func Query

func Query(key string, value ...string) Option

Query Specify a query parameter in a http call

func RequestHandler

func RequestHandler(handler ReqHandler) Option

RequestHandler Specify a request handler for function and callback request

type Options

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

Options options for operation execution

type ReqHandler

type ReqHandler func(*http.Request)

Reqhandler definition for RequestHdlr() option on operation

type RespHandler

type RespHandler func(*http.Response) ([]byte, error)

RespHandler definition for OnResponse() option on operation

type StateStore

type StateStore sdk.StateStore

type Workflow

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

func GetWorkflow

func GetWorkflow(pipeline *sdk.Pipeline) *Workflow

GetWorkflow initiates a flow with a pipeline

func (*Workflow) Dag

func (flow *Workflow) Dag() *Dag

Dag provides the workflow dag object

func (*Workflow) Finally

func (flow *Workflow) Finally(handler sdk.PipelineHandler)

Finally sets an execution finish handler routine it will be called once the execution has finished with state either Success/Failure

func (*Workflow) GetPipeline

func (flow *Workflow) GetPipeline() *sdk.Pipeline

GetPipeline expose the underlying pipeline object

func (*Workflow) OnFailure

func (flow *Workflow) OnFailure(handler sdk.PipelineErrorHandler)

OnFailure set a failure handler routine for the pipeline

func (*Workflow) SetDag

func (flow *Workflow) SetDag(dag *Dag)

SetDag apply a predefined dag, and override the default dag

func (*Workflow) SyncNode

func (flow *Workflow) SyncNode(options ...BranchOption) *Node

SyncNode adds a new vertex named Sync

Jump to

Keyboard shortcuts

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