client

package
v0.18.5 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2024 License: MIT Imports: 19 Imported by: 24

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWorkflowCanceled = errors.New("workflow canceled")
View Source
var ErrWorkflowTerminated = errors.New("workflow 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 New

func New(backend backend.Backend) *Client

func (*Client) CancelWorkflowInstance

func (c *Client) CancelWorkflowInstance(ctx context.Context, instance *workflow.Instance) error

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) GetStats added in v0.16.1

func (c *Client) GetStats(ctx context.Context) (*backend.Stats, error)

GetStats returns backend stats.

func (*Client) RemoveWorkflowInstance added in v0.12.0

func (c *Client) RemoveWorkflowInstance(ctx context.Context, instance *core.WorkflowInstance) error

RemoveWorkflowInstance removes the given workflow instance from the backend.

func (*Client) SignalWorkflow

func (c *Client) SignalWorkflow(ctx context.Context, instanceID string, name string, arg any) error

SignalWorkflow signals a running workflow instance.

func (*Client) WaitForWorkflowInstance added in v0.0.4

func (c *Client) WaitForWorkflowInstance(ctx context.Context, instance *workflow.Instance, timeout time.Duration) error

WaitForWorkflowInstance waits for the given workflow instance to finish or until the given timeout has expired.

type WorkflowInstanceOptions

type WorkflowInstanceOptions struct {
	InstanceID string
}

Jump to

Keyboard shortcuts

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