Documentation ¶
Index ¶
- Constants
- type CallConfig
- type CallOption
- type Dynamic
- type Invocation
- func (ia *Invocation) AddTask(invocationID string, task *types.Task) error
- func (ia *Invocation) Cancel(invocationID string) error
- func (ia *Invocation) Complete(invocationID string, output *typedvalues.TypedValue, ...) error
- func (ia *Invocation) Fail(invocationID string, errMsg error) error
- func (ia *Invocation) Invoke(spec *types.WorkflowInvocationSpec, opts ...CallOption) (string, error)
- type Task
- type Workflow
Constants ¶
const ErrInvocationCanceled = "workflow invocation was canceled"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallConfig ¶
type CallConfig struct {
// contains filtered or unexported fields
}
type CallOption ¶
type CallOption func(op *CallConfig)
func AwaitWorklow ¶
func AwaitWorklow(timeout time.Duration) CallOption
func PostTransformer ¶
func PostTransformer(fn func(ti *types.TaskInvocation) error) CallOption
func WithContext ¶
func WithContext(ctx context.Context) CallOption
type Dynamic ¶
type Dynamic struct {
// contains filtered or unexported fields
}
Dynamic contains the API functionality for creating dynamic tasks and workflows.
func NewDynamicApi ¶
func NewDynamicApi(wfAPI *Workflow, wfiAPI *Invocation) *Dynamic
NewDynamicApi creates the Dynamic API.
func (*Dynamic) AddDynamicFlow ¶
func (ap *Dynamic) AddDynamicFlow(invocationID string, parentTaskID string, flow controlflow.Flow) error
AddDynamicFlow inserts the flow as a 'dynamic task' into the workflow invocation with id invocationID as the child of the parent task.
type Invocation ¶
type Invocation struct {
// contains filtered or unexported fields
}
Invocation contains the API functionality for controlling (workflow) invocations. This includes starting, stopping, and completing invocations.
func NewInvocationAPI ¶
func NewInvocationAPI(esClient fes.Backend) *Invocation
NewInvocationAPI creates the Invocation API.
func (*Invocation) AddTask ¶
func (ia *Invocation) AddTask(invocationID string, task *types.Task) error
AddTask provides functionality to add a task to a specific invocation (instead of a workflow). This allows users to modify specific invocations (see dynamic API). The error can be a validate.Err, proto marshall error, or a fes error.
func (*Invocation) Cancel ¶
func (ia *Invocation) Cancel(invocationID string) error
Cancel halts an invocation. This does not guarantee that tasks currently running are halted, but beyond the invocation will not progress any further than those tasks. The state of the invocation will become ABORTED. If the API fails to append the event to the event store, it will return an error.
func (*Invocation) Complete ¶
func (ia *Invocation) Complete(invocationID string, output *typedvalues.TypedValue, outputHeaders *typedvalues.TypedValue) error
Complete forces the completion of an invocation. This function - used by the controller - is the only way to ensure that a workflow invocation turns into the COMPLETED state. If the API fails to append the event to the event store, it will return an error.
func (*Invocation) Fail ¶
func (ia *Invocation) Fail(invocationID string, errMsg error) error
Fail changes the state of the invocation to FAILED. Optionally you can provide a custom error message to indicate the specific reason for the FAILED state. If the API fails to append the event to the event store, it will return an error.
func (*Invocation) Invoke ¶
func (ia *Invocation) Invoke(spec *types.WorkflowInvocationSpec, opts ...CallOption) (string, error)
Invoke triggers the start of the invocation using the provided specification. The function either returns the invocationID of the invocation or an error. The error can be a validate.Err, proto marshall error, or a fes error.
type Task ¶
type Task struct {
// contains filtered or unexported fields
}
Task contains the API functionality for controlling the lifecycle of individual tasks. This includes starting, stopping and completing tasks.
func NewTaskAPI ¶
NewTaskAPI creates the Task API.
func (*Task) Fail ¶
Fail forces the failure of a task. This turns the state of a task into FAILED. If the API fails to append the event to the event store, it will return an error.
func (*Task) Invoke ¶
func (ap *Task) Invoke(spec *types.TaskInvocationSpec, opts ...CallOption) (*types.TaskInvocation, error)
Invoke starts the execution of a task, changing the state of the task into RUNNING. Currently it executes the underlying function synchronously and manage the execution until completion.
func (*Task) Prepare ¶
func (ap *Task) Prepare(spec *types.TaskInvocationSpec, expectedAt time.Time, opts ...CallOption) error
type Workflow ¶
type Workflow struct {
// contains filtered or unexported fields
}
Workflow contains the API functionality for controlling workflow definitions. This includes creating and parsing workflows.
func NewWorkflowAPI ¶
NewWorkflowAPI creates the Workflow API.
func (*Workflow) Create ¶
func (wa *Workflow) Create(workflow *types.WorkflowSpec, opts ...CallOption) (string, error)
Create creates a new workflow based on the provided workflowSpec. The function either returns the id of the workflow or an error. The error can be a validate.Err, proto marshall error, or a fes error. TODO check if id already exists
func (*Workflow) Delete ¶
Delete marks a workflow as deleted, making it unavailable to any future interactions. This also means that subsequent invocations for this workflow will fail. If the API fails to append the event to the event store, it will return an error.
func (*Workflow) Parse ¶
Parse processes the workflow to resolve any ambiguity. Currently, this means that all the function references are resolved to function identifiers. For convenience this function returns the new WorkflowStatus. If the API fails to append the event to the event store, it will return an error.
Directories ¶
Path | Synopsis |
---|---|
Code generated by hack/codegen-events.py.
|
Code generated by hack/codegen-events.py. |
package store provides typed, centralized access to the event-sourced workflow and invocation models
|
package store provides typed, centralized access to the event-sourced workflow and invocation models |