@temporalio/core-bridge 1.11.7 → 1.11.8
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 +504 -341
- package/package.json +3 -3
- 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/.cargo/config.toml +5 -0
- package/sdk-core/.github/workflows/per-pr.yml +59 -5
- package/sdk-core/Cargo.toml +3 -2
- package/sdk-core/client/Cargo.toml +3 -3
- package/sdk-core/client/src/lib.rs +154 -161
- package/sdk-core/client/src/metrics.rs +15 -8
- package/sdk-core/client/src/proxy.rs +1 -1
- package/sdk-core/client/src/raw.rs +176 -33
- package/sdk-core/client/src/retry.rs +102 -465
- package/sdk-core/client/src/worker_registry/mod.rs +2 -2
- package/sdk-core/client/src/workflow_handle/mod.rs +19 -1
- package/sdk-core/core/Cargo.toml +12 -14
- package/sdk-core/core/benches/workflow_replay.rs +1 -1
- package/sdk-core/core/src/abstractions.rs +2 -2
- package/sdk-core/core/src/core_tests/activity_tasks.rs +99 -46
- package/sdk-core/core/src/core_tests/child_workflows.rs +68 -9
- package/sdk-core/core/src/core_tests/determinism.rs +2 -2
- package/sdk-core/core/src/core_tests/local_activities.rs +20 -33
- package/sdk-core/core/src/core_tests/mod.rs +7 -8
- package/sdk-core/core/src/core_tests/queries.rs +79 -79
- package/sdk-core/core/src/core_tests/replay_flag.rs +5 -5
- package/sdk-core/core/src/core_tests/updates.rs +6 -6
- package/sdk-core/core/src/core_tests/workers.rs +19 -22
- package/sdk-core/core/src/core_tests/workflow_cancels.rs +3 -3
- package/sdk-core/core/src/core_tests/workflow_tasks.rs +154 -106
- package/sdk-core/core/src/ephemeral_server/mod.rs +66 -10
- package/sdk-core/core/src/internal_flags.rs +103 -12
- package/sdk-core/core/src/lib.rs +21 -13
- package/sdk-core/core/src/pollers/mod.rs +200 -6
- package/sdk-core/core/src/pollers/poll_buffer.rs +32 -8
- package/sdk-core/core/src/protosext/mod.rs +7 -7
- package/sdk-core/core/src/protosext/protocol_messages.rs +2 -2
- package/sdk-core/core/src/replay/mod.rs +8 -9
- package/sdk-core/core/src/retry_logic.rs +8 -6
- package/sdk-core/core/src/telemetry/log_export.rs +4 -4
- package/sdk-core/core/src/telemetry/metrics.rs +111 -25
- package/sdk-core/core/src/telemetry/mod.rs +11 -4
- package/sdk-core/core/src/telemetry/otel.rs +108 -144
- package/sdk-core/core/src/telemetry/prometheus_server.rs +1 -4
- package/sdk-core/core/src/test_help/mod.rs +27 -21
- package/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +7 -5
- package/sdk-core/core/src/worker/activities/local_activities.rs +9 -9
- package/sdk-core/core/src/worker/activities.rs +34 -46
- package/sdk-core/core/src/worker/client/mocks.rs +24 -2
- package/sdk-core/core/src/worker/client.rs +169 -33
- package/sdk-core/core/src/worker/mod.rs +132 -56
- package/sdk-core/core/src/worker/nexus.rs +410 -0
- package/sdk-core/core/src/worker/tuner/resource_based.rs +27 -5
- package/sdk-core/core/src/worker/tuner.rs +29 -2
- package/sdk-core/core/src/worker/workflow/driven_workflow.rs +8 -3
- package/sdk-core/core/src/worker/workflow/history_update.rs +5 -8
- package/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +83 -87
- package/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +38 -38
- package/sdk-core/core/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +117 -0
- package/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +8 -18
- package/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +114 -108
- package/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +16 -31
- package/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +7 -14
- package/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +8 -15
- package/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +34 -75
- package/sdk-core/core/src/worker/workflow/machines/mod.rs +26 -48
- package/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +10 -17
- package/sdk-core/core/src/worker/workflow/machines/nexus_operation_state_machine.rs +543 -0
- package/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +22 -31
- package/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +53 -51
- package/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +40 -45
- package/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +2 -2
- package/sdk-core/core/src/worker/workflow/machines/update_state_machine.rs +8 -10
- package/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +24 -30
- package/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +182 -116
- package/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +4 -8
- package/sdk-core/core/src/worker/workflow/managed_run.rs +75 -45
- package/sdk-core/core/src/worker/workflow/mod.rs +104 -55
- package/sdk-core/core/src/worker/workflow/run_cache.rs +23 -4
- package/sdk-core/core/src/worker/workflow/wft_extraction.rs +4 -4
- package/sdk-core/core/src/worker/workflow/wft_poller.rs +3 -3
- package/sdk-core/core/src/worker/workflow/workflow_stream.rs +32 -13
- package/sdk-core/core-api/Cargo.toml +2 -3
- package/sdk-core/core-api/src/errors.rs +22 -20
- package/sdk-core/core-api/src/lib.rs +24 -5
- package/sdk-core/core-api/src/telemetry/metrics.rs +27 -1
- package/sdk-core/core-api/src/telemetry.rs +37 -3
- package/sdk-core/core-api/src/worker.rs +36 -3
- package/sdk-core/docker/docker-compose-ci.yaml +25 -0
- package/sdk-core/etc/otel-collector-ci.yaml +36 -0
- package/sdk-core/etc/otel-collector-config.yaml +3 -3
- package/sdk-core/etc/prometheus.yaml +1 -1
- package/sdk-core/fsm/Cargo.toml +1 -1
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +1 -1
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +3 -4
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +1 -1
- package/sdk-core/sdk/Cargo.toml +1 -2
- package/sdk-core/sdk/src/activity_context.rs +1 -1
- package/sdk-core/sdk/src/interceptors.rs +1 -1
- package/sdk-core/sdk/src/lib.rs +126 -54
- package/sdk-core/sdk/src/workflow_context/options.rs +184 -74
- package/sdk-core/sdk/src/workflow_context.rs +193 -79
- package/sdk-core/sdk/src/workflow_future.rs +151 -131
- package/sdk-core/sdk-core-protos/Cargo.toml +3 -4
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +1 -1
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +46 -0
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +254 -5
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +108 -2
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +94 -15
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +102 -4
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +84 -0
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +25 -10
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +14 -1
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +25 -0
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +41 -0
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +59 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/create-release.yml +135 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/push-to-buf.yml +20 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +13 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +13 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +13 -21
- package/sdk-core/sdk-core-protos/protos/api_upstream/Makefile +2 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/buf.yaml +1 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv2.json +3386 -1047
- package/sdk-core/sdk-core-protos/protos/api_upstream/openapi/openapiv3.yaml +3529 -1144
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/batch/v1/message.proto +39 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/command/v1/message.proto +6 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/common/v1/message.proto +39 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/deployment/v1/message.proto +252 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +1 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/common.proto +6 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/deployment.proto +96 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/event_type.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/nexus.proto +42 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/enums/v1/workflow.proto +43 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/errordetails/v1/message.proto +13 -1
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/failure/v1/message.proto +14 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/history/v1/message.proto +70 -12
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/nexus/v1/message.proto +12 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/query/v1/message.proto +9 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +46 -2
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflow/v1/message.proto +206 -0
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +482 -97
- package/sdk-core/sdk-core-protos/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +230 -43
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/core_interface.proto +6 -0
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/nexus/nexus.proto +71 -0
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +46 -2
- package/sdk-core/sdk-core-protos/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +55 -9
- package/sdk-core/sdk-core-protos/src/history_builder.rs +5 -5
- package/sdk-core/sdk-core-protos/src/history_info.rs +5 -6
- package/sdk-core/sdk-core-protos/src/lib.rs +414 -34
- package/sdk-core/sdk-core-protos/src/task_token.rs +1 -1
- package/sdk-core/test-utils/Cargo.toml +3 -11
- package/sdk-core/test-utils/src/canned_histories.rs +1 -1
- package/sdk-core/test-utils/src/lib.rs +159 -85
- package/sdk-core/tests/fuzzy_workflow.rs +3 -3
- package/sdk-core/tests/heavy_tests.rs +3 -3
- package/sdk-core/tests/integ_tests/client_tests.rs +171 -20
- package/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +45 -39
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +7 -6
- package/sdk-core/tests/integ_tests/metrics_tests.rs +492 -35
- package/sdk-core/tests/integ_tests/polling_tests.rs +7 -5
- package/sdk-core/tests/integ_tests/queries_tests.rs +14 -17
- package/sdk-core/tests/integ_tests/update_tests.rs +47 -44
- package/sdk-core/tests/integ_tests/visibility_tests.rs +4 -3
- package/sdk-core/tests/integ_tests/worker_tests.rs +5 -5
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +15 -13
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +28 -14
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +7 -1
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +57 -4
- package/sdk-core/tests/integ_tests/workflow_tests/eager.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +24 -18
- package/sdk-core/tests/integ_tests/workflow_tests/nexus.rs +506 -0
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/priority.rs +104 -0
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +34 -31
- package/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -1
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -7
- package/sdk-core/tests/integ_tests/workflow_tests.rs +152 -116
- package/sdk-core/tests/main.rs +36 -6
- package/sdk-core/tests/runner.rs +30 -9
- package/src/conversions/slot_supplier_bridge.rs +4 -0
- package/src/conversions.rs +1 -0
- package/src/worker.rs +5 -7
- package/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +0 -78
|
@@ -1,27 +1,25 @@
|
|
|
1
1
|
use std::{collections::HashMap, time::Duration};
|
|
2
2
|
|
|
3
|
-
use temporal_client::WorkflowOptions;
|
|
3
|
+
use temporal_client::{Priority, WorkflowOptions};
|
|
4
4
|
use temporal_sdk_core_protos::{
|
|
5
5
|
coresdk::{
|
|
6
6
|
child_workflow::ChildWorkflowCancellationType,
|
|
7
7
|
workflow_commands::{
|
|
8
8
|
ActivityCancellationType, ScheduleActivity, ScheduleLocalActivity,
|
|
9
|
-
StartChildWorkflowExecution,
|
|
9
|
+
ScheduleNexusOperation, StartChildWorkflowExecution, WorkflowCommand,
|
|
10
10
|
},
|
|
11
11
|
},
|
|
12
12
|
temporal::api::{
|
|
13
13
|
common::v1::{Payload, RetryPolicy},
|
|
14
14
|
enums::v1::ParentClosePolicy,
|
|
15
|
+
sdk::v1::UserMetadata,
|
|
15
16
|
},
|
|
16
17
|
};
|
|
17
|
-
|
|
18
18
|
// TODO: Before release, probably best to avoid using proto types entirely here. They're awkward.
|
|
19
19
|
|
|
20
20
|
pub(crate) trait IntoWorkflowCommand {
|
|
21
|
-
type WFCommandType;
|
|
22
|
-
|
|
23
21
|
/// Produces a workflow command from some options
|
|
24
|
-
fn into_command(self, seq: u32) ->
|
|
22
|
+
fn into_command(self, seq: u32) -> WorkflowCommand;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
/// Options for scheduling an activity
|
|
@@ -68,31 +66,46 @@ pub struct ActivityOptions {
|
|
|
68
66
|
pub cancellation_type: ActivityCancellationType,
|
|
69
67
|
/// Activity retry policy
|
|
70
68
|
pub retry_policy: Option<RetryPolicy>,
|
|
69
|
+
/// Summary of the activity
|
|
70
|
+
pub summary: Option<String>,
|
|
71
|
+
/// Priority for the activity
|
|
72
|
+
pub priority: Option<Priority>,
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
impl IntoWorkflowCommand for ActivityOptions {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
76
|
+
fn into_command(self, seq: u32) -> WorkflowCommand {
|
|
77
|
+
WorkflowCommand {
|
|
78
|
+
variant: Some(
|
|
79
|
+
ScheduleActivity {
|
|
80
|
+
seq,
|
|
81
|
+
activity_id: match self.activity_id {
|
|
82
|
+
None => seq.to_string(),
|
|
83
|
+
Some(aid) => aid,
|
|
84
|
+
},
|
|
85
|
+
activity_type: self.activity_type,
|
|
86
|
+
task_queue: self.task_queue.unwrap_or_default(),
|
|
87
|
+
schedule_to_close_timeout: self
|
|
88
|
+
.schedule_to_close_timeout
|
|
89
|
+
.and_then(|d| d.try_into().ok()),
|
|
90
|
+
schedule_to_start_timeout: self
|
|
91
|
+
.schedule_to_start_timeout
|
|
92
|
+
.and_then(|d| d.try_into().ok()),
|
|
93
|
+
start_to_close_timeout: self
|
|
94
|
+
.start_to_close_timeout
|
|
95
|
+
.and_then(|d| d.try_into().ok()),
|
|
96
|
+
heartbeat_timeout: self.heartbeat_timeout.and_then(|d| d.try_into().ok()),
|
|
97
|
+
cancellation_type: self.cancellation_type as i32,
|
|
98
|
+
arguments: vec![self.input],
|
|
99
|
+
retry_policy: self.retry_policy,
|
|
100
|
+
priority: self.priority.map(Into::into),
|
|
101
|
+
..Default::default()
|
|
102
|
+
}
|
|
103
|
+
.into(),
|
|
104
|
+
),
|
|
105
|
+
user_metadata: self.summary.map(|s| UserMetadata {
|
|
106
|
+
summary: Some(s.into()),
|
|
107
|
+
details: None,
|
|
108
|
+
}),
|
|
96
109
|
}
|
|
97
110
|
}
|
|
98
111
|
}
|
|
@@ -141,34 +154,43 @@ pub struct LocalActivityOptions {
|
|
|
141
154
|
}
|
|
142
155
|
|
|
143
156
|
impl IntoWorkflowCommand for LocalActivityOptions {
|
|
144
|
-
|
|
145
|
-
fn into_command(mut self, seq: u32) -> ScheduleLocalActivity {
|
|
157
|
+
fn into_command(mut self, seq: u32) -> WorkflowCommand {
|
|
146
158
|
// Allow tests to avoid extra verbosity when they don't care about timeouts
|
|
147
159
|
// TODO: Builderize LA options
|
|
148
160
|
self.schedule_to_close_timeout
|
|
149
161
|
.get_or_insert(Duration::from_secs(100));
|
|
150
162
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
WorkflowCommand {
|
|
164
|
+
variant: Some(
|
|
165
|
+
ScheduleLocalActivity {
|
|
166
|
+
seq,
|
|
167
|
+
attempt: self.attempt.unwrap_or(1),
|
|
168
|
+
original_schedule_time: self.original_schedule_time,
|
|
169
|
+
activity_id: match self.activity_id {
|
|
170
|
+
None => seq.to_string(),
|
|
171
|
+
Some(aid) => aid,
|
|
172
|
+
},
|
|
173
|
+
activity_type: self.activity_type,
|
|
174
|
+
arguments: vec![self.input],
|
|
175
|
+
retry_policy: Some(self.retry_policy),
|
|
176
|
+
local_retry_threshold: self
|
|
177
|
+
.timer_backoff_threshold
|
|
178
|
+
.and_then(|d| d.try_into().ok()),
|
|
179
|
+
cancellation_type: self.cancel_type.into(),
|
|
180
|
+
schedule_to_close_timeout: self
|
|
181
|
+
.schedule_to_close_timeout
|
|
182
|
+
.and_then(|d| d.try_into().ok()),
|
|
183
|
+
schedule_to_start_timeout: self
|
|
184
|
+
.schedule_to_start_timeout
|
|
185
|
+
.and_then(|d| d.try_into().ok()),
|
|
186
|
+
start_to_close_timeout: self
|
|
187
|
+
.start_to_close_timeout
|
|
188
|
+
.and_then(|d| d.try_into().ok()),
|
|
189
|
+
..Default::default()
|
|
190
|
+
}
|
|
191
|
+
.into(),
|
|
192
|
+
),
|
|
193
|
+
user_metadata: None,
|
|
172
194
|
}
|
|
173
195
|
}
|
|
174
196
|
}
|
|
@@ -192,32 +214,53 @@ pub struct ChildWorkflowOptions {
|
|
|
192
214
|
pub options: WorkflowOptions,
|
|
193
215
|
/// How to respond to parent workflow ending
|
|
194
216
|
pub parent_close_policy: ParentClosePolicy,
|
|
217
|
+
/// Static summary of the child workflow
|
|
218
|
+
pub static_summary: Option<String>,
|
|
219
|
+
/// Static details of the child workflow
|
|
220
|
+
pub static_details: Option<String>,
|
|
195
221
|
}
|
|
196
222
|
|
|
197
223
|
impl IntoWorkflowCommand for ChildWorkflowOptions {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
224
|
+
fn into_command(self, seq: u32) -> WorkflowCommand {
|
|
225
|
+
let user_metadata = if self.static_summary.is_some() || self.static_details.is_some() {
|
|
226
|
+
Some(UserMetadata {
|
|
227
|
+
summary: self.static_summary.map(Into::into),
|
|
228
|
+
details: self.static_details.map(Into::into),
|
|
229
|
+
})
|
|
230
|
+
} else {
|
|
231
|
+
None
|
|
232
|
+
};
|
|
233
|
+
WorkflowCommand {
|
|
234
|
+
variant: Some(
|
|
235
|
+
StartChildWorkflowExecution {
|
|
236
|
+
seq,
|
|
237
|
+
workflow_id: self.workflow_id,
|
|
238
|
+
workflow_type: self.workflow_type,
|
|
239
|
+
task_queue: self.task_queue.unwrap_or_default(),
|
|
240
|
+
input: self.input,
|
|
241
|
+
cancellation_type: self.cancel_type as i32,
|
|
242
|
+
workflow_id_reuse_policy: self.options.id_reuse_policy as i32,
|
|
243
|
+
workflow_execution_timeout: self
|
|
244
|
+
.options
|
|
245
|
+
.execution_timeout
|
|
246
|
+
.and_then(|d| d.try_into().ok()),
|
|
247
|
+
workflow_run_timeout: self
|
|
248
|
+
.options
|
|
249
|
+
.execution_timeout
|
|
250
|
+
.and_then(|d| d.try_into().ok()),
|
|
251
|
+
workflow_task_timeout: self
|
|
252
|
+
.options
|
|
253
|
+
.task_timeout
|
|
254
|
+
.and_then(|d| d.try_into().ok()),
|
|
255
|
+
search_attributes: self.options.search_attributes.unwrap_or_default(),
|
|
256
|
+
cron_schedule: self.options.cron_schedule.unwrap_or_default(),
|
|
257
|
+
parent_close_policy: self.parent_close_policy as i32,
|
|
258
|
+
priority: self.options.priority.map(Into::into),
|
|
259
|
+
..Default::default()
|
|
260
|
+
}
|
|
261
|
+
.into(),
|
|
262
|
+
),
|
|
263
|
+
user_metadata,
|
|
221
264
|
}
|
|
222
265
|
}
|
|
223
266
|
}
|
|
@@ -307,3 +350,70 @@ impl SignalData {
|
|
|
307
350
|
self
|
|
308
351
|
}
|
|
309
352
|
}
|
|
353
|
+
|
|
354
|
+
/// Options for timer
|
|
355
|
+
#[derive(Default, Debug, Clone)]
|
|
356
|
+
pub struct TimerOptions {
|
|
357
|
+
/// Duration for the timer
|
|
358
|
+
pub duration: Duration,
|
|
359
|
+
/// Summary of the timer
|
|
360
|
+
pub summary: Option<String>,
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
impl From<Duration> for TimerOptions {
|
|
364
|
+
fn from(duration: Duration) -> Self {
|
|
365
|
+
TimerOptions {
|
|
366
|
+
duration,
|
|
367
|
+
..Default::default()
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
/// Options for Nexus Operations
|
|
373
|
+
#[derive(Default, Debug, Clone)]
|
|
374
|
+
pub struct NexusOperationOptions {
|
|
375
|
+
/// Endpoint name, must exist in the endpoint registry or this command will fail.
|
|
376
|
+
pub endpoint: String,
|
|
377
|
+
/// Service name.
|
|
378
|
+
pub service: String,
|
|
379
|
+
/// Operation name.
|
|
380
|
+
pub operation: String,
|
|
381
|
+
/// Input for the operation. The server converts this into Nexus request content and the
|
|
382
|
+
/// appropriate content headers internally when sending the StartOperation request. On the
|
|
383
|
+
/// handler side, if it is also backed by Temporal, the content is transformed back to the
|
|
384
|
+
/// original Payload sent in this command.
|
|
385
|
+
pub input: Option<Payload>,
|
|
386
|
+
/// Schedule-to-close timeout for this operation.
|
|
387
|
+
/// Indicates how long the caller is willing to wait for operation completion.
|
|
388
|
+
/// Calls are retried internally by the server.
|
|
389
|
+
pub schedule_to_close_timeout: Option<Duration>,
|
|
390
|
+
/// Header to attach to the Nexus request.
|
|
391
|
+
/// Users are responsible for encrypting sensitive data in this header as it is stored in
|
|
392
|
+
/// workflow history and transmitted to external services as-is. This is useful for propagating
|
|
393
|
+
/// tracing information. Note these headers are not the same as Temporal headers on internal
|
|
394
|
+
/// activities and child workflows, these are transmitted to Nexus operations that may be
|
|
395
|
+
/// external and are not traditional payloads.
|
|
396
|
+
pub nexus_header: HashMap<String, String>,
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
impl IntoWorkflowCommand for NexusOperationOptions {
|
|
400
|
+
fn into_command(self, seq: u32) -> WorkflowCommand {
|
|
401
|
+
WorkflowCommand {
|
|
402
|
+
user_metadata: None,
|
|
403
|
+
variant: Some(
|
|
404
|
+
ScheduleNexusOperation {
|
|
405
|
+
seq,
|
|
406
|
+
endpoint: self.endpoint,
|
|
407
|
+
service: self.service,
|
|
408
|
+
operation: self.operation,
|
|
409
|
+
input: self.input,
|
|
410
|
+
schedule_to_close_timeout: self
|
|
411
|
+
.schedule_to_close_timeout
|
|
412
|
+
.and_then(|t| t.try_into().ok()),
|
|
413
|
+
nexus_header: self.nexus_header,
|
|
414
|
+
}
|
|
415
|
+
.into(),
|
|
416
|
+
),
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}
|