@temporalio/core-bridge 0.23.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.lock +118 -15
- package/Cargo.toml +2 -1
- package/LICENSE.md +1 -1
- package/README.md +1 -1
- package/index.d.ts +47 -18
- package/package.json +7 -7
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/releases/x86_64-apple-darwin/index.node +0 -0
- package/releases/x86_64-pc-windows-msvc/index.node +0 -0
- package/releases/x86_64-unknown-linux-gnu/index.node +0 -0
- package/sdk-core/.buildkite/docker/docker-compose.yaml +4 -2
- package/sdk-core/ARCHITECTURE.md +9 -7
- package/sdk-core/README.md +5 -1
- package/sdk-core/arch_docs/diagrams/workflow_internals.svg +1 -0
- package/sdk-core/bridge-ffi/src/wrappers.rs +0 -3
- package/sdk-core/client/src/lib.rs +26 -8
- package/sdk-core/client/src/raw.rs +166 -54
- package/sdk-core/client/src/retry.rs +9 -4
- package/sdk-core/client/src/workflow_handle/mod.rs +4 -2
- package/sdk-core/core/Cargo.toml +2 -0
- package/sdk-core/core/src/abstractions.rs +137 -16
- package/sdk-core/core/src/core_tests/activity_tasks.rs +258 -63
- package/sdk-core/core/src/core_tests/child_workflows.rs +1 -2
- package/sdk-core/core/src/core_tests/determinism.rs +2 -2
- package/sdk-core/core/src/core_tests/local_activities.rs +8 -7
- package/sdk-core/core/src/core_tests/queries.rs +146 -60
- package/sdk-core/core/src/core_tests/replay_flag.rs +1 -1
- package/sdk-core/core/src/core_tests/workers.rs +39 -23
- package/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +387 -280
- package/sdk-core/core/src/lib.rs +6 -4
- package/sdk-core/core/src/pollers/poll_buffer.rs +16 -10
- package/sdk-core/core/src/protosext/mod.rs +6 -6
- package/sdk-core/core/src/retry_logic.rs +1 -1
- package/sdk-core/core/src/telemetry/metrics.rs +21 -7
- package/sdk-core/core/src/telemetry/mod.rs +18 -4
- package/sdk-core/core/src/test_help/mod.rs +341 -109
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +18 -9
- package/sdk-core/core/src/worker/activities/local_activities.rs +19 -16
- package/sdk-core/core/src/worker/activities.rs +156 -29
- package/sdk-core/core/src/worker/client.rs +1 -0
- package/sdk-core/core/src/worker/mod.rs +132 -659
- package/sdk-core/core/src/{workflow → worker/workflow}/bridge.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/driven_workflow.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/history_update.rs +16 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/activity_state_machine.rs +39 -4
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_external_state_machine.rs +5 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/cancel_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/child_workflow_state_machine.rs +2 -4
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/complete_workflow_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/continue_as_new_workflow_state_machine.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/fail_workflow_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/local_activity_state_machine.rs +2 -5
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/mod.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/patch_state_machine.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/side_effect_state_machine.rs +0 -0
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/signal_external_state_machine.rs +4 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/timer_state_machine.rs +1 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/transition_coverage.rs +1 -1
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/upsert_search_attributes_state_machine.rs +5 -7
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines/local_acts.rs +2 -2
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_machines.rs +40 -16
- package/sdk-core/core/src/{workflow → worker/workflow}/machines/workflow_task_state_machine.rs +0 -0
- package/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +198 -0
- package/sdk-core/core/src/worker/workflow/managed_run.rs +627 -0
- package/sdk-core/core/src/worker/workflow/mod.rs +1115 -0
- package/sdk-core/core/src/worker/workflow/run_cache.rs +143 -0
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +88 -0
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +936 -0
- package/sdk-core/core-api/src/errors.rs +3 -10
- package/sdk-core/core-api/src/lib.rs +2 -1
- package/sdk-core/core-api/src/worker.rs +26 -2
- package/sdk-core/etc/dynamic-config.yaml +2 -0
- package/sdk-core/integ-with-otel.sh +1 -1
- package/sdk-core/protos/api_upstream/Makefile +4 -4
- package/sdk-core/protos/api_upstream/api-linter.yaml +2 -0
- package/sdk-core/protos/api_upstream/buf.yaml +8 -9
- package/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +83 -0
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +7 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +40 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +3 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +60 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +32 -4
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +69 -19
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +163 -0
- package/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +97 -0
- package/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +300 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +25 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +180 -3
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +53 -3
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +2 -2
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +6 -5
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -1
- package/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +2 -1
- package/sdk-core/protos/local/temporal/sdk/core/common/common.proto +0 -64
- package/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +2 -1
- package/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +11 -8
- package/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +30 -25
- package/sdk-core/sdk/src/activity_context.rs +12 -5
- package/sdk-core/sdk/src/app_data.rs +37 -0
- package/sdk-core/sdk/src/lib.rs +76 -43
- package/sdk-core/sdk/src/workflow_context/options.rs +8 -6
- package/sdk-core/sdk/src/workflow_context.rs +14 -19
- package/sdk-core/sdk/src/workflow_future.rs +11 -6
- package/sdk-core/sdk-core-protos/src/history_builder.rs +19 -5
- package/sdk-core/sdk-core-protos/src/history_info.rs +11 -6
- package/sdk-core/sdk-core-protos/src/lib.rs +74 -176
- package/sdk-core/test-utils/src/lib.rs +85 -72
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -9
- package/sdk-core/tests/integ_tests/polling_tests.rs +12 -0
- package/sdk-core/tests/integ_tests/queries_tests.rs +39 -22
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +49 -4
- package/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +61 -0
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +74 -13
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +19 -0
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -3
- package/sdk-core/tests/integ_tests/workflow_tests.rs +10 -23
- package/sdk-core/tests/load_tests.rs +8 -3
- package/sdk-core/tests/main.rs +2 -1
- package/src/conversions.rs +47 -39
- package/src/errors.rs +10 -21
- package/src/lib.rs +342 -325
- package/sdk-core/core/src/pending_activations.rs +0 -173
- package/sdk-core/core/src/worker/wft_delivery.rs +0 -81
- package/sdk-core/core/src/workflow/mod.rs +0 -478
- package/sdk-core/core/src/workflow/workflow_tasks/cache_manager.rs +0 -194
- package/sdk-core/core/src/workflow/workflow_tasks/concurrency_manager.rs +0 -418
- package/sdk-core/core/src/workflow/workflow_tasks/mod.rs +0 -989
|
@@ -157,7 +157,7 @@ impl AttachMetricLabels {
|
|
|
157
157
|
impl<RC, T> WorkflowService for RC
|
|
158
158
|
where
|
|
159
159
|
RC: RawClientLike<SvcType = T>,
|
|
160
|
-
T:
|
|
160
|
+
T: GrpcService<BoxBody> + Send + Clone + 'static,
|
|
161
161
|
T::ResponseBody: tonic::codegen::Body + Send + 'static,
|
|
162
162
|
T::Error: Into<tonic::codegen::StdError>,
|
|
163
163
|
T::Future: Send,
|
|
@@ -183,26 +183,37 @@ macro_rules! proxy {
|
|
|
183
183
|
}
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
+
macro_rules! proxier {
|
|
187
|
+
( $(($method:ident, $req:ident, $resp:ident $(, $closure:expr)? );)* ) => {
|
|
188
|
+
#[cfg(test)]
|
|
189
|
+
const ALL_IMPLEMENTED_RPCS: &'static [&'static str] = &[$(stringify!($method)),*];
|
|
190
|
+
/// Trait version of the generated workflow service client with modifications to attach appropriate
|
|
191
|
+
/// metric labels or whatever else to requests
|
|
192
|
+
pub trait WorkflowService: RawClientLike
|
|
193
|
+
where
|
|
194
|
+
// Yo this is wild
|
|
195
|
+
<Self as RawClientLike>::SvcType: GrpcService<BoxBody> + Send + Clone + 'static,
|
|
196
|
+
<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::ResponseBody:
|
|
197
|
+
tonic::codegen::Body + Send + 'static,
|
|
198
|
+
<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::Error:
|
|
199
|
+
Into<tonic::codegen::StdError>,
|
|
200
|
+
<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::Future: Send,
|
|
201
|
+
<<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::ResponseBody
|
|
202
|
+
as tonic::codegen::Body>::Error: Into<tonic::codegen::StdError> + Send,
|
|
203
|
+
{
|
|
204
|
+
$(
|
|
205
|
+
proxy!($method, $req, $resp $(,$closure)*);
|
|
206
|
+
)*
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
186
210
|
// Nice little trick to avoid the callsite asking to type the closure parameter
|
|
187
211
|
fn type_closure_arg<T, R>(arg: T, f: impl FnOnce(T) -> R) -> R {
|
|
188
212
|
f(arg)
|
|
189
213
|
}
|
|
190
214
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
pub trait WorkflowService: RawClientLike
|
|
194
|
-
where
|
|
195
|
-
// Yo this is wild
|
|
196
|
-
<Self as RawClientLike>::SvcType: GrpcService<BoxBody> + Send + Clone + 'static,
|
|
197
|
-
<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::ResponseBody:
|
|
198
|
-
tonic::codegen::Body + Send + 'static,
|
|
199
|
-
<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::Error:
|
|
200
|
-
Into<tonic::codegen::StdError>,
|
|
201
|
-
<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::Future: Send,
|
|
202
|
-
<<<Self as RawClientLike>::SvcType as GrpcService<BoxBody>>::ResponseBody as tonic::codegen::Body>::Error:
|
|
203
|
-
Into<tonic::codegen::StdError> + Send,
|
|
204
|
-
{
|
|
205
|
-
proxy!(
|
|
215
|
+
proxier! {
|
|
216
|
+
(
|
|
206
217
|
register_namespace,
|
|
207
218
|
RegisterNamespaceRequest,
|
|
208
219
|
RegisterNamespaceResponse,
|
|
@@ -211,7 +222,7 @@ where
|
|
|
211
222
|
r.extensions_mut().insert(labels);
|
|
212
223
|
}
|
|
213
224
|
);
|
|
214
|
-
|
|
225
|
+
(
|
|
215
226
|
describe_namespace,
|
|
216
227
|
DescribeNamespaceRequest,
|
|
217
228
|
DescribeNamespaceResponse,
|
|
@@ -220,12 +231,12 @@ where
|
|
|
220
231
|
r.extensions_mut().insert(labels);
|
|
221
232
|
}
|
|
222
233
|
);
|
|
223
|
-
|
|
234
|
+
(
|
|
224
235
|
list_namespaces,
|
|
225
236
|
ListNamespacesRequest,
|
|
226
237
|
ListNamespacesResponse
|
|
227
238
|
);
|
|
228
|
-
|
|
239
|
+
(
|
|
229
240
|
update_namespace,
|
|
230
241
|
UpdateNamespaceRequest,
|
|
231
242
|
UpdateNamespaceResponse,
|
|
@@ -234,7 +245,7 @@ where
|
|
|
234
245
|
r.extensions_mut().insert(labels);
|
|
235
246
|
}
|
|
236
247
|
);
|
|
237
|
-
|
|
248
|
+
(
|
|
238
249
|
deprecate_namespace,
|
|
239
250
|
DeprecateNamespaceRequest,
|
|
240
251
|
DeprecateNamespaceResponse,
|
|
@@ -243,7 +254,7 @@ where
|
|
|
243
254
|
r.extensions_mut().insert(labels);
|
|
244
255
|
}
|
|
245
256
|
);
|
|
246
|
-
|
|
257
|
+
(
|
|
247
258
|
start_workflow_execution,
|
|
248
259
|
StartWorkflowExecutionRequest,
|
|
249
260
|
StartWorkflowExecutionResponse,
|
|
@@ -253,7 +264,7 @@ where
|
|
|
253
264
|
r.extensions_mut().insert(labels);
|
|
254
265
|
}
|
|
255
266
|
);
|
|
256
|
-
|
|
267
|
+
(
|
|
257
268
|
get_workflow_execution_history,
|
|
258
269
|
GetWorkflowExecutionHistoryRequest,
|
|
259
270
|
GetWorkflowExecutionHistoryResponse,
|
|
@@ -262,7 +273,16 @@ where
|
|
|
262
273
|
r.extensions_mut().insert(labels);
|
|
263
274
|
}
|
|
264
275
|
);
|
|
265
|
-
|
|
276
|
+
(
|
|
277
|
+
get_workflow_execution_history_reverse,
|
|
278
|
+
GetWorkflowExecutionHistoryReverseRequest,
|
|
279
|
+
GetWorkflowExecutionHistoryReverseResponse,
|
|
280
|
+
|r| {
|
|
281
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
282
|
+
r.extensions_mut().insert(labels);
|
|
283
|
+
}
|
|
284
|
+
);
|
|
285
|
+
(
|
|
266
286
|
poll_workflow_task_queue,
|
|
267
287
|
PollWorkflowTaskQueueRequest,
|
|
268
288
|
PollWorkflowTaskQueueResponse,
|
|
@@ -273,7 +293,7 @@ where
|
|
|
273
293
|
r.set_timeout(LONG_POLL_TIMEOUT);
|
|
274
294
|
}
|
|
275
295
|
);
|
|
276
|
-
|
|
296
|
+
(
|
|
277
297
|
respond_workflow_task_completed,
|
|
278
298
|
RespondWorkflowTaskCompletedRequest,
|
|
279
299
|
RespondWorkflowTaskCompletedResponse,
|
|
@@ -282,7 +302,7 @@ where
|
|
|
282
302
|
r.extensions_mut().insert(labels);
|
|
283
303
|
}
|
|
284
304
|
);
|
|
285
|
-
|
|
305
|
+
(
|
|
286
306
|
respond_workflow_task_failed,
|
|
287
307
|
RespondWorkflowTaskFailedRequest,
|
|
288
308
|
RespondWorkflowTaskFailedResponse,
|
|
@@ -291,7 +311,7 @@ where
|
|
|
291
311
|
r.extensions_mut().insert(labels);
|
|
292
312
|
}
|
|
293
313
|
);
|
|
294
|
-
|
|
314
|
+
(
|
|
295
315
|
poll_activity_task_queue,
|
|
296
316
|
PollActivityTaskQueueRequest,
|
|
297
317
|
PollActivityTaskQueueResponse,
|
|
@@ -302,7 +322,7 @@ where
|
|
|
302
322
|
r.set_timeout(LONG_POLL_TIMEOUT);
|
|
303
323
|
}
|
|
304
324
|
);
|
|
305
|
-
|
|
325
|
+
(
|
|
306
326
|
record_activity_task_heartbeat,
|
|
307
327
|
RecordActivityTaskHeartbeatRequest,
|
|
308
328
|
RecordActivityTaskHeartbeatResponse,
|
|
@@ -311,7 +331,7 @@ where
|
|
|
311
331
|
r.extensions_mut().insert(labels);
|
|
312
332
|
}
|
|
313
333
|
);
|
|
314
|
-
|
|
334
|
+
(
|
|
315
335
|
record_activity_task_heartbeat_by_id,
|
|
316
336
|
RecordActivityTaskHeartbeatByIdRequest,
|
|
317
337
|
RecordActivityTaskHeartbeatByIdResponse,
|
|
@@ -320,7 +340,7 @@ where
|
|
|
320
340
|
r.extensions_mut().insert(labels);
|
|
321
341
|
}
|
|
322
342
|
);
|
|
323
|
-
|
|
343
|
+
(
|
|
324
344
|
respond_activity_task_completed,
|
|
325
345
|
RespondActivityTaskCompletedRequest,
|
|
326
346
|
RespondActivityTaskCompletedResponse,
|
|
@@ -329,7 +349,7 @@ where
|
|
|
329
349
|
r.extensions_mut().insert(labels);
|
|
330
350
|
}
|
|
331
351
|
);
|
|
332
|
-
|
|
352
|
+
(
|
|
333
353
|
respond_activity_task_completed_by_id,
|
|
334
354
|
RespondActivityTaskCompletedByIdRequest,
|
|
335
355
|
RespondActivityTaskCompletedByIdResponse,
|
|
@@ -339,7 +359,7 @@ where
|
|
|
339
359
|
}
|
|
340
360
|
);
|
|
341
361
|
|
|
342
|
-
|
|
362
|
+
(
|
|
343
363
|
respond_activity_task_failed,
|
|
344
364
|
RespondActivityTaskFailedRequest,
|
|
345
365
|
RespondActivityTaskFailedResponse,
|
|
@@ -348,7 +368,7 @@ where
|
|
|
348
368
|
r.extensions_mut().insert(labels);
|
|
349
369
|
}
|
|
350
370
|
);
|
|
351
|
-
|
|
371
|
+
(
|
|
352
372
|
respond_activity_task_failed_by_id,
|
|
353
373
|
RespondActivityTaskFailedByIdRequest,
|
|
354
374
|
RespondActivityTaskFailedByIdResponse,
|
|
@@ -357,7 +377,7 @@ where
|
|
|
357
377
|
r.extensions_mut().insert(labels);
|
|
358
378
|
}
|
|
359
379
|
);
|
|
360
|
-
|
|
380
|
+
(
|
|
361
381
|
respond_activity_task_canceled,
|
|
362
382
|
RespondActivityTaskCanceledRequest,
|
|
363
383
|
RespondActivityTaskCanceledResponse,
|
|
@@ -366,7 +386,7 @@ where
|
|
|
366
386
|
r.extensions_mut().insert(labels);
|
|
367
387
|
}
|
|
368
388
|
);
|
|
369
|
-
|
|
389
|
+
(
|
|
370
390
|
respond_activity_task_canceled_by_id,
|
|
371
391
|
RespondActivityTaskCanceledByIdRequest,
|
|
372
392
|
RespondActivityTaskCanceledByIdResponse,
|
|
@@ -375,7 +395,7 @@ where
|
|
|
375
395
|
r.extensions_mut().insert(labels);
|
|
376
396
|
}
|
|
377
397
|
);
|
|
378
|
-
|
|
398
|
+
(
|
|
379
399
|
request_cancel_workflow_execution,
|
|
380
400
|
RequestCancelWorkflowExecutionRequest,
|
|
381
401
|
RequestCancelWorkflowExecutionResponse,
|
|
@@ -384,7 +404,7 @@ where
|
|
|
384
404
|
r.extensions_mut().insert(labels);
|
|
385
405
|
}
|
|
386
406
|
);
|
|
387
|
-
|
|
407
|
+
(
|
|
388
408
|
signal_workflow_execution,
|
|
389
409
|
SignalWorkflowExecutionRequest,
|
|
390
410
|
SignalWorkflowExecutionResponse,
|
|
@@ -393,7 +413,7 @@ where
|
|
|
393
413
|
r.extensions_mut().insert(labels);
|
|
394
414
|
}
|
|
395
415
|
);
|
|
396
|
-
|
|
416
|
+
(
|
|
397
417
|
signal_with_start_workflow_execution,
|
|
398
418
|
SignalWithStartWorkflowExecutionRequest,
|
|
399
419
|
SignalWithStartWorkflowExecutionResponse,
|
|
@@ -403,7 +423,7 @@ where
|
|
|
403
423
|
r.extensions_mut().insert(labels);
|
|
404
424
|
}
|
|
405
425
|
);
|
|
406
|
-
|
|
426
|
+
(
|
|
407
427
|
reset_workflow_execution,
|
|
408
428
|
ResetWorkflowExecutionRequest,
|
|
409
429
|
ResetWorkflowExecutionResponse,
|
|
@@ -412,7 +432,7 @@ where
|
|
|
412
432
|
r.extensions_mut().insert(labels);
|
|
413
433
|
}
|
|
414
434
|
);
|
|
415
|
-
|
|
435
|
+
(
|
|
416
436
|
terminate_workflow_execution,
|
|
417
437
|
TerminateWorkflowExecutionRequest,
|
|
418
438
|
TerminateWorkflowExecutionResponse,
|
|
@@ -421,7 +441,7 @@ where
|
|
|
421
441
|
r.extensions_mut().insert(labels);
|
|
422
442
|
}
|
|
423
443
|
);
|
|
424
|
-
|
|
444
|
+
(
|
|
425
445
|
list_open_workflow_executions,
|
|
426
446
|
ListOpenWorkflowExecutionsRequest,
|
|
427
447
|
ListOpenWorkflowExecutionsResponse,
|
|
@@ -430,7 +450,7 @@ where
|
|
|
430
450
|
r.extensions_mut().insert(labels);
|
|
431
451
|
}
|
|
432
452
|
);
|
|
433
|
-
|
|
453
|
+
(
|
|
434
454
|
list_closed_workflow_executions,
|
|
435
455
|
ListClosedWorkflowExecutionsRequest,
|
|
436
456
|
ListClosedWorkflowExecutionsResponse,
|
|
@@ -439,7 +459,7 @@ where
|
|
|
439
459
|
r.extensions_mut().insert(labels);
|
|
440
460
|
}
|
|
441
461
|
);
|
|
442
|
-
|
|
462
|
+
(
|
|
443
463
|
list_workflow_executions,
|
|
444
464
|
ListWorkflowExecutionsRequest,
|
|
445
465
|
ListWorkflowExecutionsResponse,
|
|
@@ -448,7 +468,7 @@ where
|
|
|
448
468
|
r.extensions_mut().insert(labels);
|
|
449
469
|
}
|
|
450
470
|
);
|
|
451
|
-
|
|
471
|
+
(
|
|
452
472
|
list_archived_workflow_executions,
|
|
453
473
|
ListArchivedWorkflowExecutionsRequest,
|
|
454
474
|
ListArchivedWorkflowExecutionsResponse,
|
|
@@ -457,7 +477,7 @@ where
|
|
|
457
477
|
r.extensions_mut().insert(labels);
|
|
458
478
|
}
|
|
459
479
|
);
|
|
460
|
-
|
|
480
|
+
(
|
|
461
481
|
scan_workflow_executions,
|
|
462
482
|
ScanWorkflowExecutionsRequest,
|
|
463
483
|
ScanWorkflowExecutionsResponse,
|
|
@@ -466,7 +486,7 @@ where
|
|
|
466
486
|
r.extensions_mut().insert(labels);
|
|
467
487
|
}
|
|
468
488
|
);
|
|
469
|
-
|
|
489
|
+
(
|
|
470
490
|
count_workflow_executions,
|
|
471
491
|
CountWorkflowExecutionsRequest,
|
|
472
492
|
CountWorkflowExecutionsResponse,
|
|
@@ -475,12 +495,12 @@ where
|
|
|
475
495
|
r.extensions_mut().insert(labels);
|
|
476
496
|
}
|
|
477
497
|
);
|
|
478
|
-
|
|
498
|
+
(
|
|
479
499
|
get_search_attributes,
|
|
480
500
|
GetSearchAttributesRequest,
|
|
481
501
|
GetSearchAttributesResponse
|
|
482
502
|
);
|
|
483
|
-
|
|
503
|
+
(
|
|
484
504
|
respond_query_task_completed,
|
|
485
505
|
RespondQueryTaskCompletedRequest,
|
|
486
506
|
RespondQueryTaskCompletedResponse,
|
|
@@ -489,7 +509,7 @@ where
|
|
|
489
509
|
r.extensions_mut().insert(labels);
|
|
490
510
|
}
|
|
491
511
|
);
|
|
492
|
-
|
|
512
|
+
(
|
|
493
513
|
reset_sticky_task_queue,
|
|
494
514
|
ResetStickyTaskQueueRequest,
|
|
495
515
|
ResetStickyTaskQueueResponse,
|
|
@@ -498,7 +518,7 @@ where
|
|
|
498
518
|
r.extensions_mut().insert(labels);
|
|
499
519
|
}
|
|
500
520
|
);
|
|
501
|
-
|
|
521
|
+
(
|
|
502
522
|
query_workflow,
|
|
503
523
|
QueryWorkflowRequest,
|
|
504
524
|
QueryWorkflowResponse,
|
|
@@ -507,7 +527,7 @@ where
|
|
|
507
527
|
r.extensions_mut().insert(labels);
|
|
508
528
|
}
|
|
509
529
|
);
|
|
510
|
-
|
|
530
|
+
(
|
|
511
531
|
describe_workflow_execution,
|
|
512
532
|
DescribeWorkflowExecutionRequest,
|
|
513
533
|
DescribeWorkflowExecutionResponse,
|
|
@@ -516,7 +536,7 @@ where
|
|
|
516
536
|
r.extensions_mut().insert(labels);
|
|
517
537
|
}
|
|
518
538
|
);
|
|
519
|
-
|
|
539
|
+
(
|
|
520
540
|
describe_task_queue,
|
|
521
541
|
DescribeTaskQueueRequest,
|
|
522
542
|
DescribeTaskQueueResponse,
|
|
@@ -526,17 +546,17 @@ where
|
|
|
526
546
|
r.extensions_mut().insert(labels);
|
|
527
547
|
}
|
|
528
548
|
);
|
|
529
|
-
|
|
549
|
+
(
|
|
530
550
|
get_cluster_info,
|
|
531
551
|
GetClusterInfoRequest,
|
|
532
552
|
GetClusterInfoResponse
|
|
533
553
|
);
|
|
534
|
-
|
|
554
|
+
(
|
|
535
555
|
get_system_info,
|
|
536
556
|
GetSystemInfoRequest,
|
|
537
557
|
GetSystemInfoResponse
|
|
538
558
|
);
|
|
539
|
-
|
|
559
|
+
(
|
|
540
560
|
list_task_queue_partitions,
|
|
541
561
|
ListTaskQueuePartitionsRequest,
|
|
542
562
|
ListTaskQueuePartitionsResponse,
|
|
@@ -546,12 +566,76 @@ where
|
|
|
546
566
|
r.extensions_mut().insert(labels);
|
|
547
567
|
}
|
|
548
568
|
);
|
|
569
|
+
(
|
|
570
|
+
create_schedule,
|
|
571
|
+
CreateScheduleRequest,
|
|
572
|
+
CreateScheduleResponse,
|
|
573
|
+
|r| {
|
|
574
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
575
|
+
r.extensions_mut().insert(labels);
|
|
576
|
+
}
|
|
577
|
+
);
|
|
578
|
+
(
|
|
579
|
+
describe_schedule,
|
|
580
|
+
DescribeScheduleRequest,
|
|
581
|
+
DescribeScheduleResponse,
|
|
582
|
+
|r| {
|
|
583
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
584
|
+
r.extensions_mut().insert(labels);
|
|
585
|
+
}
|
|
586
|
+
);
|
|
587
|
+
(
|
|
588
|
+
update_schedule,
|
|
589
|
+
UpdateScheduleRequest,
|
|
590
|
+
UpdateScheduleResponse,
|
|
591
|
+
|r| {
|
|
592
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
593
|
+
r.extensions_mut().insert(labels);
|
|
594
|
+
}
|
|
595
|
+
);
|
|
596
|
+
(
|
|
597
|
+
patch_schedule,
|
|
598
|
+
PatchScheduleRequest,
|
|
599
|
+
PatchScheduleResponse,
|
|
600
|
+
|r| {
|
|
601
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
602
|
+
r.extensions_mut().insert(labels);
|
|
603
|
+
}
|
|
604
|
+
);
|
|
605
|
+
(
|
|
606
|
+
list_schedule_matching_times,
|
|
607
|
+
ListScheduleMatchingTimesRequest,
|
|
608
|
+
ListScheduleMatchingTimesResponse,
|
|
609
|
+
|r| {
|
|
610
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
611
|
+
r.extensions_mut().insert(labels);
|
|
612
|
+
}
|
|
613
|
+
);
|
|
614
|
+
(
|
|
615
|
+
delete_schedule,
|
|
616
|
+
DeleteScheduleRequest,
|
|
617
|
+
DeleteScheduleResponse,
|
|
618
|
+
|r| {
|
|
619
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
620
|
+
r.extensions_mut().insert(labels);
|
|
621
|
+
}
|
|
622
|
+
);
|
|
623
|
+
(
|
|
624
|
+
list_schedules,
|
|
625
|
+
ListSchedulesRequest,
|
|
626
|
+
ListSchedulesResponse,
|
|
627
|
+
|r| {
|
|
628
|
+
let labels = AttachMetricLabels::namespace(r.get_ref().namespace.clone());
|
|
629
|
+
r.extensions_mut().insert(labels);
|
|
630
|
+
}
|
|
631
|
+
);
|
|
549
632
|
}
|
|
550
633
|
|
|
551
634
|
#[cfg(test)]
|
|
552
635
|
mod tests {
|
|
553
636
|
use super::*;
|
|
554
637
|
use crate::{ClientOptionsBuilder, RetryClient, WorkflowServiceClientWithMetrics};
|
|
638
|
+
use std::collections::HashSet;
|
|
555
639
|
use temporal_sdk_core_protos::temporal::api::workflowservice::v1::ListNamespacesRequest;
|
|
556
640
|
|
|
557
641
|
// Just to help make sure some stuff compiles. Not run.
|
|
@@ -571,4 +655,32 @@ mod tests {
|
|
|
571
655
|
.await
|
|
572
656
|
.unwrap();
|
|
573
657
|
}
|
|
658
|
+
|
|
659
|
+
#[test]
|
|
660
|
+
fn verify_all_methods_implemented() {
|
|
661
|
+
// This is less work than trying to hook into the codegen process
|
|
662
|
+
let proto_def =
|
|
663
|
+
include_str!("../../protos/api_upstream/temporal/api/workflowservice/v1/service.proto");
|
|
664
|
+
let methods: Vec<_> = proto_def
|
|
665
|
+
.lines()
|
|
666
|
+
.map(|l| l.trim())
|
|
667
|
+
.filter(|l| l.starts_with("rpc"))
|
|
668
|
+
.map(|l| {
|
|
669
|
+
let stripped = l.strip_prefix("rpc ").unwrap();
|
|
670
|
+
(&stripped[..stripped.find('(').unwrap()]).trim()
|
|
671
|
+
})
|
|
672
|
+
.collect();
|
|
673
|
+
let no_underscores: HashSet<_> = ALL_IMPLEMENTED_RPCS
|
|
674
|
+
.iter()
|
|
675
|
+
.map(|x| x.replace('_', ""))
|
|
676
|
+
.collect();
|
|
677
|
+
for method in methods {
|
|
678
|
+
if !no_underscores.contains(&method.to_lowercase()) {
|
|
679
|
+
panic!(
|
|
680
|
+
"WorkflowService RPC method {} is not implemented by raw client",
|
|
681
|
+
method
|
|
682
|
+
)
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
}
|
|
574
686
|
}
|
|
@@ -6,10 +6,13 @@ use backoff::{backoff::Backoff, ExponentialBackoff};
|
|
|
6
6
|
use futures_retry::{ErrorHandler, FutureRetry, RetryPolicy};
|
|
7
7
|
use std::{fmt::Debug, future::Future, time::Duration};
|
|
8
8
|
use temporal_sdk_core_protos::{
|
|
9
|
-
coresdk::
|
|
9
|
+
coresdk::workflow_commands::QueryResult,
|
|
10
10
|
temporal::api::{
|
|
11
|
-
common::v1::
|
|
12
|
-
|
|
11
|
+
common::v1::{Payload, Payloads},
|
|
12
|
+
enums::v1::WorkflowTaskFailedCause,
|
|
13
|
+
failure::v1::Failure,
|
|
14
|
+
query::v1::WorkflowQuery,
|
|
15
|
+
workflowservice::v1::*,
|
|
13
16
|
},
|
|
14
17
|
TaskToken,
|
|
15
18
|
};
|
|
@@ -403,12 +406,14 @@ where
|
|
|
403
406
|
&self,
|
|
404
407
|
workflow_id: String,
|
|
405
408
|
run_id: Option<String>,
|
|
409
|
+
reason: String,
|
|
406
410
|
) -> Result<RequestCancelWorkflowExecutionResponse> {
|
|
407
411
|
retry_call!(
|
|
408
412
|
self,
|
|
409
413
|
cancel_workflow_execution,
|
|
410
414
|
workflow_id.clone(),
|
|
411
|
-
run_id.clone()
|
|
415
|
+
run_id.clone(),
|
|
416
|
+
reason.clone()
|
|
412
417
|
)
|
|
413
418
|
}
|
|
414
419
|
|
|
@@ -2,9 +2,11 @@ use crate::{InterceptedMetricsSvc, RawClientLike};
|
|
|
2
2
|
use anyhow::{anyhow, bail};
|
|
3
3
|
use std::marker::PhantomData;
|
|
4
4
|
use temporal_sdk_core_protos::{
|
|
5
|
-
coresdk::
|
|
5
|
+
coresdk::FromPayloadsExt,
|
|
6
6
|
temporal::api::{
|
|
7
|
-
common::v1::
|
|
7
|
+
common::v1::{Payload, WorkflowExecution},
|
|
8
|
+
enums::v1::HistoryEventFilterType,
|
|
9
|
+
failure::v1::Failure,
|
|
8
10
|
history::v1::history_event::Attributes,
|
|
9
11
|
workflowservice::v1::GetWorkflowExecutionHistoryRequest,
|
|
10
12
|
},
|
package/sdk-core/core/Cargo.toml
CHANGED
|
@@ -15,6 +15,7 @@ categories = ["development-tools"]
|
|
|
15
15
|
[dependencies]
|
|
16
16
|
anyhow = "1.0"
|
|
17
17
|
arc-swap = "1.3"
|
|
18
|
+
async-channel = "1.6"
|
|
18
19
|
async-trait = "0.1"
|
|
19
20
|
base64 = "0.13"
|
|
20
21
|
crossbeam = "0.8"
|
|
@@ -23,6 +24,7 @@ derive_builder = "0.11"
|
|
|
23
24
|
derive_more = "0.99"
|
|
24
25
|
enum_dispatch = "0.3"
|
|
25
26
|
futures = "0.3"
|
|
27
|
+
governor = "0.4"
|
|
26
28
|
http = "0.2"
|
|
27
29
|
hyper = "0.14"
|
|
28
30
|
itertools = "0.10"
|