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

uber / cadence / 0187fdd2-f4a4-4c9a-97b4-6604937bf7be

09 May 2023 12:23AM UTC coverage: 57.253% (-0.002%) from 57.255%
0187fdd2-f4a4-4c9a-97b4-6604937bf7be

Pull #5252

buildkite

David Porter
Merge branch 'master' into feature/zonal-partitioning
Pull Request #5252: Feature/zonal partitioning

1460 of 1460 new or added lines in 51 files covered. (100.0%)

86909 of 151799 relevant lines covered (57.25%)

2482.17 hits per line

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

14.43
/client/admin/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 admin
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
        // DefaultLargeTimeout is the default timeout used to make calls
38
        DefaultLargeTimeout = time.Minute
39
)
40

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

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

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

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

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

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

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

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

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

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

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

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

115
func (c *clientImpl) ResetQueue(
116
        ctx context.Context,
117
        request *types.ResetQueueRequest,
118
        opts ...yarpc.CallOption,
119
) error {
×
120

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

126
func (c *clientImpl) DescribeQueue(
127
        ctx context.Context,
128
        request *types.DescribeQueueRequest,
129
        opts ...yarpc.CallOption,
130
) (*types.DescribeQueueResponse, error) {
×
131

×
132
        ctx, cancel := c.createContext(ctx)
×
133
        defer cancel()
×
134
        return c.client.DescribeQueue(ctx, request, opts...)
×
135
}
×
136

137
func (c *clientImpl) DescribeWorkflowExecution(
138
        ctx context.Context,
139
        request *types.AdminDescribeWorkflowExecutionRequest,
140
        opts ...yarpc.CallOption,
141
) (*types.AdminDescribeWorkflowExecutionResponse, error) {
×
142

×
143
        ctx, cancel := c.createContext(ctx)
×
144
        defer cancel()
×
145
        return c.client.DescribeWorkflowExecution(ctx, request, opts...)
×
146
}
×
147

148
func (c *clientImpl) GetWorkflowExecutionRawHistoryV2(
149
        ctx context.Context,
150
        request *types.GetWorkflowExecutionRawHistoryV2Request,
151
        opts ...yarpc.CallOption,
152
) (*types.GetWorkflowExecutionRawHistoryV2Response, error) {
×
153

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

159
func (c *clientImpl) DescribeCluster(
160
        ctx context.Context,
161
        opts ...yarpc.CallOption,
162
) (*types.DescribeClusterResponse, error) {
×
163
        ctx, cancel := c.createContext(ctx)
×
164
        defer cancel()
×
165
        return c.client.DescribeCluster(ctx, opts...)
×
166
}
×
167

168
func (c *clientImpl) GetReplicationMessages(
169
        ctx context.Context,
170
        request *types.GetReplicationMessagesRequest,
171
        opts ...yarpc.CallOption,
172
) (*types.GetReplicationMessagesResponse, error) {
42✔
173
        ctx, cancel := c.createContextWithLargeTimeout(ctx)
42✔
174
        defer cancel()
42✔
175
        return c.client.GetReplicationMessages(ctx, request, opts...)
42✔
176
}
42✔
177

178
func (c *clientImpl) GetDomainReplicationMessages(
179
        ctx context.Context,
180
        request *types.GetDomainReplicationMessagesRequest,
181
        opts ...yarpc.CallOption,
182
) (*types.GetDomainReplicationMessagesResponse, error) {
148✔
183
        ctx, cancel := c.createContext(ctx)
148✔
184
        defer cancel()
148✔
185
        return c.client.GetDomainReplicationMessages(ctx, request, opts...)
148✔
186
}
148✔
187

188
func (c *clientImpl) GetDLQReplicationMessages(
189
        ctx context.Context,
190
        request *types.GetDLQReplicationMessagesRequest,
191
        opts ...yarpc.CallOption,
192
) (*types.GetDLQReplicationMessagesResponse, error) {
×
193
        ctx, cancel := c.createContext(ctx)
×
194
        defer cancel()
×
195
        return c.client.GetDLQReplicationMessages(ctx, request, opts...)
×
196
}
×
197

198
func (c *clientImpl) ReapplyEvents(
199
        ctx context.Context,
200
        request *types.ReapplyEventsRequest,
201
        opts ...yarpc.CallOption,
202
) error {
×
203

×
204
        ctx, cancel := c.createContext(ctx)
×
205
        defer cancel()
×
206
        return c.client.ReapplyEvents(ctx, request, opts...)
×
207
}
×
208

209
func (c *clientImpl) CountDLQMessages(
210
        ctx context.Context,
211
        request *types.CountDLQMessagesRequest,
212
        opts ...yarpc.CallOption,
213
) (*types.CountDLQMessagesResponse, error) {
×
214

×
215
        ctx, cancel := c.createContext(ctx)
×
216
        defer cancel()
×
217
        return c.client.CountDLQMessages(ctx, request, opts...)
×
218
}
×
219

220
func (c *clientImpl) ReadDLQMessages(
221
        ctx context.Context,
222
        request *types.ReadDLQMessagesRequest,
223
        opts ...yarpc.CallOption,
224
) (*types.ReadDLQMessagesResponse, error) {
×
225

×
226
        ctx, cancel := c.createContext(ctx)
×
227
        defer cancel()
×
228
        return c.client.ReadDLQMessages(ctx, request, opts...)
×
229
}
×
230

231
func (c *clientImpl) PurgeDLQMessages(
232
        ctx context.Context,
233
        request *types.PurgeDLQMessagesRequest,
234
        opts ...yarpc.CallOption,
235
) error {
×
236

×
237
        ctx, cancel := c.createContext(ctx)
×
238
        defer cancel()
×
239
        return c.client.PurgeDLQMessages(ctx, request, opts...)
×
240
}
×
241

242
func (c *clientImpl) MergeDLQMessages(
243
        ctx context.Context,
244
        request *types.MergeDLQMessagesRequest,
245
        opts ...yarpc.CallOption,
246
) (*types.MergeDLQMessagesResponse, error) {
×
247

×
248
        ctx, cancel := c.createContext(ctx)
×
249
        defer cancel()
×
250
        return c.client.MergeDLQMessages(ctx, request, opts...)
×
251

×
252
}
×
253

254
func (c *clientImpl) RefreshWorkflowTasks(
255
        ctx context.Context,
256
        request *types.RefreshWorkflowTasksRequest,
257
        opts ...yarpc.CallOption,
258
) error {
×
259

×
260
        ctx, cancel := c.createContext(ctx)
×
261
        defer cancel()
×
262
        return c.client.RefreshWorkflowTasks(ctx, request, opts...)
×
263
}
×
264

265
func (c *clientImpl) ResendReplicationTasks(
266
        ctx context.Context,
267
        request *types.ResendReplicationTasksRequest,
268
        opts ...yarpc.CallOption,
269
) error {
×
270

×
271
        ctx, cancel := c.createContext(ctx)
×
272
        defer cancel()
×
273
        return c.client.ResendReplicationTasks(ctx, request, opts...)
×
274
}
×
275

276
func (c *clientImpl) GetCrossClusterTasks(
277
        ctx context.Context,
278
        request *types.GetCrossClusterTasksRequest,
279
        opts ...yarpc.CallOption,
280
) (*types.GetCrossClusterTasksResponse, error) {
72✔
281
        ctx, cancel := c.createContextWithLargeTimeout(ctx)
72✔
282
        defer cancel()
72✔
283
        return c.client.GetCrossClusterTasks(ctx, request, opts...)
72✔
284
}
72✔
285

286
func (c *clientImpl) RespondCrossClusterTasksCompleted(
287
        ctx context.Context,
288
        request *types.RespondCrossClusterTasksCompletedRequest,
289
        opts ...yarpc.CallOption,
290
) (*types.RespondCrossClusterTasksCompletedResponse, error) {
×
291
        ctx, cancel := c.createContext(ctx)
×
292
        defer cancel()
×
293
        return c.client.RespondCrossClusterTasksCompleted(ctx, request, opts...)
×
294
}
×
295

296
func (c *clientImpl) GetDynamicConfig(
297
        ctx context.Context,
298
        request *types.GetDynamicConfigRequest,
299
        opts ...yarpc.CallOption,
300
) (*types.GetDynamicConfigResponse, error) {
×
301
        ctx, cancel := c.createContext(ctx)
×
302
        defer cancel()
×
303
        return c.client.GetDynamicConfig(ctx, request, opts...)
×
304
}
×
305

306
func (c *clientImpl) UpdateDynamicConfig(
307
        ctx context.Context,
308
        request *types.UpdateDynamicConfigRequest,
309
        opts ...yarpc.CallOption,
310
) error {
×
311
        ctx, cancel := c.createContext(ctx)
×
312
        defer cancel()
×
313
        return c.client.UpdateDynamicConfig(ctx, request, opts...)
×
314
}
×
315

316
func (c *clientImpl) RestoreDynamicConfig(
317
        ctx context.Context,
318
        request *types.RestoreDynamicConfigRequest,
319
        opts ...yarpc.CallOption,
320
) error {
×
321
        ctx, cancel := c.createContext(ctx)
×
322
        defer cancel()
×
323
        return c.client.RestoreDynamicConfig(ctx, request, opts...)
×
324
}
×
325

326
func (c *clientImpl) DeleteWorkflow(
327
        ctx context.Context,
328
        request *types.AdminDeleteWorkflowRequest,
329
        opts ...yarpc.CallOption,
330
) (*types.AdminDeleteWorkflowResponse, error) {
×
331
        ctx, cancel := c.createContext(ctx)
×
332
        defer cancel()
×
333
        return c.client.DeleteWorkflow(ctx, request, opts...)
×
334
}
×
335

336
func (c *clientImpl) MaintainCorruptWorkflow(
337
        ctx context.Context,
338
        request *types.AdminMaintainWorkflowRequest,
339
        opts ...yarpc.CallOption,
340
) (*types.AdminMaintainWorkflowResponse, error) {
×
341
        ctx, cancel := c.createContext(ctx)
×
342
        defer cancel()
×
343
        return c.client.MaintainCorruptWorkflow(ctx, request, opts...)
×
344
}
×
345

346
func (c *clientImpl) ListDynamicConfig(
347
        ctx context.Context,
348
        request *types.ListDynamicConfigRequest,
349
        opts ...yarpc.CallOption,
350
) (*types.ListDynamicConfigResponse, error) {
×
351
        ctx, cancel := c.createContext(ctx)
×
352
        defer cancel()
×
353
        return c.client.ListDynamicConfig(ctx, request, opts...)
×
354
}
×
355

356
func (c *clientImpl) GetGlobalIsolationGroups(
357
        ctx context.Context,
358
        request *types.GetGlobalIsolationGroupsRequest,
359
        opts ...yarpc.CallOption) (*types.GetGlobalIsolationGroupsResponse, error) {
×
360
        ctx, cancel := c.createContext(ctx)
×
361
        defer cancel()
×
362
        return c.client.GetGlobalIsolationGroups(ctx, request, opts...)
×
363
}
×
364

365
func (c *clientImpl) UpdateGlobalIsolationGroups(
366
        ctx context.Context,
367
        request *types.UpdateGlobalIsolationGroupsRequest,
368
        opts ...yarpc.CallOption) (*types.UpdateGlobalIsolationGroupsResponse, error) {
×
369
        ctx, cancel := c.createContext(ctx)
×
370
        defer cancel()
×
371
        return c.client.UpdateGlobalIsolationGroups(ctx, request, opts...)
×
372
}
×
373

374
func (c *clientImpl) GetDomainIsolationGroups(
375
        ctx context.Context,
376
        request *types.GetDomainIsolationGroupsRequest,
377
        opts ...yarpc.CallOption) (*types.GetDomainIsolationGroupsResponse, error) {
×
378
        ctx, cancel := c.createContext(ctx)
×
379
        defer cancel()
×
380
        return c.client.GetDomainIsolationGroups(ctx, request, opts...)
×
381
}
×
382

383
func (c *clientImpl) UpdateDomainIsolationGroups(
384
        ctx context.Context,
385
        request *types.UpdateDomainIsolationGroupsRequest,
386
        opts ...yarpc.CallOption) (*types.UpdateDomainIsolationGroupsResponse, error) {
×
387
        ctx, cancel := c.createContext(ctx)
×
388
        defer cancel()
×
389
        return c.client.UpdateDomainIsolationGroups(ctx, request, opts...)
×
390
}
×
391

392
func (c *clientImpl) createContext(parent context.Context) (context.Context, context.CancelFunc) {
148✔
393
        if parent == nil {
148✔
394
                return context.WithTimeout(context.Background(), c.timeout)
×
395
        }
×
396
        return context.WithTimeout(parent, c.timeout)
148✔
397
}
398

399
func (c *clientImpl) createContextWithLargeTimeout(parent context.Context) (context.Context, context.CancelFunc) {
114✔
400
        if parent == nil {
114✔
401
                return context.WithTimeout(context.Background(), c.largeTimeout)
×
402
        }
×
403
        return context.WithTimeout(parent, c.largeTimeout)
114✔
404
}
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

© 2026 Coveralls, Inc