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

package executor

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

Index

Package Files

default_datastore.go executor.go request.go

Constants

const (
    STATE_RUNNING  = "RUNNING"
    STATE_FINISHED = "FINISHED"
    STATE_PAUSED   = "PAUSED"
)

type ExecutionRuntime Uses

type ExecutionRuntime interface {
    // HandleNextNode handles execution of next nodes based on partial state
    HandleNextNode(state *PartialState) (err error)
    // Provide an execution option that will be passed to the operation
    GetExecutionOption(operation sdk.Operation) map[string]interface{}
    // Handle the completion of execution of data
    HandleExecutionCompletion(data []byte) error
}

ExecutionRuntime implements how operation executed and handle next nodes in async

type ExecutionStateOption Uses

type ExecutionStateOption func(*ExecutionStateOptions)

func NewRequest Uses

func NewRequest(request *RawRequest) ExecutionStateOption

func PartialRequest Uses

func PartialRequest(partialState *PartialState) ExecutionStateOption

type ExecutionStateOptions Uses

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

type Executor Uses

type Executor interface {
    // Configure configure an executor with request id
    Configure(requestId string)
    // GetFlowName get name of the flow
    GetFlowName() string
    // GetFlowDefinition get definition of the faas-flow
    GetFlowDefinition(*sdk.Pipeline, *sdk.Context) error
    // ReqValidationEnabled check if request validation enabled
    ReqValidationEnabled() bool
    // GetValidationKey get request validation key
    GetValidationKey() (string, error)
    // ReqAuthEnabled check if request auth enabled
    ReqAuthEnabled() bool
    // GetReqAuthKey get the request auth key
    GetReqAuthKey() (string, error)
    // MonitoringEnabled check if request monitoring enabled
    MonitoringEnabled() bool
    // GetEventHandler get the event handler for request monitoring
    GetEventHandler() (sdk.EventHandler, error)
    // LoggingEnabled check if logging is enabled
    LoggingEnabled() bool
    // GetLogger get the logger
    GetLogger() (sdk.Logger, error)
    // GetStateStore get the state store
    GetStateStore() (sdk.StateStore, error)
    // GetDataStore get the data store
    GetDataStore() (sdk.DataStore, error)

    ExecutionRuntime
}

Executor implements a faas-flow executor

type FlowExecutor Uses

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

FlowExecutor faas-flow executor

func CreateFlowExecutor Uses

func CreateFlowExecutor(executor Executor, notifyChan chan string) (fexec *FlowExecutor)

CreateFlowExecutor initiate a FlowExecutor with a provided Executor

func (*FlowExecutor) Execute Uses

func (fexec *FlowExecutor) Execute(state ExecutionStateOption) ([]byte, error)

Execute start faas-flow execution

func (*FlowExecutor) GetReqId Uses

func (fexec *FlowExecutor) GetReqId() string

GetReqId get request id

func (*FlowExecutor) Pause Uses

func (fexec *FlowExecutor) Pause(reqId string) error

Pause pauses an active dag execution

func (*FlowExecutor) Resume Uses

func (fexec *FlowExecutor) Resume(reqId string) error

Resume resumes a paused dag execution

func (*FlowExecutor) Stop Uses

func (fexec *FlowExecutor) Stop(reqId string) error

Stop marks end of an active dag execution

type PartialState Uses

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

PartialState a partial request for the flow

func DecodePartialReq Uses

func DecodePartialReq(encodedState []byte) (*PartialState, error)

func (*PartialState) Encode Uses

func (req *PartialState) Encode() ([]byte, error)

type RawRequest Uses

type RawRequest struct {
    Data          []byte
    AuthSignature string
    Query         string
    RequestId     string // RequestId is Optional, if provided faas-flow will reuse it
}

RawRequest a raw request for the flow

type Request Uses

type Request struct {
    Sign        string `json: "sign"`         // request signature
    ID          string `json: "id"`           // request ID
    Query       string `json: "query"`        // query string
    CallbackUrl string `json: "callback-url"` // callback url

    ExecutionState string `json: "state"` // Execution State (execution position / execution vertex)

    Data []byte `json: "data"` // Partial execution data

    ContextStore map[string]string `json: "store"` // Context State for default DataStore

}

Request defines the body of async forward request to faasflow

Package executor imports 8 packages (graph). Updated 2019-10-22. Refresh now. Tools for package owners.