faas-flow: github.com/s8sg/faas-flow Index | Files | Directories

package faasflow

import "github.com/s8sg/faas-flow"

Index

Package Files

context.go workflow.go

Constants

const (
    // StateSuccess denotes success state
    StateSuccess = "success"
    // StateFailure denotes failure state
    StateFailure = "failure"
    // StateOngoing denotes onging satte
    StateOngoing = "ongoing"
)

Variables

var (
    // Execution specify a edge doesn't forwards a data
    // but rather mention a execution direction
    Execution = InvokeEdge()
)

type BranchOption Uses

type BranchOption func(*BranchOptions)

func Aggregator Uses

func Aggregator(aggregator sdk.Aggregator) BranchOption

Aggregator aggregates all outputs into one

func Forwarder Uses

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 Uses

func InvokeEdge() BranchOption

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

type BranchOptions Uses

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

BranchOptions options for branching in DAG

type Context Uses

type Context struct {
    Query url.Values // provides request Query
    State string     // state of the request
    Name  string     // name of the faas-flow

    NodeInput map[string][]byte // stores inputs form each node
    // contains filtered or unexported fields
}

Context execution context and execution state

func CreateContext Uses

func CreateContext(id string, node string, name string,
    dstore DataStore) *Context

CreateContext create request context (used by template)

func (*Context) Del Uses

func (context *Context) Del(key string) error

Del deletes a value from the context using DataStore

func (*Context) Get Uses

func (context *Context) Get(key string) (interface{}, error)

Get retrive a value from the context using DataStore

func (*Context) GetBool Uses

func (context *Context) GetBool(key string) bool

GetBool retrive a boolean value from the context using DataStore

func (*Context) GetBytes Uses

func (context *Context) GetBytes(key string) []byte

GetBytes retrive a byte array from the context using DataStore

func (*Context) GetInt Uses

func (context *Context) GetInt(key string) int

GetInt retrive a integer value from the context using DataStore

func (*Context) GetNode Uses

func (context *Context) GetNode() string

GetPhase return the node no

func (*Context) GetRequestId Uses

func (context *Context) GetRequestId() string

GetRequestId returns the request id

func (*Context) GetString Uses

func (context *Context) GetString(key string) string

GetString retrive a string value from the context using DataStore

func (*Context) Set Uses

func (context *Context) Set(key string, data interface{}) error

Set put a value in the context using DataStore

type Dag Uses

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

func NewDag Uses

func NewDag() *Dag

NewDag creates a new dag seperately from pipeline

func (*Dag) Append Uses

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 Uses

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

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

func (*Dag) Edge Uses

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

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

func (*Dag) ForEachBranch Uses

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

ForEachBranch composites a subdag which executes for each value It returns the subdag that will be executed for each value

func (*Dag) Node Uses

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

Node adds a new vertex by id

func (*Dag) SubDag Uses

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

SubDag composites a seperate dag as a node.

type DataStore Uses

type DataStore interface {
    // Configure the DaraStore with flow name and request ID
    Configure(flowName string, requestId string)
    // Initialize the DataStore (called only once in a request span)
    Init() error
    // Set store a value for key, in failure returns error
    Set(key string, value string) error
    // Get retrives a value by key, if failure returns error
    Get(key string) (string, error)
    // Del delets a value by a key
    Del(key string) error
    // Cleanup all the resorces in DataStore
    Cleanup() error
}

DataStore for Storing Data

type Node Uses

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

func (*Node) Apply Uses

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

Apply adds a new function to the given vertex

func (*Node) Callback Uses

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

Callback adds a new callback to the given vertex

func (*Node) Modify Uses

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

Modify adds a new modifier to the given vertex

type Option Uses

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

Header Specify a header in a http call

func OnFailure Uses

func OnFailure(handler sdk.FuncErrorHandler) Option

OnFailure Specify a function failure handler

func OnReponse Uses

func OnReponse(handler sdk.RespHandler) Option

OnResponse Specify a response handler for function and callback

func Query Uses

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

Query Specify a query parameter in a http call

func RequestHandler Uses

func RequestHandler(handler sdk.ReqHandler) Option

RequestHandler Specify a request handler for function and callback request

type Options Uses

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

Options options for operation execution

type StateStore Uses

type StateStore interface {
    // Configure the StateStore with flow name and request ID
    Configure(flowName string, requestId string)
    // Initialize the StateStore (called only once in a request span)
    Init() error
    // Set a value (override existing, or create one)
    Set(key string, value string) error
    // Get a value
    Get(key string) (string, error)
    // Compare and Update a value
    Update(key string, oldValue string, newValue string) error
    // Cleanup all the resorces in StateStore (called only once in a request span)
    Cleanup() error
}

StateStore for saving execution state

type Workflow Uses

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

func GetWorkflow Uses

func GetWorkflow() *Workflow

GetWorkflow initiates a flow with a pipeline Singleton - only one object instenciated by faas-flow template

func (*Workflow) Dag Uses

func (flow *Workflow) Dag() *Dag

Dag provides the workflow dag object

func (*Workflow) Finally Uses

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

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

func (*Workflow) GetPipeline Uses

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

GetPipeline expose the underlying pipeline object

func (*Workflow) OnFailure Uses

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

OnFailure set a failure handler routine for the pipeline

func (*Workflow) SetDag Uses

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

SetDag apply a predefined dag, and override the default dag

func (*Workflow) SyncNode Uses

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

SyncNode adds a new vertex named Sync

Directories

PathSynopsis
sdk

Package faasflow imports 6 packages (graph). Updated 2019-07-18. Refresh now. Tools for package owners.