2121package cadence
2222
2323import (
24+ "context"
2425 "time"
2526
2627 "github.com/uber-go/tally"
@@ -40,14 +41,14 @@ type (
4041 // StartWorkflow starts a workflow execution
4142 // The user can use this to start using a function or workflow type name.
4243 // Either by
43- // StartWorkflow(options, "workflowTypeName", input)
44+ // StartWorkflow(ctx, options, "workflowTypeName", input)
4445 // or
45- // StartWorkflow(options, workflowExecuteFn, arg1, arg2, arg3)
46+ // StartWorkflow(ctx, options, workflowExecuteFn, arg1, arg2, arg3)
4647 // The errors it can return:
4748 // - EntityNotExistsError
4849 // - BadRequestError
4950 // - WorkflowExecutionAlreadyStartedError
50- StartWorkflow (options StartWorkflowOptions , workflow interface {}, args ... interface {}) (* WorkflowExecution , error )
51+ StartWorkflow (ctx context. Context , options StartWorkflowOptions , workflow interface {}, args ... interface {}) (* WorkflowExecution , error )
5152
5253 // SignalWorkflow sends a signals to a workflow in execution
5354 // - workflow ID of the workflow.
5657 // The errors it can return:
5758 // - EntityNotExistsError
5859 // - InternalServiceError
59- SignalWorkflow (workflowID string , runID string , signalName string , arg interface {}) error
60+ SignalWorkflow (ctx context. Context , workflowID string , runID string , signalName string , arg interface {}) error
6061
6162 // CancelWorkflow cancels a workflow in execution
6263 // - workflow ID of the workflow.
6566 // - EntityNotExistsError
6667 // - BadRequestError
6768 // - InternalServiceError
68- CancelWorkflow (workflowID string , runID string ) error
69+ CancelWorkflow (ctx context. Context , workflowID string , runID string ) error
6970
7071 // TerminateWorkflow terminates a workflow execution.
7172 // workflowID is required, other parameters are optional.
7576 // - EntityNotExistsError
7677 // - BadRequestError
7778 // - InternalServiceError
78- TerminateWorkflow (workflowID string , runID string , reason string , details []byte ) error
79+ TerminateWorkflow (ctx context. Context , workflowID string , runID string , reason string , details []byte ) error
7980
8081 // GetWorkflowHistory gets history of a particular workflow.
8182 // - workflow ID of the workflow.
8485 // - EntityNotExistsError
8586 // - BadRequestError
8687 // - InternalServiceError
87- GetWorkflowHistory (workflowID string , runID string ) (* s.History , error )
88+ GetWorkflowHistory (ctx context. Context , workflowID string , runID string ) (* s.History , error )
8889
8990 // GetWorkflowStackTrace gets a stack trace of all goroutines of a particular workflow.
9091 // atDecisionTaskCompletedEventID is the eventID of the CompleteDecisionTask event at which stack trace should be taken.
9495 // - EntityNotExistsError
9596 // - BadRequestError
9697 // - InternalServiceError
97- GetWorkflowStackTrace (workflowID string , runID string , atDecisionTaskCompletedEventID int64 ) (string , error )
98+ GetWorkflowStackTrace (ctx context. Context , workflowID string , runID string , atDecisionTaskCompletedEventID int64 ) (string , error )
9899
99100 // CompleteActivity reports activity completed.
100101 // activity Execute method can return cadence.ErrActivityResultPending to
@@ -109,28 +110,28 @@ type (
109110 // To fail the activity with an error.
110111 // CompleteActivity(token, nil, NewErrorWithDetails("reason", details)
111112 // The activity can fail with below errors ErrorWithDetails, TimeoutError, CanceledError.
112- CompleteActivity (taskToken []byte , result interface {}, err error ) error
113+ CompleteActivity (ctx context. Context , taskToken []byte , result interface {}, err error ) error
113114
114115 // RecordActivityHeartbeat records heartbeat for an activity.
115116 // details - is the progress you want to record along with heart beat for this activity.
116117 // The errors it can return:
117118 // - EntityNotExistsError
118119 // - InternalServiceError
119- RecordActivityHeartbeat (taskToken []byte , details ... interface {}) error
120+ RecordActivityHeartbeat (ctx context. Context , taskToken []byte , details ... interface {}) error
120121
121122 // ListClosedWorkflow gets closed workflow executions based on request filters
122123 // The errors it can return:
123124 // - BadRequestError
124125 // - InternalServiceError
125126 // - EntityNotExistError
126- ListClosedWorkflow (request * s.ListClosedWorkflowExecutionsRequest ) (* s.ListClosedWorkflowExecutionsResponse , error )
127+ ListClosedWorkflow (ctx context. Context , request * s.ListClosedWorkflowExecutionsRequest ) (* s.ListClosedWorkflowExecutionsResponse , error )
127128
128129 // ListClosedWorkflow gets open workflow executions based on request filters
129130 // The errors it can return:
130131 // - BadRequestError
131132 // - InternalServiceError
132133 // - EntityNotExistError
133- ListOpenWorkflow (request * s.ListOpenWorkflowExecutionsRequest ) (* s.ListOpenWorkflowExecutionsResponse , error )
134+ ListOpenWorkflow (ctx context. Context , request * s.ListOpenWorkflowExecutionsRequest ) (* s.ListOpenWorkflowExecutionsResponse , error )
134135
135136 // QueryWorkflow queries a given workflow execution and returns the query result synchronously. Parameter workflowID
136137 // and queryType are required, other parameters are optional. The workflowID and runID (optional) identify the
@@ -150,7 +151,7 @@ type (
150151 // - InternalServiceError
151152 // - EntityNotExistError
152153 // - QueryFailError
153- QueryWorkflow (workflowID string , runID string , queryType string , args ... interface {}) (EncodedValue , error )
154+ QueryWorkflow (ctx context. Context , workflowID string , runID string , queryType string , args ... interface {}) (EncodedValue , error )
154155 }
155156
156157 // ClientOptions are optional parameters for Client creation.
@@ -191,7 +192,7 @@ type (
191192 // - DomainAlreadyExistsError
192193 // - BadRequestError
193194 // - InternalServiceError
194- Register (request * s.RegisterDomainRequest ) error
195+ Register (ctx context. Context , request * s.RegisterDomainRequest ) error
195196
196197 // Describe a domain. The domain has two part of information.
197198 // DomainInfo - Which has Name, Status, Description, Owner Email.
@@ -200,7 +201,7 @@ type (
200201 // - EntityNotExistsError
201202 // - BadRequestError
202203 // - InternalServiceError
203- Describe (name string ) (* s.DomainInfo , * s.DomainConfiguration , error )
204+ Describe (ctx context. Context , name string ) (* s.DomainInfo , * s.DomainConfiguration , error )
204205
205206 // Update a domain. The domain has two part of information.
206207 // UpdateDomainInfo - To update domain Description and Owner Email.
@@ -209,7 +210,7 @@ type (
209210 // - EntityNotExistsError
210211 // - BadRequestError
211212 // - InternalServiceError
212- Update (name string , domainInfo * s.UpdateDomainInfo , domainConfig * s.DomainConfiguration ) error
213+ Update (ctx context. Context , name string , domainInfo * s.UpdateDomainInfo , domainConfig * s.DomainConfiguration ) error
213214 }
214215)
215216
0 commit comments