@temporalio/core-bridge 0.17.2 → 0.18.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 +339 -226
- package/Cargo.toml +7 -3
- package/common.js +50 -0
- package/index.d.ts +7 -0
- package/index.js +12 -0
- package/package.json +7 -4
- package/releases/aarch64-apple-darwin/index.node +0 -0
- package/releases/aarch64-unknown-linux-gnu/index.node +0 -0
- package/{index.node → releases/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/scripts/build.js +10 -50
- package/sdk-core/.buildkite/docker/Dockerfile +1 -1
- package/sdk-core/.buildkite/docker/docker-compose.yaml +2 -2
- package/sdk-core/.buildkite/pipeline.yml +2 -0
- package/sdk-core/Cargo.toml +1 -88
- package/sdk-core/README.md +30 -6
- package/sdk-core/bridge-ffi/Cargo.toml +24 -0
- package/sdk-core/bridge-ffi/LICENSE.txt +23 -0
- package/sdk-core/bridge-ffi/build.rs +25 -0
- package/sdk-core/bridge-ffi/include/sdk-core-bridge.h +216 -0
- package/sdk-core/bridge-ffi/src/lib.rs +829 -0
- package/sdk-core/bridge-ffi/src/wrappers.rs +193 -0
- package/sdk-core/client/Cargo.toml +32 -0
- package/sdk-core/{src/pollers/gateway.rs → client/src/lib.rs} +101 -195
- package/sdk-core/client/src/metrics.rs +89 -0
- package/sdk-core/client/src/mocks.rs +167 -0
- package/sdk-core/{src/pollers → client/src}/retry.rs +172 -14
- package/sdk-core/core/Cargo.toml +96 -0
- package/sdk-core/{src → core/src}/core_tests/activity_tasks.rs +193 -37
- package/sdk-core/{src → core/src}/core_tests/child_workflows.rs +14 -14
- package/sdk-core/{src → core/src}/core_tests/determinism.rs +8 -8
- package/sdk-core/core/src/core_tests/local_activities.rs +328 -0
- package/sdk-core/{src → core/src}/core_tests/mod.rs +6 -9
- package/sdk-core/{src → core/src}/core_tests/queries.rs +45 -52
- package/sdk-core/{src → core/src}/core_tests/replay_flag.rs +8 -12
- package/sdk-core/{src → core/src}/core_tests/workers.rs +120 -33
- package/sdk-core/{src → core/src}/core_tests/workflow_cancels.rs +16 -26
- package/sdk-core/{src → core/src}/core_tests/workflow_tasks.rs +264 -286
- package/sdk-core/core/src/lib.rs +374 -0
- package/sdk-core/{src → core/src}/log_export.rs +3 -27
- package/sdk-core/core/src/pending_activations.rs +162 -0
- package/sdk-core/{src → core/src}/pollers/mod.rs +4 -22
- package/sdk-core/{src → core/src}/pollers/poll_buffer.rs +1 -1
- package/sdk-core/core/src/protosext/mod.rs +396 -0
- package/sdk-core/core/src/replay/mod.rs +210 -0
- package/sdk-core/core/src/retry_logic.rs +144 -0
- package/sdk-core/{src → core/src}/telemetry/metrics.rs +3 -58
- package/sdk-core/{src → core/src}/telemetry/mod.rs +8 -8
- package/sdk-core/{src → core/src}/telemetry/prometheus_server.rs +0 -0
- package/sdk-core/{src → core/src}/test_help/mod.rs +34 -73
- package/sdk-core/{src → core/src}/worker/activities/activity_heartbeat_manager.rs +95 -42
- package/sdk-core/core/src/worker/activities/local_activities.rs +973 -0
- package/sdk-core/{src → core/src}/worker/activities.rs +52 -33
- package/sdk-core/{src → core/src}/worker/dispatcher.rs +8 -6
- package/sdk-core/{src → core/src}/worker/mod.rs +305 -195
- package/sdk-core/core/src/worker/wft_delivery.rs +81 -0
- package/sdk-core/{src → core/src}/workflow/bridge.rs +5 -2
- package/sdk-core/{src → core/src}/workflow/driven_workflow.rs +17 -7
- package/sdk-core/{src → core/src}/workflow/history_update.rs +33 -7
- package/sdk-core/{src → core/src/workflow}/machines/activity_state_machine.rs +26 -26
- package/sdk-core/{src → core/src/workflow}/machines/cancel_external_state_machine.rs +8 -11
- package/sdk-core/{src → core/src/workflow}/machines/cancel_workflow_state_machine.rs +19 -21
- package/sdk-core/{src → core/src/workflow}/machines/child_workflow_state_machine.rs +19 -21
- package/sdk-core/{src → core/src/workflow}/machines/complete_workflow_state_machine.rs +3 -5
- package/sdk-core/{src → core/src/workflow}/machines/continue_as_new_workflow_state_machine.rs +18 -18
- package/sdk-core/{src → core/src/workflow}/machines/fail_workflow_state_machine.rs +5 -6
- package/sdk-core/core/src/workflow/machines/local_activity_state_machine.rs +1451 -0
- package/sdk-core/{src → core/src/workflow}/machines/mod.rs +54 -107
- package/sdk-core/{src → core/src/workflow}/machines/mutable_side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/patch_state_machine.rs +29 -30
- package/sdk-core/{src → core/src/workflow}/machines/side_effect_state_machine.rs +0 -0
- package/sdk-core/{src → core/src/workflow}/machines/signal_external_state_machine.rs +17 -19
- package/sdk-core/{src → core/src/workflow}/machines/timer_state_machine.rs +20 -21
- package/sdk-core/{src → core/src/workflow}/machines/transition_coverage.rs +5 -2
- package/sdk-core/{src → core/src/workflow}/machines/upsert_search_attributes_state_machine.rs +0 -0
- package/sdk-core/core/src/workflow/machines/workflow_machines/local_acts.rs +96 -0
- package/sdk-core/{src → core/src/workflow}/machines/workflow_machines.rs +344 -160
- package/sdk-core/{src → core/src/workflow}/machines/workflow_task_state_machine.rs +1 -1
- package/sdk-core/{src → core/src}/workflow/mod.rs +200 -39
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/cache_manager.rs +0 -0
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/concurrency_manager.rs +38 -5
- package/sdk-core/{src → core/src}/workflow/workflow_tasks/mod.rs +297 -81
- package/sdk-core/{test_utils → core-api}/Cargo.toml +10 -7
- package/sdk-core/{src → core-api/src}/errors.rs +42 -90
- package/sdk-core/core-api/src/lib.rs +158 -0
- package/sdk-core/{src/worker/config.rs → core-api/src/worker.rs} +18 -23
- package/sdk-core/etc/deps.svg +156 -0
- package/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +5 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +3 -5
- package/sdk-core/fsm/rustfsm_trait/src/lib.rs +7 -1
- package/sdk-core/histories/fail_wf_task.bin +0 -0
- package/sdk-core/histories/timer_workflow_history.bin +0 -0
- package/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +44 -13
- package/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +19 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +1 -1
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +9 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +1 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +13 -0
- package/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +14 -7
- package/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +176 -18
- package/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +6 -0
- package/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +11 -0
- package/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +3 -0
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +156 -7
- package/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +135 -104
- package/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +78 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +205 -0
- package/sdk-core/protos/local/temporal/sdk/core/bridge/service.proto +61 -0
- package/sdk-core/protos/local/{child_workflow.proto → temporal/sdk/core/child_workflow/child_workflow.proto} +1 -1
- package/sdk-core/protos/local/{common.proto → temporal/sdk/core/common/common.proto} +5 -3
- package/sdk-core/protos/local/{core_interface.proto → temporal/sdk/core/core_interface.proto} +10 -10
- package/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
- package/sdk-core/protos/local/{workflow_activation.proto → temporal/sdk/core/workflow_activation/workflow_activation.proto} +35 -11
- package/sdk-core/protos/local/{workflow_commands.proto → temporal/sdk/core/workflow_commands/workflow_commands.proto} +55 -4
- package/sdk-core/protos/local/{workflow_completion.proto → temporal/sdk/core/workflow_completion/workflow_completion.proto} +3 -3
- package/sdk-core/sdk/Cargo.toml +32 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/conversions.rs +0 -0
- package/sdk-core/sdk/src/lib.rs +699 -0
- package/sdk-core/sdk/src/payload_converter.rs +11 -0
- package/sdk-core/sdk/src/workflow_context/options.rs +180 -0
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_context.rs +201 -124
- package/sdk-core/{src/prototype_rust_sdk → sdk/src}/workflow_future.rs +63 -30
- package/sdk-core/sdk-core-protos/Cargo.toml +10 -0
- package/sdk-core/sdk-core-protos/build.rs +28 -6
- package/sdk-core/sdk-core-protos/src/constants.rs +7 -0
- package/sdk-core/{src/test_help → sdk-core-protos/src}/history_builder.rs +134 -49
- package/sdk-core/sdk-core-protos/src/history_info.rs +216 -0
- package/sdk-core/sdk-core-protos/src/lib.rs +594 -168
- package/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
- package/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- package/sdk-core/test-utils/Cargo.toml +32 -0
- package/sdk-core/{src/test_help → test-utils/src}/canned_histories.rs +59 -78
- package/sdk-core/test-utils/src/histfetch.rs +28 -0
- package/sdk-core/{test_utils → test-utils}/src/lib.rs +131 -68
- package/sdk-core/tests/integ_tests/client_tests.rs +1 -1
- package/sdk-core/tests/integ_tests/heartbeat_tests.rs +11 -7
- package/sdk-core/tests/integ_tests/polling_tests.rs +12 -11
- package/sdk-core/tests/integ_tests/queries_tests.rs +82 -78
- package/sdk-core/tests/integ_tests/workflow_tests/activities.rs +91 -71
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +2 -4
- package/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +4 -6
- package/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -4
- package/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +496 -0
- package/sdk-core/tests/integ_tests/workflow_tests/patches.rs +5 -8
- package/sdk-core/tests/integ_tests/workflow_tests/replay.rs +125 -0
- package/sdk-core/tests/integ_tests/workflow_tests/signals.rs +7 -13
- package/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +33 -5
- package/sdk-core/tests/integ_tests/workflow_tests/timers.rs +12 -16
- package/sdk-core/tests/integ_tests/workflow_tests.rs +85 -82
- package/sdk-core/tests/load_tests.rs +6 -6
- package/sdk-core/tests/main.rs +2 -2
- package/src/conversions.rs +24 -21
- package/src/errors.rs +8 -0
- package/src/lib.rs +323 -211
- package/sdk-core/protos/local/activity_result.proto +0 -46
- package/sdk-core/protos/local/activity_task.proto +0 -66
- package/sdk-core/src/core_tests/retry.rs +0 -147
- package/sdk-core/src/lib.rs +0 -403
- package/sdk-core/src/machines/local_activity_state_machine.rs +0 -117
- package/sdk-core/src/pending_activations.rs +0 -249
- package/sdk-core/src/protosext/mod.rs +0 -160
- package/sdk-core/src/prototype_rust_sdk.rs +0 -412
- package/sdk-core/src/task_token.rs +0 -20
- package/sdk-core/src/test_help/history_info.rs +0 -158
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package coresdk.bridge;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/duration.proto";
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
import "google/protobuf/wrappers.proto";
|
|
8
|
+
import "temporal/sdk/core/core_interface.proto";
|
|
9
|
+
import "temporal/sdk/core/activity_task/activity_task.proto";
|
|
10
|
+
import "temporal/sdk/core/workflow_activation/workflow_activation.proto";
|
|
11
|
+
import "temporal/sdk/core/workflow_completion/workflow_completion.proto";
|
|
12
|
+
|
|
13
|
+
enum LogLevel {
|
|
14
|
+
LOG_LEVEL_UNSPECIFIED = 0;
|
|
15
|
+
OFF = 1;
|
|
16
|
+
ERROR = 2;
|
|
17
|
+
WARN = 3;
|
|
18
|
+
INFO = 4;
|
|
19
|
+
DEBUG = 5;
|
|
20
|
+
TRACE = 6;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
message InitRequest {
|
|
24
|
+
GatewayOptions gateway_options = 1;
|
|
25
|
+
TelemetryOptions telemetry_options = 2;
|
|
26
|
+
|
|
27
|
+
message GatewayOptions {
|
|
28
|
+
string target_url = 1;
|
|
29
|
+
string namespace = 2;
|
|
30
|
+
string client_name = 3;
|
|
31
|
+
string client_version = 4;
|
|
32
|
+
map<string, string> static_headers = 5;
|
|
33
|
+
string identity = 6;
|
|
34
|
+
string worker_binary_id = 7;
|
|
35
|
+
TlsConfig tls_config = 8;
|
|
36
|
+
RetryConfig retry_config = 9;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
message TlsConfig {
|
|
40
|
+
bytes server_root_ca_cert = 1;
|
|
41
|
+
string domain = 2;
|
|
42
|
+
bytes client_cert = 3;
|
|
43
|
+
bytes client_private_key = 4;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message RetryConfig {
|
|
47
|
+
google.protobuf.Duration initial_interval = 1;
|
|
48
|
+
google.protobuf.DoubleValue randomization_factor = 2;
|
|
49
|
+
google.protobuf.DoubleValue multiplier = 3;
|
|
50
|
+
google.protobuf.Duration max_interval = 4;
|
|
51
|
+
google.protobuf.Duration max_elapsed_time = 5;
|
|
52
|
+
google.protobuf.UInt32Value max_retries = 6;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
message TelemetryOptions {
|
|
56
|
+
string otel_collector_url = 1;
|
|
57
|
+
string tracing_filter = 2;
|
|
58
|
+
LogLevel log_forwarding_level = 3;
|
|
59
|
+
string prometheus_export_bind_address = 4;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
message InitResponse {
|
|
64
|
+
Error error = 1;
|
|
65
|
+
|
|
66
|
+
message Error {
|
|
67
|
+
string message = 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
message RegisterWorkerRequest {
|
|
72
|
+
string task_queue = 1;
|
|
73
|
+
google.protobuf.UInt32Value max_cached_workflows = 2;
|
|
74
|
+
google.protobuf.UInt32Value max_outstanding_workflow_tasks = 3;
|
|
75
|
+
google.protobuf.UInt32Value max_outstanding_activities = 4;
|
|
76
|
+
google.protobuf.UInt32Value max_outstanding_local_activities = 5;
|
|
77
|
+
google.protobuf.UInt32Value max_concurrent_wft_polls = 6;
|
|
78
|
+
google.protobuf.FloatValue nonsticky_to_sticky_poll_ratio = 7;
|
|
79
|
+
google.protobuf.UInt32Value max_concurrent_at_polls = 8;
|
|
80
|
+
bool no_remote_activities = 9;
|
|
81
|
+
google.protobuf.Duration sticky_queue_schedule_to_start_timeout = 10;
|
|
82
|
+
google.protobuf.Duration max_heartbeat_throttle_interval = 11;
|
|
83
|
+
google.protobuf.Duration default_heartbeat_throttle_interval = 12;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
message RegisterWorkerResponse {
|
|
87
|
+
Error error = 1;
|
|
88
|
+
|
|
89
|
+
message Error {
|
|
90
|
+
string message = 1;
|
|
91
|
+
bool worker_already_registered = 2;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
message PollWorkflowActivationRequest {
|
|
96
|
+
string task_queue = 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
message PollWorkflowActivationResponse {
|
|
100
|
+
oneof response {
|
|
101
|
+
coresdk.workflow_activation.WorkflowActivation activation = 1;
|
|
102
|
+
Error error = 2;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
message Error {
|
|
106
|
+
string message = 1;
|
|
107
|
+
bool shutdown = 2;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
message PollActivityTaskRequest {
|
|
112
|
+
string task_queue = 1;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
message PollActivityTaskResponse {
|
|
116
|
+
oneof response {
|
|
117
|
+
coresdk.activity_task.ActivityTask task = 1;
|
|
118
|
+
Error error = 2;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
message Error {
|
|
122
|
+
string message = 1;
|
|
123
|
+
bool shutdown = 2;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
message CompleteWorkflowActivationRequest {
|
|
128
|
+
coresdk.workflow_completion.WorkflowActivationCompletion completion = 1;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
message CompleteWorkflowActivationResponse {
|
|
132
|
+
Error error = 1;
|
|
133
|
+
|
|
134
|
+
message Error {
|
|
135
|
+
string message = 1;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
message CompleteActivityTaskRequest {
|
|
140
|
+
coresdk.ActivityTaskCompletion completion = 1;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
message CompleteActivityTaskResponse {
|
|
144
|
+
Error error = 1;
|
|
145
|
+
|
|
146
|
+
message Error {
|
|
147
|
+
string message = 1;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
message RecordActivityHeartbeatRequest {
|
|
152
|
+
coresdk.ActivityHeartbeat heartbeat = 1;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
message RecordActivityHeartbeatResponse {
|
|
156
|
+
Error error = 1;
|
|
157
|
+
|
|
158
|
+
message Error {
|
|
159
|
+
string message = 1;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
message RequestWorkflowEvictionRequest {
|
|
164
|
+
string task_queue = 1;
|
|
165
|
+
string run_id = 2;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
message RequestWorkflowEvictionResponse {
|
|
169
|
+
Error error = 1;
|
|
170
|
+
|
|
171
|
+
message Error {
|
|
172
|
+
string message = 1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
message ShutdownRequest {
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
message ShutdownResponse {
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
message ShutdownWorkerRequest {
|
|
183
|
+
string task_queue = 1;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
message ShutdownWorkerResponse {
|
|
187
|
+
Error error = 1;
|
|
188
|
+
|
|
189
|
+
message Error {
|
|
190
|
+
string message = 1;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
message FetchBufferedLogsRequest {
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
message FetchBufferedLogsResponse {
|
|
198
|
+
repeated LogEntry entries = 1;
|
|
199
|
+
|
|
200
|
+
message LogEntry {
|
|
201
|
+
string message = 1;
|
|
202
|
+
google.protobuf.Timestamp timestamp = 2;
|
|
203
|
+
LogLevel level = 3;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package coresdk.bridge;
|
|
4
|
+
|
|
5
|
+
import "temporal/sdk/core/bridge/bridge.proto";
|
|
6
|
+
|
|
7
|
+
service Bridge {
|
|
8
|
+
// Starts an isolated core instance unique to this stream that will
|
|
9
|
+
// automatically be shutdown on completion of the stream. The caller must
|
|
10
|
+
// provide the first message and it must be an "init". No other calls can be
|
|
11
|
+
// made until the init response has been received by the client.
|
|
12
|
+
//
|
|
13
|
+
// Every request message will have a single correlated response message,
|
|
14
|
+
// though not necessarily in a particular order or timeframe.
|
|
15
|
+
//
|
|
16
|
+
// There is no requst for "shutdown", because it is implied on stream
|
|
17
|
+
// completion.
|
|
18
|
+
//
|
|
19
|
+
// The stream approach is chosen because core is inherently stateful while
|
|
20
|
+
// gRPC unary RPCs are not. Upon abnormal stream close, the caller should
|
|
21
|
+
// reattempt, performing the init again.
|
|
22
|
+
rpc Stream(stream StreamRequest) returns (stream StreamResponse);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
message StreamRequest {
|
|
26
|
+
// The ID sent in the response. This is not technically required nor must it
|
|
27
|
+
// be unique if the caller, say, knows they only have one message outstanding
|
|
28
|
+
// of a certain type. However, it is recommended that this always be present
|
|
29
|
+
// and unique to avoid confusion.
|
|
30
|
+
string id = 1;
|
|
31
|
+
|
|
32
|
+
oneof request {
|
|
33
|
+
InitRequest init = 2;
|
|
34
|
+
RegisterWorkerRequest register_worker = 3;
|
|
35
|
+
PollWorkflowActivationRequest poll_workflow_activation = 4;
|
|
36
|
+
PollActivityTaskRequest poll_activity_task = 5;
|
|
37
|
+
CompleteWorkflowActivationRequest complete_workflow_activation = 6;
|
|
38
|
+
CompleteActivityTaskRequest complete_activity_task = 7;
|
|
39
|
+
RecordActivityHeartbeatRequest record_activity_heartbeat = 8;
|
|
40
|
+
RequestWorkflowEvictionRequest request_workflow_eviction = 9;
|
|
41
|
+
ShutdownWorkerRequest shutdown_worker = 10;
|
|
42
|
+
FetchBufferedLogsRequest fetch_buffered_logs = 11;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
message StreamResponse {
|
|
47
|
+
string request_id = 1;
|
|
48
|
+
|
|
49
|
+
oneof response {
|
|
50
|
+
InitResponse init = 2;
|
|
51
|
+
RegisterWorkerResponse register_worker = 3;
|
|
52
|
+
PollWorkflowActivationResponse poll_workflow_activation = 4;
|
|
53
|
+
PollActivityTaskResponse poll_activity_task = 5;
|
|
54
|
+
CompleteWorkflowActivationResponse complete_workflow_activation = 6;
|
|
55
|
+
CompleteActivityTaskResponse complete_activity_task = 7;
|
|
56
|
+
RecordActivityHeartbeatResponse record_activity_heartbeat = 8;
|
|
57
|
+
RequestWorkflowEvictionResponse request_workflow_eviction = 9;
|
|
58
|
+
ShutdownWorkerResponse shutdown_worker = 10;
|
|
59
|
+
FetchBufferedLogsResponse fetch_buffered_logs = 11;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -36,20 +36,22 @@ message NamespacedWorkflowExecution {
|
|
|
36
36
|
|
|
37
37
|
|
|
38
38
|
// Defines how an activity or workflow should be retried in the event of failure, timeout, etc.
|
|
39
|
+
// Defaults may differ depending on what this is being used for. See containing messages.
|
|
39
40
|
message RetryPolicy {
|
|
40
41
|
// Interval of the first retry. If backoff_coefficient is 1.0 then it is used for all
|
|
41
|
-
// retries.
|
|
42
|
+
// retries. If this is not specified, there will be *no retrying*. Lang SDKs should require
|
|
43
|
+
// this to be set.
|
|
42
44
|
google.protobuf.Duration initial_interval = 1;
|
|
43
45
|
// Coefficient used to calculate the next retry interval. The next retry interval is previous
|
|
44
46
|
// interval multiplied by the coefficient. Must be 1 or larger.
|
|
45
47
|
double backoff_coefficient = 2;
|
|
46
48
|
// Maximum interval between retries. Exponential backoff leads to interval increase. This value
|
|
47
|
-
// caps that interval.
|
|
49
|
+
// caps that interval.
|
|
48
50
|
google.protobuf.Duration maximum_interval = 3;
|
|
49
51
|
// Maximum number of attempts. When exceeded, retrying will stop. 1 disables retries. 0 means
|
|
50
52
|
// unlimited retries (until the activity or workflow's total timeout is reached).
|
|
51
53
|
int32 maximum_attempts = 4;
|
|
52
|
-
// If a stringified error matches something in this list, retries will cease.
|
|
54
|
+
// If a stringified error type matches something in this list, retries will cease.
|
|
53
55
|
repeated string non_retryable_error_types = 5;
|
|
54
56
|
}
|
|
55
57
|
|
package/sdk-core/protos/local/{core_interface.proto → temporal/sdk/core/core_interface.proto}
RENAMED
|
@@ -2,19 +2,19 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package coresdk;
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
import "activity_task.proto";
|
|
7
|
-
import "common.proto";
|
|
8
|
-
import "workflow_activation.proto";
|
|
9
|
-
import "workflow_commands.proto";
|
|
10
|
-
import "workflow_completion.proto";
|
|
11
|
-
|
|
12
|
-
// Note: Intellij will think these imports don't work because of the slightly odd nature of
|
|
5
|
+
// Note: Intellij will think the Google imports don't work because of the slightly odd nature of
|
|
13
6
|
// the include paths. You can make it work by going to the "Protobuf Support" settings section
|
|
14
7
|
// and adding the "api_upstream" subdir as an include path.
|
|
15
|
-
import "google/protobuf/timestamp.proto";
|
|
16
8
|
import "google/protobuf/duration.proto";
|
|
17
9
|
import "google/protobuf/empty.proto";
|
|
10
|
+
import "google/protobuf/timestamp.proto";
|
|
11
|
+
import "temporal/sdk/core/activity_result/activity_result.proto";
|
|
12
|
+
import "temporal/sdk/core/activity_task/activity_task.proto";
|
|
13
|
+
import "temporal/sdk/core/common/common.proto";
|
|
14
|
+
import "temporal/sdk/core/external_data/external_data.proto";
|
|
15
|
+
import "temporal/sdk/core/workflow_activation/workflow_activation.proto";
|
|
16
|
+
import "temporal/sdk/core/workflow_commands/workflow_commands.proto";
|
|
17
|
+
import "temporal/sdk/core/workflow_completion/workflow_completion.proto";
|
|
18
18
|
|
|
19
19
|
// A request as given to `record_activity_heartbeat`
|
|
20
20
|
message ActivityHeartbeat {
|
|
@@ -29,5 +29,5 @@ message ActivityTaskCompletion {
|
|
|
29
29
|
bytes task_token = 1;
|
|
30
30
|
// The task queue / worker this task is associated with
|
|
31
31
|
string task_queue = 2;
|
|
32
|
-
activity_result.
|
|
32
|
+
activity_result.ActivityExecutionResult result = 3;
|
|
33
33
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
syntax = "proto3";
|
|
2
|
+
|
|
3
|
+
package coresdk.external_data;
|
|
4
|
+
|
|
5
|
+
import "google/protobuf/duration.proto";
|
|
6
|
+
import "google/protobuf/timestamp.proto";
|
|
7
|
+
|
|
8
|
+
// This file defines data that Core might write externally. The first motivating case being
|
|
9
|
+
// storing data in markers in event history. Defining such data as protos provides an easy way
|
|
10
|
+
// for consumers which would like to just depend on the proto package to make sense of marker data.
|
|
11
|
+
|
|
12
|
+
message LocalActivityMarkerData {
|
|
13
|
+
uint32 seq = 1;
|
|
14
|
+
// The number of attempts at execution before we recorded this result. Typically starts at 1,
|
|
15
|
+
// but it is possible to start at a higher number when backing off using a timer.
|
|
16
|
+
uint32 attempt = 2;
|
|
17
|
+
string activity_id = 3;
|
|
18
|
+
string activity_type = 4;
|
|
19
|
+
// You can think of this as "perceived completion time". It is the time the local activity thought
|
|
20
|
+
// it was when it completed. Which could be different from wall-clock time because of workflow
|
|
21
|
+
// replay. It's the WFT start time + the LA's runtime
|
|
22
|
+
google.protobuf.Timestamp complete_time = 5;
|
|
23
|
+
// If set, this local activity conceptually is retrying after the specified backoff.
|
|
24
|
+
// Implementation wise, they are really two different LA machines, but with the same type & input.
|
|
25
|
+
// The retry starts with an attempt number > 1.
|
|
26
|
+
google.protobuf.Duration backoff = 6;
|
|
27
|
+
// The time the LA was originally scheduled (wall clock time). This is used to track
|
|
28
|
+
// schedule-to-close timeouts when timer-based backoffs are used
|
|
29
|
+
google.protobuf.Timestamp original_schedule_time = 7;
|
|
30
|
+
}
|
|
@@ -6,16 +6,15 @@ syntax = "proto3";
|
|
|
6
6
|
*/
|
|
7
7
|
package coresdk.workflow_activation;
|
|
8
8
|
|
|
9
|
-
import "common.proto";
|
|
10
|
-
import "activity_result.proto";
|
|
11
|
-
import "child_workflow.proto";
|
|
12
|
-
|
|
13
|
-
import "temporal/api/failure/v1/message.proto";
|
|
14
9
|
import "google/protobuf/timestamp.proto";
|
|
10
|
+
import "temporal/api/failure/v1/message.proto";
|
|
11
|
+
import "temporal/sdk/core/activity_result/activity_result.proto";
|
|
12
|
+
import "temporal/sdk/core/child_workflow/child_workflow.proto";
|
|
13
|
+
import "temporal/sdk/core/common/common.proto";
|
|
15
14
|
|
|
16
15
|
/// An instruction to the lang sdk to run some workflow code, whether for the first time or from
|
|
17
16
|
/// a cached state.
|
|
18
|
-
message
|
|
17
|
+
message WorkflowActivation {
|
|
19
18
|
/// The id of the currently active run of the workflow. Also used as a cache key. There may
|
|
20
19
|
/// only ever be one active workflow task (and hence activation) of a run at one time.
|
|
21
20
|
string run_id = 1;
|
|
@@ -24,10 +23,10 @@ message WFActivation {
|
|
|
24
23
|
/// Whether or not the activation is replaying past events
|
|
25
24
|
bool is_replaying = 3;
|
|
26
25
|
/// The things to do upon activating the workflow
|
|
27
|
-
repeated
|
|
26
|
+
repeated WorkflowActivationJob jobs = 4;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
message
|
|
29
|
+
message WorkflowActivationJob {
|
|
31
30
|
oneof variant {
|
|
32
31
|
/// Begin a workflow for the first time
|
|
33
32
|
StartWorkflow start_workflow = 1;
|
|
@@ -55,7 +54,7 @@ message WFActivationJob {
|
|
|
55
54
|
ResolveSignalExternalWorkflow resolve_signal_external_workflow = 12;
|
|
56
55
|
/// An attempt to cancel an external workflow resolved
|
|
57
56
|
ResolveRequestCancelExternalWorkflow resolve_request_cancel_external_workflow = 13;
|
|
58
|
-
/// Remove the workflow identified by the [
|
|
57
|
+
/// Remove the workflow identified by the [WorkflowActivation] containing this job from the cache
|
|
59
58
|
/// after performing the activation.
|
|
60
59
|
///
|
|
61
60
|
/// If other job variant are present in the list, this variant will be the last job in the
|
|
@@ -92,7 +91,7 @@ message FireTimer {
|
|
|
92
91
|
message ResolveActivity {
|
|
93
92
|
/// Sequence number as provided by lang in the corresponding ScheduleActivity command
|
|
94
93
|
uint32 seq = 1;
|
|
95
|
-
activity_result.
|
|
94
|
+
activity_result.ActivityResolution result = 2;
|
|
96
95
|
}
|
|
97
96
|
|
|
98
97
|
/// Notify a workflow that a start child workflow execution request has succeeded, failed or was
|
|
@@ -188,5 +187,30 @@ message ResolveRequestCancelExternalWorkflow {
|
|
|
188
187
|
}
|
|
189
188
|
|
|
190
189
|
message RemoveFromCache {
|
|
191
|
-
string
|
|
190
|
+
string message = 1;
|
|
191
|
+
|
|
192
|
+
enum EvictionReason {
|
|
193
|
+
UNSPECIFIED = 0;
|
|
194
|
+
// Workflow cache is full
|
|
195
|
+
CACHE_FULL = 1;
|
|
196
|
+
// Workflow received a partial task but was not in the cache. Typically it won't be in the
|
|
197
|
+
// lang cache either at this point, but we send an eviction to be sure.
|
|
198
|
+
CACHE_MISS = 2;
|
|
199
|
+
// The workflow produced results inconsistent with history.
|
|
200
|
+
NONDETERMINISM = 3;
|
|
201
|
+
// The lang side completed the workflow activation with a failure.
|
|
202
|
+
LANG_FAIL = 4;
|
|
203
|
+
// The lang side explicitly requested this workflow be evicted.
|
|
204
|
+
LANG_REQUESTED = 5;
|
|
205
|
+
// The workflow task we tried to respond to didn't exist. The workflow might have already
|
|
206
|
+
// finished, or the WFT timed out but we didn't learn about that yet.
|
|
207
|
+
TASK_NOT_FOUND = 6;
|
|
208
|
+
// There was new work that must be handled while we attempted to complete the WFT. Ex:
|
|
209
|
+
// a new signal came in while trying to complete the workflow.
|
|
210
|
+
UNHANDLED_COMMAND = 7;
|
|
211
|
+
// There was some fatal error processing the workflow, typically an internal error, but
|
|
212
|
+
// can also happen if then network drops out while paginating. Check message string.
|
|
213
|
+
FATAL = 8;
|
|
214
|
+
}
|
|
215
|
+
EvictionReason reason = 2;
|
|
192
216
|
}
|
|
@@ -7,10 +7,11 @@ syntax = "proto3";
|
|
|
7
7
|
*/
|
|
8
8
|
package coresdk.workflow_commands;
|
|
9
9
|
|
|
10
|
-
import "common.proto";
|
|
11
|
-
import "child_workflow.proto";
|
|
12
10
|
import "google/protobuf/duration.proto";
|
|
11
|
+
import "google/protobuf/timestamp.proto";
|
|
13
12
|
import "temporal/api/failure/v1/message.proto";
|
|
13
|
+
import "temporal/sdk/core/child_workflow/child_workflow.proto";
|
|
14
|
+
import "temporal/sdk/core/common/common.proto";
|
|
14
15
|
|
|
15
16
|
message WorkflowCommand {
|
|
16
17
|
oneof variant {
|
|
@@ -29,6 +30,8 @@ message WorkflowCommand {
|
|
|
29
30
|
RequestCancelExternalWorkflowExecution request_cancel_external_workflow_execution = 13;
|
|
30
31
|
SignalExternalWorkflowExecution signal_external_workflow_execution = 14;
|
|
31
32
|
CancelSignalWorkflow cancel_signal_workflow = 15;
|
|
33
|
+
ScheduleLocalActivity schedule_local_activity = 16;
|
|
34
|
+
RequestCancelLocalActivity request_cancel_local_activity = 17;
|
|
32
35
|
|
|
33
36
|
// To be added as/if needed:
|
|
34
37
|
// UpsertWorkflowSearchAttributes upsert_workflow_search_attributes_command_attributes = 14;
|
|
@@ -72,9 +75,52 @@ message ScheduleActivity {
|
|
|
72
75
|
google.protobuf.Duration heartbeat_timeout = 11;
|
|
73
76
|
/// Activities are provided by a default retry policy controlled through the service dynamic
|
|
74
77
|
/// configuration. Retries are happening up to schedule_to_close_timeout. To disable retries set
|
|
75
|
-
/// retry_policy.maximum_attempts to
|
|
78
|
+
/// retry_policy.maximum_attempts to 1.
|
|
76
79
|
common.RetryPolicy retry_policy = 12;
|
|
77
|
-
/// Defines
|
|
80
|
+
/// Defines how the workflow will wait (or not) for cancellation of the activity to be confirmed
|
|
81
|
+
ActivityCancellationType cancellation_type = 13;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
message ScheduleLocalActivity {
|
|
85
|
+
/// Lang's incremental sequence number, used as the operation identifier
|
|
86
|
+
uint32 seq = 1;
|
|
87
|
+
string activity_id = 2;
|
|
88
|
+
string activity_type = 3;
|
|
89
|
+
/// Local activities can start with a non-1 attempt, if lang has been told to backoff using
|
|
90
|
+
/// a timer before retrying. It should pass the attempt number from a `DoBackoff` activity
|
|
91
|
+
/// resolution.
|
|
92
|
+
uint32 attempt = 4;
|
|
93
|
+
/// If this local activity is a retry (as per the attempt field) this needs to be the original
|
|
94
|
+
/// scheduling time (as provided in `DoBackoff`)
|
|
95
|
+
google.protobuf.Timestamp original_schedule_time = 5;
|
|
96
|
+
map<string, common.Payload> header_fields = 6;
|
|
97
|
+
/// Arguments/input to the activity.
|
|
98
|
+
repeated common.Payload arguments = 7;
|
|
99
|
+
/// Indicates how long the caller is willing to wait for local activity completion. Limits how
|
|
100
|
+
/// long retries will be attempted. When not specified defaults to the workflow execution
|
|
101
|
+
/// timeout (which may be unset).
|
|
102
|
+
google.protobuf.Duration schedule_to_close_timeout = 8;
|
|
103
|
+
/// Limits time the local activity can idle internally before being executed. That can happen if
|
|
104
|
+
/// the worker is currently at max concurrent local activity executions. This timeout is always
|
|
105
|
+
/// non retryable as all a retry would achieve is to put it back into the same queue. Defaults
|
|
106
|
+
/// to `schedule_to_close_timeout` if not specified and that is set. Must be <=
|
|
107
|
+
/// `schedule_to_close_timeout` when set, otherwise, it will be clamped down.
|
|
108
|
+
google.protobuf.Duration schedule_to_start_timeout = 9;
|
|
109
|
+
/// Maximum time the local activity is allowed to execute after the task is dispatched. This
|
|
110
|
+
/// timeout is always retryable. Either or both of `schedule_to_close_timeout` and this must be
|
|
111
|
+
/// specified. If set, this must be <= `schedule_to_close_timeout`, otherwise, it will be
|
|
112
|
+
/// clamped down.
|
|
113
|
+
google.protobuf.Duration start_to_close_timeout = 10;
|
|
114
|
+
/// Specify a retry policy for the local activity. By default local activities will be retried
|
|
115
|
+
/// indefinitely.
|
|
116
|
+
common.RetryPolicy retry_policy = 11;
|
|
117
|
+
/// If the activity is retrying and backoff would exceed this value, lang will be told to
|
|
118
|
+
/// schedule a timer and retry the activity after. Otherwise, backoff will happen internally in
|
|
119
|
+
/// core. Defaults to 1 minute.
|
|
120
|
+
google.protobuf.Duration local_retry_threshold = 12;
|
|
121
|
+
/// Defines how the workflow will wait (or not) for cancellation of the activity to be
|
|
122
|
+
/// confirmed. Lang should default this to `WAIT_CANCELLATION_COMPLETED`, even though proto
|
|
123
|
+
/// will default to `TRY_CANCEL` automatically.
|
|
78
124
|
ActivityCancellationType cancellation_type = 13;
|
|
79
125
|
}
|
|
80
126
|
|
|
@@ -95,6 +141,11 @@ message RequestCancelActivity {
|
|
|
95
141
|
uint32 seq = 1;
|
|
96
142
|
}
|
|
97
143
|
|
|
144
|
+
message RequestCancelLocalActivity {
|
|
145
|
+
/// Lang's incremental sequence number as passed to `ScheduleLocalActivity`
|
|
146
|
+
uint32 seq = 1;
|
|
147
|
+
}
|
|
148
|
+
|
|
98
149
|
message QueryResult {
|
|
99
150
|
/// Corresponds to the id provided in the activation job
|
|
100
151
|
string query_id = 1;
|
|
@@ -2,12 +2,12 @@ syntax = "proto3";
|
|
|
2
2
|
|
|
3
3
|
package coresdk.workflow_completion;
|
|
4
4
|
|
|
5
|
-
import "common.proto";
|
|
6
|
-
import "workflow_commands.proto";
|
|
7
5
|
import "temporal/api/failure/v1/message.proto";
|
|
6
|
+
import "temporal/sdk/core/common/common.proto";
|
|
7
|
+
import "temporal/sdk/core/workflow_commands/workflow_commands.proto";
|
|
8
8
|
|
|
9
9
|
/// Result of a single workflow activation, reported from lang to core
|
|
10
|
-
message
|
|
10
|
+
message WorkflowActivationCompletion {
|
|
11
11
|
// The task queue the workflow activation you are completing originated from
|
|
12
12
|
string task_queue = 1;
|
|
13
13
|
// The run id from the workflow activation you are completing
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
[package]
|
|
2
|
+
name = "temporal-sdk"
|
|
3
|
+
version = "0.1.0-alpha.1"
|
|
4
|
+
edition = "2021"
|
|
5
|
+
|
|
6
|
+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
7
|
+
|
|
8
|
+
[dependencies]
|
|
9
|
+
anyhow = "1.0"
|
|
10
|
+
crossbeam = "0.8"
|
|
11
|
+
derive_more = "0.99"
|
|
12
|
+
futures = "0.3"
|
|
13
|
+
parking_lot = { version = "0.11", features = ["send_guard"] }
|
|
14
|
+
prost-types = "0.9"
|
|
15
|
+
serde = "1.0"
|
|
16
|
+
tokio = { version = "1.1", features = ["rt", "rt-multi-thread", "parking_lot", "time", "fs"] }
|
|
17
|
+
tokio-util = { version = "0.6.9" }
|
|
18
|
+
tokio-stream = "0.1"
|
|
19
|
+
tonic = "0.6"
|
|
20
|
+
tracing = { version = "0.1", features = ["log-always"] }
|
|
21
|
+
|
|
22
|
+
[dependencies.temporal-sdk-core]
|
|
23
|
+
path = "../core"
|
|
24
|
+
version = "0.1"
|
|
25
|
+
|
|
26
|
+
[dependencies.temporal-sdk-core-protos]
|
|
27
|
+
path = "../sdk-core-protos"
|
|
28
|
+
version = "0.1"
|
|
29
|
+
|
|
30
|
+
[dependencies.temporal-sdk-core-api]
|
|
31
|
+
path = "../core-api"
|
|
32
|
+
version = "0.1"
|
|
File without changes
|