import "github.com/s8sg/faas-flow/sdk/executor"
default_datastore.go executor.go request.go
const ( STATE_RUNNING = "RUNNING" STATE_FINISHED = "FINISHED" STATE_PAUSED = "PAUSED" )
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 func(*ExecutionStateOptions)
func NewRequest(request *RawRequest) ExecutionStateOption
func PartialRequest(partialState *PartialState) ExecutionStateOption
type ExecutionStateOptions struct {
// contains filtered or unexported fields
}
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 struct {
// contains filtered or unexported fields
}
FlowExecutor faas-flow executor
func CreateFlowExecutor(executor Executor, notifyChan chan string) (fexec *FlowExecutor)
CreateFlowExecutor initiate a FlowExecutor with a provided Executor
func (fexec *FlowExecutor) Execute(state ExecutionStateOption) ([]byte, error)
Execute start faas-flow execution
func (fexec *FlowExecutor) GetReqId() string
GetReqId get request id
func (fexec *FlowExecutor) Pause(reqId string) error
Pause pauses an active dag execution
func (fexec *FlowExecutor) Resume(reqId string) error
Resume resumes a paused dag execution
func (fexec *FlowExecutor) Stop(reqId string) error
Stop marks end of an active dag execution
type PartialState struct {
// contains filtered or unexported fields
}
PartialState a partial request for the flow
func DecodePartialReq(encodedState []byte) (*PartialState, error)
func (req *PartialState) Encode() ([]byte, error)
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 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.