executor

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT, MulanPSL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STATE_RUNNING  = "RUNNING"
	STATE_FINISHED = "FINISHED"
	STATE_PAUSED   = "PAUSED"
)
View Source
const (
	RequestStateKey = "request-state"
)

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)

	SetEventHandler(*sdk.EventHandler)

	ExecutionRuntime
}

Executor implements a faas-flow executor

type FlowExecutor

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

FlowExecutor goflow 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

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 core

Jump to

Keyboard shortcuts

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