@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
|
@@ -26,12 +26,11 @@ pub mod coresdk {
|
|
|
26
26
|
tonic::include_proto!("coresdk");
|
|
27
27
|
|
|
28
28
|
use crate::temporal::api::{
|
|
29
|
-
common::v1::{ActivityType, Payloads, WorkflowExecution},
|
|
29
|
+
common::v1::{ActivityType, Payload, Payloads, WorkflowExecution},
|
|
30
30
|
failure::v1::{failure::FailureInfo, ApplicationFailureInfo, Failure},
|
|
31
31
|
workflowservice::v1::PollActivityTaskQueueResponse,
|
|
32
32
|
};
|
|
33
33
|
use activity_task::ActivityTask;
|
|
34
|
-
use common::Payload;
|
|
35
34
|
use serde::{Deserialize, Serialize};
|
|
36
35
|
use std::{
|
|
37
36
|
collections::HashMap,
|
|
@@ -79,12 +78,9 @@ pub mod coresdk {
|
|
|
79
78
|
#[allow(clippy::module_inception)]
|
|
80
79
|
pub mod activity_result {
|
|
81
80
|
tonic::include_proto!("coresdk.activity_result");
|
|
82
|
-
use super::{
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
failure::v1::{failure, CanceledFailureInfo, Failure as APIFailure},
|
|
86
|
-
},
|
|
87
|
-
common::Payload,
|
|
81
|
+
use super::super::temporal::api::{
|
|
82
|
+
common::v1::Payload,
|
|
83
|
+
failure::v1::{failure, CanceledFailureInfo, Failure as APIFailure},
|
|
88
84
|
};
|
|
89
85
|
use crate::temporal::api::{enums::v1::TimeoutType, failure::v1::TimeoutFailureInfo};
|
|
90
86
|
use activity_execution_result as aer;
|
|
@@ -175,13 +171,11 @@ pub mod coresdk {
|
|
|
175
171
|
}
|
|
176
172
|
}
|
|
177
173
|
|
|
178
|
-
impl From<Result<
|
|
179
|
-
fn from(r: Result<
|
|
174
|
+
impl From<Result<Payload, APIFailure>> for ActivityExecutionResult {
|
|
175
|
+
fn from(r: Result<Payload, APIFailure>) -> Self {
|
|
180
176
|
Self {
|
|
181
177
|
status: match r {
|
|
182
|
-
Ok(p) => Some(aer::Status::Completed(Success {
|
|
183
|
-
result: Some(p.into()),
|
|
184
|
-
})),
|
|
178
|
+
Ok(p) => Some(aer::Status::Completed(Success { result: Some(p) })),
|
|
185
179
|
Err(f) => Some(aer::Status::Failed(Failure { failure: Some(f) })),
|
|
186
180
|
},
|
|
187
181
|
}
|
|
@@ -258,51 +252,9 @@ pub mod coresdk {
|
|
|
258
252
|
use super::external_data::LocalActivityMarkerData;
|
|
259
253
|
use crate::{
|
|
260
254
|
coresdk::{AsJsonPayloadExt, IntoPayloadsExt},
|
|
261
|
-
temporal::api::common::v1::{Payload
|
|
262
|
-
};
|
|
263
|
-
use std::{
|
|
264
|
-
collections::HashMap,
|
|
265
|
-
fmt::{Display, Formatter},
|
|
255
|
+
temporal::api::common::v1::{Payload, Payloads},
|
|
266
256
|
};
|
|
267
|
-
|
|
268
|
-
impl<T> From<T> for Payload
|
|
269
|
-
where
|
|
270
|
-
T: AsRef<[u8]>,
|
|
271
|
-
{
|
|
272
|
-
fn from(v: T) -> Self {
|
|
273
|
-
// TODO: Set better encodings, whole data converter deal. Setting anything for now
|
|
274
|
-
// at least makes it show up in the web UI.
|
|
275
|
-
let mut metadata = HashMap::new();
|
|
276
|
-
metadata.insert("encoding".to_string(), b"binary/plain".to_vec());
|
|
277
|
-
Self {
|
|
278
|
-
metadata,
|
|
279
|
-
data: v.as_ref().to_vec(),
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
impl Payload {
|
|
285
|
-
// Is it's own function b/c asref causes implementation conflicts
|
|
286
|
-
pub fn as_slice(&self) -> &[u8] {
|
|
287
|
-
self.data.as_slice()
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
impl Display for Payload {
|
|
292
|
-
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
293
|
-
if self.data.len() > 64 {
|
|
294
|
-
let mut windows = self.data.as_slice().windows(32);
|
|
295
|
-
write!(
|
|
296
|
-
f,
|
|
297
|
-
"[{}..{}]",
|
|
298
|
-
base64::encode(windows.next().unwrap_or_default()),
|
|
299
|
-
base64::encode(windows.next_back().unwrap_or_default())
|
|
300
|
-
)
|
|
301
|
-
} else {
|
|
302
|
-
write!(f, "[{}]", base64::encode(&self.data))
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
257
|
+
use std::collections::HashMap;
|
|
306
258
|
|
|
307
259
|
pub fn build_has_change_marker_details(
|
|
308
260
|
patch_id: &str,
|
|
@@ -356,7 +308,7 @@ pub mod coresdk {
|
|
|
356
308
|
/// map.
|
|
357
309
|
pub fn extract_local_activity_marker_details(
|
|
358
310
|
details: &mut HashMap<String, Payloads>,
|
|
359
|
-
) -> (Option<LocalActivityMarkerData>, Option<
|
|
311
|
+
) -> (Option<LocalActivityMarkerData>, Option<Payload>) {
|
|
360
312
|
let data = extract_local_activity_marker_data(details);
|
|
361
313
|
let result = details.remove("result").and_then(|mut p| p.payloads.pop());
|
|
362
314
|
(data, result)
|
|
@@ -438,9 +390,8 @@ pub mod coresdk {
|
|
|
438
390
|
pub mod workflow_activation {
|
|
439
391
|
use crate::{
|
|
440
392
|
coresdk::{
|
|
441
|
-
common::
|
|
442
|
-
workflow_activation::remove_from_cache::EvictionReason,
|
|
443
|
-
FromPayloadsExt,
|
|
393
|
+
common::NamespacedWorkflowExecution,
|
|
394
|
+
workflow_activation::remove_from_cache::EvictionReason, FromPayloadsExt,
|
|
444
395
|
},
|
|
445
396
|
temporal::api::{
|
|
446
397
|
common::v1::Header,
|
|
@@ -468,6 +419,7 @@ pub mod coresdk {
|
|
|
468
419
|
timestamp: None,
|
|
469
420
|
run_id,
|
|
470
421
|
is_replaying: false,
|
|
422
|
+
history_length: 0,
|
|
471
423
|
jobs: vec![WorkflowActivationJob::from(
|
|
472
424
|
workflow_activation_job::Variant::RemoveFromCache(RemoveFromCache {
|
|
473
425
|
message,
|
|
@@ -477,21 +429,6 @@ pub mod coresdk {
|
|
|
477
429
|
}
|
|
478
430
|
}
|
|
479
431
|
|
|
480
|
-
pub fn create_query_activation(
|
|
481
|
-
run_id: String,
|
|
482
|
-
queries: impl IntoIterator<Item = QueryWorkflow>,
|
|
483
|
-
) -> WorkflowActivation {
|
|
484
|
-
WorkflowActivation {
|
|
485
|
-
timestamp: None,
|
|
486
|
-
run_id,
|
|
487
|
-
is_replaying: false,
|
|
488
|
-
jobs: queries
|
|
489
|
-
.into_iter()
|
|
490
|
-
.map(|qr| workflow_activation_job::Variant::QueryWorkflow(qr).into())
|
|
491
|
-
.collect(),
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
|
|
495
432
|
pub fn query_to_job(id: String, q: WorkflowQuery) -> QueryWorkflow {
|
|
496
433
|
QueryWorkflow {
|
|
497
434
|
query_id: id,
|
|
@@ -669,10 +606,7 @@ pub mod coresdk {
|
|
|
669
606
|
randomness_seed,
|
|
670
607
|
headers: match attrs.header {
|
|
671
608
|
None => HashMap::new(),
|
|
672
|
-
Some(Header { fields }) => fields
|
|
673
|
-
.into_iter()
|
|
674
|
-
.map(|(k, v)| (k, Payload::from(v)))
|
|
675
|
-
.collect(),
|
|
609
|
+
Some(Header { fields }) => fields,
|
|
676
610
|
},
|
|
677
611
|
identity: attrs.identity,
|
|
678
612
|
parent_workflow_info: attrs.parent_workflow_execution.map(|pe| {
|
|
@@ -834,7 +768,11 @@ pub mod coresdk {
|
|
|
834
768
|
|
|
835
769
|
impl Display for UpsertWorkflowSearchAttributes {
|
|
836
770
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
837
|
-
write!(
|
|
771
|
+
write!(
|
|
772
|
+
f,
|
|
773
|
+
"UpsertWorkflowSearchAttributes({:?})",
|
|
774
|
+
self.search_attributes.keys()
|
|
775
|
+
)
|
|
838
776
|
}
|
|
839
777
|
}
|
|
840
778
|
|
|
@@ -1030,6 +968,14 @@ pub mod coresdk {
|
|
|
1030
968
|
}
|
|
1031
969
|
false
|
|
1032
970
|
}
|
|
971
|
+
|
|
972
|
+
/// Returns true if the activation completion is a success with no commands
|
|
973
|
+
pub fn is_empty(&self) -> bool {
|
|
974
|
+
if let Some(workflow_activation_completion::Status::Successful(s)) = &self.status {
|
|
975
|
+
return s.commands.is_empty();
|
|
976
|
+
}
|
|
977
|
+
false
|
|
978
|
+
}
|
|
1033
979
|
}
|
|
1034
980
|
|
|
1035
981
|
/// Makes converting outgoing lang commands into [WorkflowActivationCompletion]s easier
|
|
@@ -1110,7 +1056,7 @@ pub mod coresdk {
|
|
|
1110
1056
|
activity_task::Start {
|
|
1111
1057
|
workflow_namespace: r.workflow_namespace,
|
|
1112
1058
|
workflow_type: r.workflow_type.map_or_else(|| "".to_string(), |wt| wt.name),
|
|
1113
|
-
workflow_execution: Some(
|
|
1059
|
+
workflow_execution: Some(WorkflowExecution {
|
|
1114
1060
|
workflow_id,
|
|
1115
1061
|
run_id,
|
|
1116
1062
|
}),
|
|
@@ -1146,15 +1092,6 @@ pub mod coresdk {
|
|
|
1146
1092
|
}
|
|
1147
1093
|
}
|
|
1148
1094
|
|
|
1149
|
-
impl From<common::WorkflowExecution> for WorkflowExecution {
|
|
1150
|
-
fn from(exc: common::WorkflowExecution) -> Self {
|
|
1151
|
-
Self {
|
|
1152
|
-
workflow_id: exc.workflow_id,
|
|
1153
|
-
run_id: exc.run_id,
|
|
1154
|
-
}
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
|
|
1158
1095
|
impl Failure {
|
|
1159
1096
|
pub fn is_timeout(&self) -> bool {
|
|
1160
1097
|
matches!(self.failure_info, Some(FailureInfo::TimeoutFailureInfo(_)))
|
|
@@ -1247,30 +1184,12 @@ pub mod coresdk {
|
|
|
1247
1184
|
}
|
|
1248
1185
|
}
|
|
1249
1186
|
|
|
1250
|
-
impl From<common::Payload> for super::temporal::api::common::v1::Payload {
|
|
1251
|
-
fn from(p: Payload) -> Self {
|
|
1252
|
-
Self {
|
|
1253
|
-
metadata: p.metadata,
|
|
1254
|
-
data: p.data,
|
|
1255
|
-
}
|
|
1256
|
-
}
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
impl From<super::temporal::api::common::v1::Payload> for common::Payload {
|
|
1260
|
-
fn from(p: super::temporal::api::common::v1::Payload) -> Self {
|
|
1261
|
-
Self {
|
|
1262
|
-
metadata: p.metadata,
|
|
1263
|
-
data: p.data,
|
|
1264
|
-
}
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
|
|
1268
1187
|
pub trait FromPayloadsExt {
|
|
1269
1188
|
fn from_payloads(p: Option<Payloads>) -> Self;
|
|
1270
1189
|
}
|
|
1271
1190
|
impl<T> FromPayloadsExt for T
|
|
1272
1191
|
where
|
|
1273
|
-
T: FromIterator<
|
|
1192
|
+
T: FromIterator<Payload>,
|
|
1274
1193
|
{
|
|
1275
1194
|
fn from_payloads(p: Option<Payloads>) -> Self {
|
|
1276
1195
|
match p {
|
|
@@ -1285,7 +1204,7 @@ pub mod coresdk {
|
|
|
1285
1204
|
}
|
|
1286
1205
|
impl<T> IntoPayloadsExt for T
|
|
1287
1206
|
where
|
|
1288
|
-
T: IntoIterator<Item =
|
|
1207
|
+
T: IntoIterator<Item = Payload>,
|
|
1289
1208
|
{
|
|
1290
1209
|
fn into_payloads(self) -> Option<Payloads> {
|
|
1291
1210
|
let mut iterd = self.into_iter().peekable();
|
|
@@ -1299,27 +1218,9 @@ pub mod coresdk {
|
|
|
1299
1218
|
}
|
|
1300
1219
|
}
|
|
1301
1220
|
|
|
1302
|
-
impl From<
|
|
1221
|
+
impl From<Payload> for Payloads {
|
|
1303
1222
|
fn from(p: Payload) -> Self {
|
|
1304
|
-
Self {
|
|
1305
|
-
payloads: vec![p.into()],
|
|
1306
|
-
}
|
|
1307
|
-
}
|
|
1308
|
-
}
|
|
1309
|
-
|
|
1310
|
-
impl<T> From<T> for super::temporal::api::common::v1::Payload
|
|
1311
|
-
where
|
|
1312
|
-
T: AsRef<[u8]>,
|
|
1313
|
-
{
|
|
1314
|
-
fn from(v: T) -> Self {
|
|
1315
|
-
// TODO: Set better encodings, whole data converter deal. Setting anything for now
|
|
1316
|
-
// at least makes it show up in the web UI.
|
|
1317
|
-
let mut metadata = HashMap::new();
|
|
1318
|
-
metadata.insert("encoding".to_string(), b"binary/plain".to_vec());
|
|
1319
|
-
Self {
|
|
1320
|
-
metadata,
|
|
1321
|
-
data: v.as_ref().to_vec(),
|
|
1322
|
-
}
|
|
1223
|
+
Self { payloads: vec![p] }
|
|
1323
1224
|
}
|
|
1324
1225
|
}
|
|
1325
1226
|
|
|
@@ -1383,13 +1284,13 @@ pub mod coresdk {
|
|
|
1383
1284
|
}
|
|
1384
1285
|
}
|
|
1385
1286
|
|
|
1386
|
-
/// Errors when converting from a [Payloads] api proto to our internal [
|
|
1287
|
+
/// Errors when converting from a [Payloads] api proto to our internal [Payload]
|
|
1387
1288
|
#[derive(derive_more::Display, Debug)]
|
|
1388
1289
|
pub enum PayloadsToPayloadError {
|
|
1389
1290
|
MoreThanOnePayload,
|
|
1390
1291
|
NoPayload,
|
|
1391
1292
|
}
|
|
1392
|
-
impl TryFrom<Payloads> for
|
|
1293
|
+
impl TryFrom<Payloads> for Payload {
|
|
1393
1294
|
type Error = PayloadsToPayloadError;
|
|
1394
1295
|
|
|
1395
1296
|
fn try_from(mut v: Payloads) -> Result<Self, Self::Error> {
|
|
@@ -1397,7 +1298,7 @@ pub mod coresdk {
|
|
|
1397
1298
|
None => Err(PayloadsToPayloadError::NoPayload),
|
|
1398
1299
|
Some(p) => {
|
|
1399
1300
|
if v.payloads.is_empty() {
|
|
1400
|
-
Ok(p
|
|
1301
|
+
Ok(p)
|
|
1401
1302
|
} else {
|
|
1402
1303
|
Err(PayloadsToPayloadError::MoreThanOnePayload)
|
|
1403
1304
|
}
|
|
@@ -1517,7 +1418,6 @@ pub mod temporal {
|
|
|
1517
1418
|
activity_type: Some(ActivityType {
|
|
1518
1419
|
name: s.activity_type,
|
|
1519
1420
|
}),
|
|
1520
|
-
namespace: s.namespace,
|
|
1521
1421
|
task_queue: Some(s.task_queue.into()),
|
|
1522
1422
|
header: Some(s.headers.into()),
|
|
1523
1423
|
input: s.arguments.into_payloads(),
|
|
@@ -1526,6 +1426,7 @@ pub mod temporal {
|
|
|
1526
1426
|
start_to_close_timeout: s.start_to_close_timeout,
|
|
1527
1427
|
heartbeat_timeout: s.heartbeat_timeout,
|
|
1528
1428
|
retry_policy: s.retry_policy.map(Into::into),
|
|
1429
|
+
request_eager_execution: !s.do_not_eagerly_execute,
|
|
1529
1430
|
},
|
|
1530
1431
|
)
|
|
1531
1432
|
}
|
|
@@ -1622,25 +1523,48 @@ pub mod temporal {
|
|
|
1622
1523
|
}
|
|
1623
1524
|
pub mod common {
|
|
1624
1525
|
pub mod v1 {
|
|
1625
|
-
use crate::coresdk::common;
|
|
1626
1526
|
use std::{
|
|
1627
1527
|
collections::HashMap,
|
|
1628
1528
|
fmt::{Display, Formatter},
|
|
1629
1529
|
};
|
|
1630
1530
|
tonic::include_proto!("temporal.api.common.v1");
|
|
1631
1531
|
|
|
1632
|
-
impl From<
|
|
1633
|
-
|
|
1532
|
+
impl<T> From<T> for Payload
|
|
1533
|
+
where
|
|
1534
|
+
T: AsRef<[u8]>,
|
|
1535
|
+
{
|
|
1536
|
+
fn from(v: T) -> Self {
|
|
1537
|
+
// TODO: Set better encodings, whole data converter deal. Setting anything
|
|
1538
|
+
// for now at least makes it show up in the web UI.
|
|
1539
|
+
let mut metadata = HashMap::new();
|
|
1540
|
+
metadata.insert("encoding".to_string(), b"binary/plain".to_vec());
|
|
1634
1541
|
Self {
|
|
1635
|
-
|
|
1542
|
+
metadata,
|
|
1543
|
+
data: v.as_ref().to_vec(),
|
|
1636
1544
|
}
|
|
1637
1545
|
}
|
|
1638
1546
|
}
|
|
1639
1547
|
|
|
1548
|
+
impl Payload {
|
|
1549
|
+
// Is its own function b/c asref causes implementation conflicts
|
|
1550
|
+
pub fn as_slice(&self) -> &[u8] {
|
|
1551
|
+
self.data.as_slice()
|
|
1552
|
+
}
|
|
1553
|
+
}
|
|
1554
|
+
|
|
1640
1555
|
impl Display for Payload {
|
|
1641
1556
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
1642
|
-
|
|
1643
|
-
|
|
1557
|
+
if self.data.len() > 64 {
|
|
1558
|
+
let mut windows = self.data.as_slice().windows(32);
|
|
1559
|
+
write!(
|
|
1560
|
+
f,
|
|
1561
|
+
"[{}..{}]",
|
|
1562
|
+
base64::encode(windows.next().unwrap_or_default()),
|
|
1563
|
+
base64::encode(windows.next_back().unwrap_or_default())
|
|
1564
|
+
)
|
|
1565
|
+
} else {
|
|
1566
|
+
write!(f, "[{}]", base64::encode(&self.data))
|
|
1567
|
+
}
|
|
1644
1568
|
}
|
|
1645
1569
|
}
|
|
1646
1570
|
|
|
@@ -1655,51 +1579,19 @@ pub mod temporal {
|
|
|
1655
1579
|
}
|
|
1656
1580
|
}
|
|
1657
1581
|
|
|
1658
|
-
impl From<Header> for HashMap<String,
|
|
1582
|
+
impl From<Header> for HashMap<String, Payload> {
|
|
1659
1583
|
fn from(h: Header) -> Self {
|
|
1660
1584
|
h.fields.into_iter().map(|(k, v)| (k, v.into())).collect()
|
|
1661
1585
|
}
|
|
1662
1586
|
}
|
|
1663
1587
|
|
|
1664
|
-
impl From<HashMap<String,
|
|
1665
|
-
fn from(h: HashMap<String,
|
|
1666
|
-
Self {
|
|
1667
|
-
fields: h.into_iter().map(|(k, v)| (k, v.into())).collect(),
|
|
1668
|
-
}
|
|
1669
|
-
}
|
|
1670
|
-
}
|
|
1671
|
-
|
|
1672
|
-
impl From<HashMap<String, common::Payload>> for SearchAttributes {
|
|
1673
|
-
fn from(h: HashMap<String, common::Payload>) -> Self {
|
|
1588
|
+
impl From<HashMap<String, Payload>> for SearchAttributes {
|
|
1589
|
+
fn from(h: HashMap<String, Payload>) -> Self {
|
|
1674
1590
|
Self {
|
|
1675
1591
|
indexed_fields: h.into_iter().map(|(k, v)| (k, v.into())).collect(),
|
|
1676
1592
|
}
|
|
1677
1593
|
}
|
|
1678
1594
|
}
|
|
1679
|
-
|
|
1680
|
-
impl From<common::RetryPolicy> for RetryPolicy {
|
|
1681
|
-
fn from(r: common::RetryPolicy) -> Self {
|
|
1682
|
-
Self {
|
|
1683
|
-
initial_interval: r.initial_interval,
|
|
1684
|
-
backoff_coefficient: r.backoff_coefficient,
|
|
1685
|
-
maximum_interval: r.maximum_interval,
|
|
1686
|
-
maximum_attempts: r.maximum_attempts,
|
|
1687
|
-
non_retryable_error_types: r.non_retryable_error_types,
|
|
1688
|
-
}
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
impl From<RetryPolicy> for common::RetryPolicy {
|
|
1693
|
-
fn from(r: RetryPolicy) -> Self {
|
|
1694
|
-
Self {
|
|
1695
|
-
initial_interval: r.initial_interval,
|
|
1696
|
-
backoff_coefficient: r.backoff_coefficient,
|
|
1697
|
-
maximum_interval: r.maximum_interval,
|
|
1698
|
-
maximum_attempts: r.maximum_attempts,
|
|
1699
|
-
non_retryable_error_types: r.non_retryable_error_types,
|
|
1700
|
-
}
|
|
1701
|
-
}
|
|
1702
|
-
}
|
|
1703
1595
|
}
|
|
1704
1596
|
}
|
|
1705
1597
|
pub mod history {
|
|
@@ -1836,6 +1728,12 @@ pub mod temporal {
|
|
|
1836
1728
|
}
|
|
1837
1729
|
}
|
|
1838
1730
|
|
|
1731
|
+
pub mod schedule {
|
|
1732
|
+
pub mod v1 {
|
|
1733
|
+
tonic::include_proto!("temporal.api.schedule.v1");
|
|
1734
|
+
}
|
|
1735
|
+
}
|
|
1736
|
+
|
|
1839
1737
|
pub mod taskqueue {
|
|
1840
1738
|
pub mod v1 {
|
|
1841
1739
|
use crate::temporal::api::enums::v1::TaskQueueKind;
|