@@ -42,7 +42,8 @@ func New(backend backend.Backend) *Client {
42
42
}
43
43
}
44
44
45
- func (c * Client ) CreateWorkflowInstance (ctx context.Context , options WorkflowInstanceOptions , wf workflow.Workflow , args ... interface {}) (* workflow.Instance , error ) {
45
+ // CreateWorkflowInstance creates a new workflow instance of the given workflow.
46
+ func (c * Client ) CreateWorkflowInstance (ctx context.Context , options WorkflowInstanceOptions , wf workflow.Workflow , args ... any ) (* workflow.Instance , error ) {
46
47
// Check arguments
47
48
if err := a .ParamsMatch (wf , args ... ); err != nil {
48
49
return nil , err
@@ -89,6 +90,7 @@ func (c *Client) CreateWorkflowInstance(ctx context.Context, options WorkflowIns
89
90
return wfi , nil
90
91
}
91
92
93
+ // CancelWorkflowInstance cancels a running workflow instance.
92
94
func (c * Client ) CancelWorkflowInstance (ctx context.Context , instance * workflow.Instance ) error {
93
95
ctx , span := c .backend .Tracer ().Start (ctx , "CancelWorkflowInstance" , trace .WithAttributes (
94
96
attribute .String (log .InstanceIDKey , instance .InstanceID ),
@@ -99,7 +101,8 @@ func (c *Client) CancelWorkflowInstance(ctx context.Context, instance *workflow.
99
101
return c .backend .CancelWorkflowInstance (ctx , instance , cancellationEvent )
100
102
}
101
103
102
- func (c * Client ) SignalWorkflow (ctx context.Context , instanceID string , name string , arg interface {}) error {
104
+ // SignalWorkflow signals a running workflow instance.
105
+ func (c * Client ) SignalWorkflow (ctx context.Context , instanceID string , name string , arg any ) error {
103
106
ctx , span := c .backend .Tracer ().Start (ctx , "SignalWorkflow" , trace .WithAttributes (
104
107
attribute .String (log .InstanceIDKey , instanceID ),
105
108
attribute .String (log .SignalNameKey , name ),
@@ -131,6 +134,7 @@ func (c *Client) SignalWorkflow(ctx context.Context, instanceID string, name str
131
134
return nil
132
135
}
133
136
137
+ // WaitForWorkflowInstance waits for the given workflow instance to finish or until the given timeout has expired.
134
138
func (c * Client ) WaitForWorkflowInstance (ctx context.Context , instance * workflow.Instance , timeout time.Duration ) error {
135
139
if timeout == 0 {
136
140
timeout = time .Second * 20
@@ -226,6 +230,7 @@ func GetWorkflowResult[T any](ctx context.Context, c *Client, instance *workflow
226
230
return * new (T ), errors .New ("workflow finished, but could not find result event" )
227
231
}
228
232
233
+ // RemoveWorkflowInstance removes the given workflow instance from the backend.
229
234
func (c * Client ) RemoveWorkflowInstance (ctx context.Context , instance * core.WorkflowInstance ) error {
230
235
ctx , span := c .backend .Tracer ().Start (ctx , "RemoveWorkflowInstance" , trace .WithAttributes (
231
236
attribute .String (log .InstanceIDKey , instance .InstanceID ),
0 commit comments