Documentation ¶
Index ¶
- Variables
- func GetWorkflowResult[T any](ctx context.Context, c *Client, instance *workflow.Instance, ...) (T, error)
- type Client
- func (c *Client) CancelWorkflowInstance(ctx context.Context, instance *workflow.Instance) error
- func (c *Client) CreateWorkflowInstance(ctx context.Context, options WorkflowInstanceOptions, wf workflow.Workflow, ...) (*workflow.Instance, error)
- func (c *Client) GetStats(ctx context.Context) (*backend.Stats, error)
- func (c *Client) GetWorkflowInstanceState(ctx context.Context, instance *workflow.Instance) (core.WorkflowInstanceState, error)
- func (c *Client) RemoveWorkflowInstance(ctx context.Context, instance *core.WorkflowInstance) error
- func (c *Client) RemoveWorkflowInstances(ctx context.Context, options ...backend.RemovalOption) error
- func (c *Client) SignalWorkflow(ctx context.Context, instanceID string, name string, arg any) error
- func (c *Client) StartAutoExpiration(ctx context.Context, delay time.Duration) error
- func (c *Client) WaitForWorkflowInstance(ctx context.Context, instance *workflow.Instance, timeout time.Duration) error
- type WorkflowInstanceOptions
Constants ¶
This section is empty.
Variables ¶
var ErrWorkflowCanceled = errors.New("workflow canceled")
ErrWorkflowCanceled is returned when a workflow was already canceled.
var ErrWorkflowTerminated = errors.New("workflow terminated")
ErrWorkflowTerminated is returned when a workflow was already terminated.
Functions ¶
func GetWorkflowResult ¶ added in v0.0.4
func GetWorkflowResult[T any](ctx context.Context, c *Client, instance *workflow.Instance, timeout time.Duration) (T, error)
GetWorkflowResult gets the workflow result for the given workflow result. It first waits for the workflow to finish or until the given timeout has expired.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CancelWorkflowInstance ¶
CancelWorkflowInstance cancels a running workflow instance.
func (*Client) CreateWorkflowInstance ¶
func (c *Client) CreateWorkflowInstance(ctx context.Context, options WorkflowInstanceOptions, wf workflow.Workflow, args ...any) (*workflow.Instance, error)
CreateWorkflowInstance creates a new workflow instance of the given workflow.
func (*Client) GetWorkflowInstanceState ¶ added in v0.19.0
func (c *Client) GetWorkflowInstanceState(ctx context.Context, instance *workflow.Instance) (core.WorkflowInstanceState, error)
GetWorkflowInstanceState returns the current state of the given workflow instance
func (*Client) RemoveWorkflowInstance ¶ added in v0.12.0
RemoveWorkflowInstance removes the given workflow instance from the backend.
Instance needs to be in a completed state.
func (*Client) RemoveWorkflowInstances ¶ added in v0.19.0
func (c *Client) RemoveWorkflowInstances(ctx context.Context, options ...backend.RemovalOption) error
RemoveWorkflowInstances removes completed workflow instances from the backend.
func (*Client) SignalWorkflow ¶
SignalWorkflow signals a running workflow instance.
func (*Client) StartAutoExpiration ¶ added in v0.19.0
StartAutoExpiration starts a system workflow that will automatically expire workflow instances.
The workflow will run every `delay` and remove all workflow instances finished before Now() - `delay`.