• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

uber / cadence / 018d9fa8-75f8-405b-9b1e-38f93e6b0a11

12 Feb 2024 11:30PM UTC coverage: 62.748% (+0.05%) from 62.701%
018d9fa8-75f8-405b-9b1e-38f93e6b0a11

Pull #5657

buildkite

Shaddoll
Implement SignalWithStartWorkflowExecutionAsync API
Pull Request #5657: Implement SignalWithStartWorkflowExecutionAsync API

96 of 142 new or added lines in 5 files covered. (67.61%)

60 existing lines in 8 files now uncovered.

92596 of 147569 relevant lines covered (62.75%)

2318.9 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

2.53
/client/frontend/client.go
1
// Copyright (c) 2017 Uber Technologies, Inc.
2
//
3
// Permission is hereby granted, free of charge, to any person obtaining a copy
4
// of this software and associated documentation files (the "Software"), to deal
5
// in the Software without restriction, including without limitation the rights
6
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
// copies of the Software, and to permit persons to whom the Software is
8
// furnished to do so, subject to the following conditions:
9
//
10
// The above copyright notice and this permission notice shall be included in
11
// all copies or substantial portions of the Software.
12
//
13
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
// THE SOFTWARE.
20

21
package frontend
22

23
import (
24
        "context"
25
        "time"
26

27
        "go.uber.org/yarpc"
28

29
        "github.com/uber/cadence/common/types"
30
)
31

32
var _ Client = (*clientImpl)(nil)
33

34
const (
35
        // DefaultTimeout is the default timeout used to make calls
36
        DefaultTimeout = 10 * time.Second
37
        // DefaultLongPollTimeout is the long poll default timeout used to make calls
38
        DefaultLongPollTimeout = time.Minute * 3
39
)
40

41
type clientImpl struct {
42
        timeout         time.Duration
43
        longPollTimeout time.Duration
44
        client          Client
45
}
46

47
// NewClient creates a new frontend service TChannel client
48
func NewClient(
49
        timeout time.Duration,
50
        longPollTimeout time.Duration,
51
        client Client,
52
) Client {
87✔
53
        return &clientImpl{
87✔
54
                timeout:         timeout,
87✔
55
                longPollTimeout: longPollTimeout,
87✔
56
                client:          client,
87✔
57
        }
87✔
58
}
87✔
59

60
func (c *clientImpl) CountWorkflowExecutions(
61
        ctx context.Context,
62
        request *types.CountWorkflowExecutionsRequest,
63
        opts ...yarpc.CallOption,
64
) (*types.CountWorkflowExecutionsResponse, error) {
×
65

×
66
        ctx, cancel := c.createContext(ctx)
×
67
        defer cancel()
×
68
        return c.client.CountWorkflowExecutions(ctx, request, opts...)
×
69
}
×
70

71
func (c *clientImpl) DeprecateDomain(
72
        ctx context.Context,
73
        request *types.DeprecateDomainRequest,
74
        opts ...yarpc.CallOption,
75
) error {
×
76

×
77
        ctx, cancel := c.createContext(ctx)
×
78
        defer cancel()
×
79
        return c.client.DeprecateDomain(ctx, request, opts...)
×
80
}
×
81

82
func (c *clientImpl) DescribeDomain(
83
        ctx context.Context,
84
        request *types.DescribeDomainRequest,
85
        opts ...yarpc.CallOption,
86
) (*types.DescribeDomainResponse, error) {
×
87

×
88
        ctx, cancel := c.createContext(ctx)
×
89
        defer cancel()
×
90
        return c.client.DescribeDomain(ctx, request, opts...)
×
91
}
×
92

93
func (c *clientImpl) DescribeTaskList(
94
        ctx context.Context,
95
        request *types.DescribeTaskListRequest,
96
        opts ...yarpc.CallOption,
97
) (*types.DescribeTaskListResponse, error) {
×
98

×
99
        ctx, cancel := c.createContext(ctx)
×
100
        defer cancel()
×
101
        return c.client.DescribeTaskList(ctx, request, opts...)
×
102
}
×
103

104
func (c *clientImpl) DescribeWorkflowExecution(
105
        ctx context.Context,
106
        request *types.DescribeWorkflowExecutionRequest,
107
        opts ...yarpc.CallOption,
108
) (*types.DescribeWorkflowExecutionResponse, error) {
×
109

×
110
        ctx, cancel := c.createContext(ctx)
×
111
        defer cancel()
×
112
        return c.client.DescribeWorkflowExecution(ctx, request, opts...)
×
113
}
×
114

115
func (c *clientImpl) GetClusterInfo(
116
        ctx context.Context,
117
        opts ...yarpc.CallOption,
118
) (*types.ClusterInfo, error) {
×
119

×
120
        ctx, cancel := c.createContext(ctx)
×
121
        defer cancel()
×
122
        return c.client.GetClusterInfo(ctx, opts...)
×
123
}
×
124

125
func (c *clientImpl) GetSearchAttributes(
126
        ctx context.Context,
127
        opts ...yarpc.CallOption,
128
) (*types.GetSearchAttributesResponse, error) {
×
129

×
130
        ctx, cancel := c.createContext(ctx)
×
131
        defer cancel()
×
132
        return c.client.GetSearchAttributes(ctx, opts...)
×
133
}
×
134

135
func (c *clientImpl) GetTaskListsByDomain(
136
        ctx context.Context,
137
        request *types.GetTaskListsByDomainRequest,
138
        opts ...yarpc.CallOption,
139
) (*types.GetTaskListsByDomainResponse, error) {
×
140

×
141
        ctx, cancel := c.createContext(ctx)
×
142
        defer cancel()
×
143

×
144
        return c.client.GetTaskListsByDomain(ctx, request, opts...)
×
145
}
×
146

147
func (c *clientImpl) GetWorkflowExecutionHistory(
148
        ctx context.Context,
149
        request *types.GetWorkflowExecutionHistoryRequest,
150
        opts ...yarpc.CallOption,
151
) (*types.GetWorkflowExecutionHistoryResponse, error) {
×
152

×
153
        ctx, cancel := c.createContext(ctx)
×
154
        defer cancel()
×
155
        return c.client.GetWorkflowExecutionHistory(ctx, request, opts...)
×
156
}
×
157

158
func (c *clientImpl) ListArchivedWorkflowExecutions(
159
        ctx context.Context,
160
        request *types.ListArchivedWorkflowExecutionsRequest,
161
        opts ...yarpc.CallOption,
162
) (*types.ListArchivedWorkflowExecutionsResponse, error) {
×
163

×
164
        ctx, cancel := c.createLongPollContext(ctx)
×
165
        defer cancel()
×
166
        return c.client.ListArchivedWorkflowExecutions(ctx, request, opts...)
×
167
}
×
168

169
func (c *clientImpl) ListClosedWorkflowExecutions(
170
        ctx context.Context,
171
        request *types.ListClosedWorkflowExecutionsRequest,
172
        opts ...yarpc.CallOption,
173
) (*types.ListClosedWorkflowExecutionsResponse, error) {
×
174

×
175
        ctx, cancel := c.createContext(ctx)
×
176
        defer cancel()
×
177
        return c.client.ListClosedWorkflowExecutions(ctx, request, opts...)
×
178
}
×
179

180
func (c *clientImpl) ListDomains(
181
        ctx context.Context,
182
        request *types.ListDomainsRequest,
183
        opts ...yarpc.CallOption,
184
) (*types.ListDomainsResponse, error) {
×
185

×
186
        ctx, cancel := c.createContext(ctx)
×
187
        defer cancel()
×
188
        return c.client.ListDomains(ctx, request, opts...)
×
189
}
×
190

191
func (c *clientImpl) ListOpenWorkflowExecutions(
192
        ctx context.Context,
193
        request *types.ListOpenWorkflowExecutionsRequest,
194
        opts ...yarpc.CallOption,
195
) (*types.ListOpenWorkflowExecutionsResponse, error) {
×
196

×
197
        ctx, cancel := c.createContext(ctx)
×
198
        defer cancel()
×
199
        return c.client.ListOpenWorkflowExecutions(ctx, request, opts...)
×
200
}
×
201

202
func (c *clientImpl) ListTaskListPartitions(
203
        ctx context.Context,
204
        request *types.ListTaskListPartitionsRequest,
205
        opts ...yarpc.CallOption,
206
) (*types.ListTaskListPartitionsResponse, error) {
×
207

×
208
        ctx, cancel := c.createContext(ctx)
×
209
        defer cancel()
×
210

×
211
        return c.client.ListTaskListPartitions(ctx, request, opts...)
×
212
}
×
213

214
func (c *clientImpl) ListWorkflowExecutions(
215
        ctx context.Context,
216
        request *types.ListWorkflowExecutionsRequest,
217
        opts ...yarpc.CallOption,
218
) (*types.ListWorkflowExecutionsResponse, error) {
×
219

×
220
        ctx, cancel := c.createContext(ctx)
×
221
        defer cancel()
×
222
        return c.client.ListWorkflowExecutions(ctx, request, opts...)
×
223
}
×
224

225
func (c *clientImpl) PollForActivityTask(
226
        ctx context.Context,
227
        request *types.PollForActivityTaskRequest,
228
        opts ...yarpc.CallOption,
229
) (*types.PollForActivityTaskResponse, error) {
×
230

×
231
        ctx, cancel := c.createLongPollContext(ctx)
×
232
        defer cancel()
×
233
        return c.client.PollForActivityTask(ctx, request, opts...)
×
234
}
×
235

236
func (c *clientImpl) PollForDecisionTask(
237
        ctx context.Context,
238
        request *types.PollForDecisionTaskRequest,
239
        opts ...yarpc.CallOption,
240
) (*types.PollForDecisionTaskResponse, error) {
×
241

×
242
        ctx, cancel := c.createLongPollContext(ctx)
×
243
        defer cancel()
×
244
        return c.client.PollForDecisionTask(ctx, request, opts...)
×
245
}
×
246

247
func (c *clientImpl) QueryWorkflow(
248
        ctx context.Context,
249
        request *types.QueryWorkflowRequest,
250
        opts ...yarpc.CallOption,
251
) (*types.QueryWorkflowResponse, error) {
×
252

×
253
        ctx, cancel := c.createContext(ctx)
×
254
        defer cancel()
×
255
        return c.client.QueryWorkflow(ctx, request, opts...)
×
256
}
×
257

258
func (c *clientImpl) RecordActivityTaskHeartbeat(
259
        ctx context.Context,
260
        request *types.RecordActivityTaskHeartbeatRequest,
261
        opts ...yarpc.CallOption,
262
) (*types.RecordActivityTaskHeartbeatResponse, error) {
×
263

×
264
        ctx, cancel := c.createContext(ctx)
×
265
        defer cancel()
×
266
        return c.client.RecordActivityTaskHeartbeat(ctx, request, opts...)
×
267
}
×
268

269
func (c *clientImpl) RecordActivityTaskHeartbeatByID(
270
        ctx context.Context,
271
        request *types.RecordActivityTaskHeartbeatByIDRequest,
272
        opts ...yarpc.CallOption,
273
) (*types.RecordActivityTaskHeartbeatResponse, error) {
×
274

×
275
        ctx, cancel := c.createContext(ctx)
×
276
        defer cancel()
×
277
        return c.client.RecordActivityTaskHeartbeatByID(ctx, request, opts...)
×
278
}
×
279

280
func (c *clientImpl) RefreshWorkflowTasks(
281
        ctx context.Context,
282
        request *types.RefreshWorkflowTasksRequest,
283
        opts ...yarpc.CallOption,
284
) error {
×
285

×
286
        ctx, cancel := c.createContext(ctx)
×
287
        defer cancel()
×
288
        return c.client.RefreshWorkflowTasks(ctx, request, opts...)
×
289
}
×
290

291
func (c *clientImpl) RegisterDomain(
292
        ctx context.Context,
293
        request *types.RegisterDomainRequest,
294
        opts ...yarpc.CallOption,
295
) error {
×
296

×
297
        ctx, cancel := c.createContext(ctx)
×
298
        defer cancel()
×
299
        return c.client.RegisterDomain(ctx, request, opts...)
×
300
}
×
301

302
func (c *clientImpl) RequestCancelWorkflowExecution(
303
        ctx context.Context,
304
        request *types.RequestCancelWorkflowExecutionRequest,
305
        opts ...yarpc.CallOption,
306
) error {
×
307

×
308
        ctx, cancel := c.createContext(ctx)
×
309
        defer cancel()
×
310
        return c.client.RequestCancelWorkflowExecution(ctx, request, opts...)
×
311
}
×
312

313
func (c *clientImpl) ResetStickyTaskList(
314
        ctx context.Context,
315
        request *types.ResetStickyTaskListRequest,
316
        opts ...yarpc.CallOption,
317
) (*types.ResetStickyTaskListResponse, error) {
×
318

×
319
        ctx, cancel := c.createContext(ctx)
×
320
        defer cancel()
×
321
        return c.client.ResetStickyTaskList(ctx, request, opts...)
×
322
}
×
323

324
func (c *clientImpl) ResetWorkflowExecution(
325
        ctx context.Context,
326
        request *types.ResetWorkflowExecutionRequest,
327
        opts ...yarpc.CallOption,
328
) (*types.ResetWorkflowExecutionResponse, error) {
×
329

×
330
        ctx, cancel := c.createContext(ctx)
×
331
        defer cancel()
×
332
        return c.client.ResetWorkflowExecution(ctx, request, opts...)
×
333
}
×
334

335
func (c *clientImpl) RespondActivityTaskCanceled(
336
        ctx context.Context,
337
        request *types.RespondActivityTaskCanceledRequest,
338
        opts ...yarpc.CallOption,
339
) error {
×
340

×
341
        ctx, cancel := c.createContext(ctx)
×
342
        defer cancel()
×
343
        return c.client.RespondActivityTaskCanceled(ctx, request, opts...)
×
344
}
×
345

346
func (c *clientImpl) RespondActivityTaskCanceledByID(
347
        ctx context.Context,
348
        request *types.RespondActivityTaskCanceledByIDRequest,
349
        opts ...yarpc.CallOption,
350
) error {
×
351

×
352
        ctx, cancel := c.createContext(ctx)
×
353
        defer cancel()
×
354
        return c.client.RespondActivityTaskCanceledByID(ctx, request, opts...)
×
355
}
×
356

357
func (c *clientImpl) RespondActivityTaskCompleted(
358
        ctx context.Context,
359
        request *types.RespondActivityTaskCompletedRequest,
360
        opts ...yarpc.CallOption,
361
) error {
×
362

×
363
        ctx, cancel := c.createContext(ctx)
×
364
        defer cancel()
×
365
        return c.client.RespondActivityTaskCompleted(ctx, request, opts...)
×
366
}
×
367

368
func (c *clientImpl) RespondActivityTaskCompletedByID(
369
        ctx context.Context,
370
        request *types.RespondActivityTaskCompletedByIDRequest,
371
        opts ...yarpc.CallOption,
372
) error {
×
373

×
374
        ctx, cancel := c.createContext(ctx)
×
375
        defer cancel()
×
376
        return c.client.RespondActivityTaskCompletedByID(ctx, request, opts...)
×
377
}
×
378

379
func (c *clientImpl) RespondActivityTaskFailed(
380
        ctx context.Context,
381
        request *types.RespondActivityTaskFailedRequest,
382
        opts ...yarpc.CallOption,
383
) error {
×
384

×
385
        ctx, cancel := c.createContext(ctx)
×
386
        defer cancel()
×
387
        return c.client.RespondActivityTaskFailed(ctx, request, opts...)
×
388
}
×
389

390
func (c *clientImpl) RespondActivityTaskFailedByID(
391
        ctx context.Context,
392
        request *types.RespondActivityTaskFailedByIDRequest,
393
        opts ...yarpc.CallOption,
394
) error {
×
395

×
396
        ctx, cancel := c.createContext(ctx)
×
397
        defer cancel()
×
398
        return c.client.RespondActivityTaskFailedByID(ctx, request, opts...)
×
399
}
×
400

401
func (c *clientImpl) RespondDecisionTaskCompleted(
402
        ctx context.Context,
403
        request *types.RespondDecisionTaskCompletedRequest,
404
        opts ...yarpc.CallOption,
405
) (*types.RespondDecisionTaskCompletedResponse, error) {
×
406

×
407
        ctx, cancel := c.createContext(ctx)
×
408
        defer cancel()
×
409
        return c.client.RespondDecisionTaskCompleted(ctx, request, opts...)
×
410
}
×
411

412
func (c *clientImpl) RespondDecisionTaskFailed(
413
        ctx context.Context,
414
        request *types.RespondDecisionTaskFailedRequest,
415
        opts ...yarpc.CallOption,
416
) error {
×
417

×
418
        ctx, cancel := c.createContext(ctx)
×
419
        defer cancel()
×
420
        return c.client.RespondDecisionTaskFailed(ctx, request, opts...)
×
421
}
×
422

423
func (c *clientImpl) RespondQueryTaskCompleted(
424
        ctx context.Context,
425
        request *types.RespondQueryTaskCompletedRequest,
426
        opts ...yarpc.CallOption,
427
) error {
×
428

×
429
        ctx, cancel := c.createContext(ctx)
×
430
        defer cancel()
×
431
        return c.client.RespondQueryTaskCompleted(ctx, request, opts...)
×
432
}
×
433

434
func (c *clientImpl) RestartWorkflowExecution(
435
        ctx context.Context,
436
        request *types.RestartWorkflowExecutionRequest,
437
        opts ...yarpc.CallOption) (*types.RestartWorkflowExecutionResponse, error) {
×
438

×
439
        ctx, cancel := c.createContext(ctx)
×
440
        defer cancel()
×
441
        return c.client.RestartWorkflowExecution(ctx, request, opts...)
×
442
}
×
443

444
func (c *clientImpl) ScanWorkflowExecutions(
445
        ctx context.Context,
446
        request *types.ListWorkflowExecutionsRequest,
447
        opts ...yarpc.CallOption,
448
) (*types.ListWorkflowExecutionsResponse, error) {
×
449

×
450
        ctx, cancel := c.createContext(ctx)
×
451
        defer cancel()
×
452
        return c.client.ScanWorkflowExecutions(ctx, request, opts...)
×
453
}
×
454

455
func (c *clientImpl) SignalWithStartWorkflowExecution(
456
        ctx context.Context,
457
        request *types.SignalWithStartWorkflowExecutionRequest,
458
        opts ...yarpc.CallOption,
459
) (*types.StartWorkflowExecutionResponse, error) {
×
460

×
461
        ctx, cancel := c.createContext(ctx)
×
462
        defer cancel()
×
463
        return c.client.SignalWithStartWorkflowExecution(ctx, request, opts...)
×
464
}
×
465

466
func (c *clientImpl) SignalWithStartWorkflowExecutionAsync(
467
        ctx context.Context,
468
        request *types.SignalWithStartWorkflowExecutionAsyncRequest,
469
        opts ...yarpc.CallOption,
NEW
470
) (*types.SignalWithStartWorkflowExecutionAsyncResponse, error) {
×
NEW
471

×
NEW
472
        ctx, cancel := c.createContext(ctx)
×
NEW
473
        defer cancel()
×
NEW
474
        return c.client.SignalWithStartWorkflowExecutionAsync(ctx, request, opts...)
×
NEW
475
}
×
476

477
func (c *clientImpl) SignalWorkflowExecution(
478
        ctx context.Context,
479
        request *types.SignalWorkflowExecutionRequest,
480
        opts ...yarpc.CallOption,
481
) error {
×
482

×
483
        ctx, cancel := c.createContext(ctx)
×
484
        defer cancel()
×
485
        return c.client.SignalWorkflowExecution(ctx, request, opts...)
×
486
}
×
487

488
func (c *clientImpl) createContext(parent context.Context) (context.Context, context.CancelFunc) {
×
489
        if parent == nil {
×
490
                return context.WithTimeout(context.Background(), c.timeout)
×
491
        }
×
492
        return context.WithTimeout(parent, c.timeout)
×
493
}
494

495
func (c *clientImpl) createLongPollContext(parent context.Context) (context.Context, context.CancelFunc) {
×
496
        if parent == nil {
×
497
                return context.WithTimeout(context.Background(), c.longPollTimeout)
×
498
        }
×
499
        return context.WithTimeout(parent, c.longPollTimeout)
×
500
}
501

502
func (c *clientImpl) StartWorkflowExecution(
503
        ctx context.Context,
504
        request *types.StartWorkflowExecutionRequest,
505
        opts ...yarpc.CallOption,
506
) (*types.StartWorkflowExecutionResponse, error) {
×
507

×
508
        ctx, cancel := c.createContext(ctx)
×
509
        defer cancel()
×
510
        return c.client.StartWorkflowExecution(ctx, request, opts...)
×
511
}
×
512

513
func (c *clientImpl) StartWorkflowExecutionAsync(
514
        ctx context.Context,
515
        request *types.StartWorkflowExecutionAsyncRequest,
516
        opts ...yarpc.CallOption,
517
) (*types.StartWorkflowExecutionAsyncResponse, error) {
×
518

×
519
        ctx, cancel := c.createContext(ctx)
×
520
        defer cancel()
×
521
        return c.client.StartWorkflowExecutionAsync(ctx, request, opts...)
×
522
}
×
523

524
func (c *clientImpl) TerminateWorkflowExecution(
525
        ctx context.Context,
526
        request *types.TerminateWorkflowExecutionRequest,
527
        opts ...yarpc.CallOption,
528
) error {
×
529

×
530
        ctx, cancel := c.createContext(ctx)
×
531
        defer cancel()
×
532
        return c.client.TerminateWorkflowExecution(ctx, request, opts...)
×
533
}
×
534

535
func (c *clientImpl) UpdateDomain(
536
        ctx context.Context,
537
        request *types.UpdateDomainRequest,
538
        opts ...yarpc.CallOption,
539
) (*types.UpdateDomainResponse, error) {
×
540

×
541
        ctx, cancel := c.createContext(ctx)
×
542
        defer cancel()
×
543
        return c.client.UpdateDomain(ctx, request, opts...)
×
544
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc