executor

package
v0.6.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

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

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecutionRuntime

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

type ExecutionStateOption func(*ExecutionStateOptions)

func NewRequest

func NewRequest(request *RawRequest) ExecutionStateOption

func PartialRequest

func PartialRequest(partialState *PartialState) ExecutionStateOption

type ExecutionStateOptions

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

type Executor

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

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

FlowExecutor faas-flow executor

func CreateFlowExecutor

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

CreateFlowExecutor initiate a FlowExecutor with a provided Executor

func (*FlowExecutor) Execute

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

Execute start faas-flow execution

func (*FlowExecutor) GetReqId

func (fexec *FlowExecutor) GetReqId() string

GetReqId get request id

func (*FlowExecutor) GetState added in v0.6.1

func (fexec *FlowExecutor) GetState(reqId string) (string, error)

GetState returns the state of the request

func (*FlowExecutor) Pause

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

Pause pauses an active dag execution

func (*FlowExecutor) Resume

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

Resume resumes a paused dag execution

func (*FlowExecutor) Stop

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

Stop marks end of an active dag execution

type PartialState

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

PartialState a partial request for the flow

func DecodePartialReq

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

func (*PartialState) Encode

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

type RawRequest

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

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][]byte `json: "store"` // Context State for default DataStore

}

Request defines the body of async forward request to faasflow

Jump to

Keyboard shortcuts

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