@temporalio/core-bridge 1.13.2 → 1.14.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 +135 -100
- package/Cargo.toml +3 -2
- package/{sdk-core/fsm/rustfsm_trait/LICENSE.txt → LICENSE} +5 -5
- package/README.md +0 -1
- package/bridge-macros/Cargo.toml +16 -0
- package/bridge-macros/src/derive_js_function.rs +126 -0
- package/bridge-macros/src/derive_tryfromjs.rs +138 -0
- package/bridge-macros/src/derive_tryintojs.rs +151 -0
- package/bridge-macros/src/lib.rs +42 -0
- package/lib/native.d.ts +13 -6
- package/package.json +6 -5
- 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 +9 -3
- package/sdk-core/.github/workflows/per-pr.yml +42 -5
- package/sdk-core/AGENTS.md +17 -19
- package/sdk-core/Cargo.toml +6 -7
- package/sdk-core/README.md +12 -15
- package/sdk-core/arch_docs/diagrams/deps.svg +102 -0
- package/sdk-core/{client → crates/client}/Cargo.toml +7 -9
- package/sdk-core/{client → crates/client}/src/lib.rs +110 -159
- package/sdk-core/{client → crates/client}/src/metrics.rs +1 -1
- package/sdk-core/{client → crates/client}/src/raw.rs +73 -44
- package/sdk-core/crates/client/src/request_extensions.rs +40 -0
- package/sdk-core/{client → crates/client}/src/retry.rs +24 -17
- package/sdk-core/crates/client/src/worker/mod.rs +1468 -0
- package/sdk-core/{client → crates/client}/src/workflow_handle/mod.rs +4 -4
- package/sdk-core/{core-api → crates/common}/Cargo.toml +17 -8
- package/sdk-core/crates/common/protos/api_cloud_upstream/VERSION +1 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/account/v1/message.proto +18 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/request_response.proto +38 -11
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto +21 -4
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/operation/v1/message.proto +6 -6
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/sink/v1/message.proto +22 -0
- package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/create-release.yml +5 -0
- package/sdk-core/{core-api → crates/common}/src/envconfig.rs +2 -2
- package/sdk-core/{core-api → crates/common}/src/errors.rs +8 -1
- package/sdk-core/{fsm/rustfsm_trait/src/lib.rs → crates/common/src/fsm_trait.rs} +1 -27
- package/sdk-core/{core-api → crates/common}/src/lib.rs +24 -9
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/canned_histories.rs +1 -1
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_builder.rs +1 -1
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/history_info.rs +2 -2
- package/sdk-core/{sdk-core-protos/src/lib.rs → crates/common/src/protos/mod.rs} +18 -17
- package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/test_utils.rs +1 -1
- package/sdk-core/{core-api → crates/common}/src/telemetry/metrics.rs +447 -50
- package/sdk-core/{core-api → crates/common}/src/telemetry.rs +3 -1
- package/sdk-core/{core-api → crates/common}/src/worker.rs +112 -18
- package/sdk-core/crates/common/tests/worker_task_types_test.rs +129 -0
- package/sdk-core/crates/macros/Cargo.toml +23 -0
- package/sdk-core/{fsm/rustfsm_procmacro → crates/macros}/src/lib.rs +6 -11
- package/sdk-core/{sdk → crates/sdk}/Cargo.toml +10 -10
- package/sdk-core/{sdk → crates/sdk}/src/activity_context.rs +8 -6
- package/sdk-core/{sdk → crates/sdk}/src/interceptors.rs +1 -1
- package/sdk-core/{sdk → crates/sdk}/src/lib.rs +42 -37
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context/options.rs +2 -2
- package/sdk-core/{sdk → crates/sdk}/src/workflow_context.rs +21 -19
- package/sdk-core/{sdk → crates/sdk}/src/workflow_future.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/Cargo.toml +32 -25
- package/sdk-core/{tests → crates/sdk-core/benches}/workflow_replay_bench.rs +10 -10
- package/sdk-core/crates/sdk-core/machine_coverage/ActivityMachine_Coverage.puml +32 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelExternalMachine_Coverage.puml +9 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CancelWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ChildWorkflowMachine_Coverage.puml +27 -0
- package/sdk-core/crates/sdk-core/machine_coverage/CompleteWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ContinueAsNewWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/FailWorkflowMachine_Coverage.puml +6 -0
- package/sdk-core/crates/sdk-core/machine_coverage/LocalActivityMachine_Coverage.puml +23 -0
- package/sdk-core/crates/sdk-core/machine_coverage/ModifyWorkflowPropertiesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/PatchMachine_Coverage.puml +8 -0
- package/sdk-core/crates/sdk-core/machine_coverage/SignalExternalMachine_Coverage.puml +12 -0
- package/sdk-core/crates/sdk-core/machine_coverage/TimerMachine_Coverage.puml +13 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpdateMachine_Coverage.puml +19 -0
- package/sdk-core/crates/sdk-core/machine_coverage/UpsertSearchAttributesMachine_Coverage.puml +5 -0
- package/sdk-core/crates/sdk-core/machine_coverage/WorkflowTaskMachine_Coverage.puml +11 -0
- package/sdk-core/{core → crates/sdk-core}/src/abstractions.rs +62 -6
- package/sdk-core/crates/sdk-core/src/antithesis.rs +60 -0
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/activity_tasks.rs +36 -31
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/mod.rs +12 -9
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/queries.rs +24 -21
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/replay_flag.rs +10 -8
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/updates.rs +17 -15
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workers.rs +242 -17
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_cancels.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/core_tests/workflow_tasks.rs +126 -39
- package/sdk-core/{core → crates/sdk-core}/src/debug_client.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/ephemeral_server/mod.rs +3 -3
- package/sdk-core/crates/sdk-core/src/histfetch.rs +33 -0
- package/sdk-core/{core → crates/sdk-core}/src/internal_flags.rs +4 -3
- package/sdk-core/{core → crates/sdk-core}/src/lib.rs +85 -43
- package/sdk-core/{core → crates/sdk-core}/src/pollers/mod.rs +8 -6
- package/sdk-core/{core → crates/sdk-core}/src/pollers/poll_buffer.rs +51 -16
- package/sdk-core/{core → crates/sdk-core}/src/protosext/mod.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/protosext/protocol_messages.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/replay/mod.rs +14 -11
- package/sdk-core/{core → crates/sdk-core}/src/retry_logic.rs +19 -1
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/log_export.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/metrics.rs +80 -34
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/mod.rs +4 -4
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/otel.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_meter.rs +13 -13
- package/sdk-core/{core → crates/sdk-core}/src/telemetry/prometheus_server.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/test_help/integ_helpers.rs +127 -40
- package/sdk-core/{core → crates/sdk-core}/src/test_help/unit_helpers.rs +13 -11
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/activity_heartbeat_manager.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities/local_activities.rs +14 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/activities.rs +21 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/client/mocks.rs +25 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/client.rs +164 -71
- package/sdk-core/crates/sdk-core/src/worker/heartbeat.rs +246 -0
- package/sdk-core/crates/sdk-core/src/worker/mod.rs +1462 -0
- package/sdk-core/{core → crates/sdk-core}/src/worker/nexus.rs +15 -14
- package/sdk-core/{core → crates/sdk-core}/src/worker/slot_provider.rs +12 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/fixed_size.rs +5 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner/resource_based.rs +453 -57
- package/sdk-core/{core → crates/sdk-core}/src/worker/tuner.rs +21 -4
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/driven_workflow.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/history_update.rs +2 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/activity_state_machine.rs +147 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -9
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_nexus_op_state_machine.rs +14 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/child_workflow_state_machine.rs +31 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/complete_workflow_state_machine.rs +13 -8
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/local_activity_state_machine.rs +33 -30
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/mod.rs +22 -17
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +4 -3
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/nexus_operation_state_machine.rs +20 -22
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/patch_state_machine.rs +12 -11
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/signal_external_state_machine.rs +9 -12
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/timer_state_machine.rs +26 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/transition_coverage.rs +1 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/update_state_machine.rs +19 -13
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +20 -18
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines/local_acts.rs +1 -1
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_machines.rs +61 -70
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/machines/workflow_task_state_machine.rs +13 -15
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/managed_run.rs +55 -37
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/mod.rs +166 -60
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/run_cache.rs +10 -7
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_extraction.rs +4 -2
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/wft_poller.rs +15 -4
- package/sdk-core/{core → crates/sdk-core}/src/worker/workflow/workflow_stream.rs +30 -16
- package/sdk-core/{tests → crates/sdk-core/tests}/c_bridge_smoke_test.c +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/cloud_tests.rs +1 -1
- package/sdk-core/crates/sdk-core/tests/common/fake_grpc_server.rs +106 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/common/http_proxy.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/common/mod.rs +93 -74
- package/sdk-core/{tests → crates/sdk-core/tests}/common/workflows.rs +4 -3
- package/sdk-core/crates/sdk-core/tests/fsm_procmacro.rs +6 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dupe_transitions_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/dupe_transitions_fail.stderr +12 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/dynamic_dest_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.rs +1 -3
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/forgot_name_fail.stderr +4 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_arg_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/handler_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/medium_complex_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/no_handle_conversions_require_into_fail.rs +2 -4
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/no_handle_conversions_require_into_fail.stderr +15 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/simple_pass.rs +2 -4
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/struct_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/struct_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_more_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{fsm/rustfsm_procmacro/tests/trybuild → crates/sdk-core/tests/fsm_trybuild}/tuple_zero_item_event_variant_fail.rs +1 -3
- package/sdk-core/crates/sdk-core/tests/fsm_trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/global_metric_tests.rs +14 -15
- package/sdk-core/{tests → crates/sdk-core/tests/heavy_tests}/fuzzy_workflow.rs +3 -3
- package/sdk-core/{tests → crates/sdk-core/tests}/heavy_tests.rs +19 -12
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/activity_functions.rs +1 -1
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/client_tests.rs +16 -111
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/ephemeral_server_tests.rs +5 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/heartbeat_tests.rs +23 -19
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/metrics_tests.rs +134 -60
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/pagination_tests.rs +4 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/polling_tests.rs +37 -36
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/queries_tests.rs +12 -10
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/update_tests.rs +41 -29
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/visibility_tests.rs +24 -19
- package/sdk-core/crates/sdk-core/tests/integ_tests/worker_heartbeat_tests.rs +1061 -0
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_tests.rs +113 -51
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/worker_versioning_tests.rs +19 -17
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/activities.rs +35 -30
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/appdata_propagation.rs +3 -3
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_external.rs +14 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/cancel_wf.rs +13 -8
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/child_workflows.rs +48 -35
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/continue_as_new.rs +14 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/determinism.rs +24 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/eager.rs +9 -4
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/local_activities.rs +47 -47
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/modify_wf_properties.rs +16 -11
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/nexus.rs +51 -23
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/patches.rs +22 -10
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/replay.rs +19 -17
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/resets.rs +14 -5
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/signals.rs +24 -15
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/stickyness.rs +8 -6
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/timers.rs +28 -18
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/upsert_search_attrs.rs +18 -13
- package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests.rs +46 -41
- package/sdk-core/{tests → crates/sdk-core/tests}/main.rs +15 -9
- package/sdk-core/{tests → crates/sdk-core/tests}/manual_tests.rs +20 -14
- package/sdk-core/{tests → crates/sdk-core/tests}/runner.rs +2 -2
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/mod.rs +10 -5
- package/sdk-core/{tests → crates/sdk-core/tests}/shared_tests/priority.rs +5 -5
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/Cargo.toml +13 -10
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/include/temporal-sdk-core-c-bridge.h +32 -23
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/client.rs +55 -32
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/envconfig.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/lib.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/metric.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/runtime.rs +24 -9
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/testing.rs +1 -1
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/context.rs +11 -10
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/mod.rs +7 -7
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/tests/utils.rs +3 -4
- package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/worker.rs +111 -58
- package/sdk-core/docker-cgroup-tests.sh +24 -0
- package/sdk-core/{docker → etc/docker}/docker-compose-ci.yaml +9 -9
- package/sdk-core/{docker → etc/docker}/docker-compose-telem.yaml +11 -11
- package/sdk-core/{docker → etc/docker}/docker-compose.yaml +8 -8
- package/sdk-core/{integ-with-otel.sh → etc/integ-with-otel.sh} +1 -1
- package/sdk-core/etc/regen-depgraph.sh +2 -2
- package/src/client.rs +24 -33
- package/src/helpers/try_from_js.rs +1 -1
- package/src/logs.rs +1 -1
- package/src/metrics.rs +3 -3
- package/src/runtime.rs +42 -28
- package/src/testing.rs +3 -3
- package/src/worker.rs +70 -36
- package/ts/native.ts +13 -6
- package/LICENSE.md +0 -23
- package/sdk-core/client/src/worker_registry/mod.rs +0 -282
- package/sdk-core/core/src/worker/heartbeat.rs +0 -230
- package/sdk-core/core/src/worker/mod.rs +0 -990
- package/sdk-core/etc/deps.svg +0 -162
- package/sdk-core/fsm/Cargo.toml +0 -21
- package/sdk-core/fsm/README.md +0 -3
- package/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +0 -27
- package/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +0 -21
- package/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +0 -8
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +0 -12
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +0 -15
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +0 -5
- package/sdk-core/fsm/rustfsm_trait/Cargo.toml +0 -14
- package/sdk-core/fsm/src/lib.rs +0 -2
- package/sdk-core/sdk-core-protos/Cargo.toml +0 -37
- package/sdk-core/sdk-core-protos/protos/api_cloud_upstream/VERSION +0 -1
- /package/sdk-core/{client → crates/client}/src/callback_based.rs +0 -0
- /package/sdk-core/{client → crates/client}/src/proxy.rs +0 -0
- /package/sdk-core/{client → crates/client}/src/replaceable.rs +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/build.rs +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/build.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/connectivityrule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/identity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/namespace/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/region/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/resource/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_cloud_upstream/temporal/api/cloud/usage/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/CODEOWNERS +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/ci.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/publish-docs.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/push-to-buf.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-delete-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-publish-release.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/.github/workflows/trigger-api-go-update.yml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/LICENSE +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/README.md +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.gen.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.lock +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/annotations.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/api/http.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/any.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/descriptor.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/duration.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/empty.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/struct.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/timestamp.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/google/protobuf/wrappers.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv2.json +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/openapiv3.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/openapi/payload_description.txt +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/activity/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/batch/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/command/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/common/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/deployment/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/command_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/deployment.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/event_type.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/namespace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/query.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/reset.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/schedule.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/update.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/enums/v1/workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/errordetails/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/export/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/failure/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/filter/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/history/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/namespace/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/nexus/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/protocol/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/query/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/replication/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/rules/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/schedule/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/enhanced_stack_trace.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/user_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/worker_config.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/sdk/v1/workflow_metadata.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/update/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/version/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/worker/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflow/v1/message.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/google/rpc/status.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/grpc/health/v1/health.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_result/activity_result.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/activity_task/activity_task.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/common/common.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/core_interface.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/external_data/external_data.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/nexus/nexus.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/Makefile +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/api-linter.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/buf.yaml +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +0 -0
- /package/sdk-core/{sdk-core-protos → crates/common}/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/constants.rs +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/task_token.rs +0 -0
- /package/sdk-core/{sdk-core-protos/src → crates/common/src/protos}/utilities.rs +0 -0
- /package/sdk-core/{fsm → crates/macros}/LICENSE.txt +0 -0
- /package/sdk-core/{sdk → crates/sdk}/src/app_data.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/abstractions/take_cell.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/test_help/mod.rs +0 -0
- /package/sdk-core/{core → crates/sdk-core}/src/worker/slot_supplier.rs +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/ends_empty_wft_complete.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-16_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-23_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/evict_while_la_running_no_interference-85_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/fail_wf_task.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-0_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-1_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-2_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/long_local_activity_with_update-3_history.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/old_change_marker_format.bin +0 -0
- /package/sdk-core/{histories → crates/sdk-core/tests/histories}/timer_workflow_history.bin +0 -0
- /package/sdk-core/{tests → crates/sdk-core/tests}/integ_tests/workflow_tests/priority.rs +0 -0
- /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/build.rs +0 -0
- /package/sdk-core/{core-c-bridge → crates/sdk-core-c-bridge}/src/random.rs +0 -0
- /package/sdk-core/{cargo-tokio-console.sh → etc/cargo-tokio-console.sh} +0 -0
|
@@ -6,21 +6,23 @@ use crate::{
|
|
|
6
6
|
Client, ConfiguredClient, LONG_POLL_TIMEOUT, RequestExt, RetryClient, SharedReplaceableClient,
|
|
7
7
|
TEMPORAL_NAMESPACE_HEADER_KEY, TemporalServiceClient,
|
|
8
8
|
metrics::namespace_kv,
|
|
9
|
-
|
|
9
|
+
worker::{ClientWorkerSet, Slot},
|
|
10
10
|
};
|
|
11
11
|
use dyn_clone::DynClone;
|
|
12
12
|
use futures_util::{FutureExt, TryFutureExt, future::BoxFuture};
|
|
13
13
|
use std::{any::Any, marker::PhantomData, sync::Arc};
|
|
14
|
-
use
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
use temporalio_common::{
|
|
15
|
+
protos::{
|
|
16
|
+
grpc::health::v1::{health_client::HealthClient, *},
|
|
17
|
+
temporal::api::{
|
|
18
|
+
cloud::cloudservice::{v1 as cloudreq, v1::cloud_service_client::CloudServiceClient},
|
|
19
|
+
operatorservice::v1::{operator_service_client::OperatorServiceClient, *},
|
|
20
|
+
taskqueue::v1::TaskQueue,
|
|
21
|
+
testservice::v1::{test_service_client::TestServiceClient, *},
|
|
22
|
+
workflowservice::v1::{workflow_service_client::WorkflowServiceClient, *},
|
|
23
|
+
},
|
|
23
24
|
},
|
|
25
|
+
telemetry::metrics::MetricKeyValue,
|
|
24
26
|
};
|
|
25
27
|
use tonic::{
|
|
26
28
|
Request, Response, Status,
|
|
@@ -33,7 +35,7 @@ use tonic::{
|
|
|
33
35
|
trait RawClientProducer {
|
|
34
36
|
/// Returns information about workers associated with this client. Implementers outside of
|
|
35
37
|
/// core can safely return `None`.
|
|
36
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
38
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>>;
|
|
37
39
|
|
|
38
40
|
/// Return a workflow service client instance
|
|
39
41
|
fn workflow_client(&mut self) -> Box<dyn WorkflowService>;
|
|
@@ -175,7 +177,7 @@ impl<RC> RawClientProducer for RetryClient<RC>
|
|
|
175
177
|
where
|
|
176
178
|
RC: RawClientProducer + 'static,
|
|
177
179
|
{
|
|
178
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
180
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
|
|
179
181
|
self.get_client().get_workers_info()
|
|
180
182
|
}
|
|
181
183
|
|
|
@@ -253,7 +255,7 @@ impl<RC> RawClientProducer for SharedReplaceableClient<RC>
|
|
|
253
255
|
where
|
|
254
256
|
RC: RawClientProducer + Clone + Send + Sync + 'static,
|
|
255
257
|
{
|
|
256
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
258
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
|
|
257
259
|
self.inner_cow().get_workers_info()
|
|
258
260
|
}
|
|
259
261
|
fn workflow_client(&mut self) -> Box<dyn WorkflowService> {
|
|
@@ -284,7 +286,7 @@ impl<RC> RawGrpcCaller for SharedReplaceableClient<RC> where
|
|
|
284
286
|
}
|
|
285
287
|
|
|
286
288
|
impl RawClientProducer for TemporalServiceClient {
|
|
287
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
289
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
|
|
288
290
|
None
|
|
289
291
|
}
|
|
290
292
|
|
|
@@ -312,7 +314,7 @@ impl RawClientProducer for TemporalServiceClient {
|
|
|
312
314
|
impl RawGrpcCaller for TemporalServiceClient {}
|
|
313
315
|
|
|
314
316
|
impl RawClientProducer for ConfiguredClient<TemporalServiceClient> {
|
|
315
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
317
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
|
|
316
318
|
Some(self.workers())
|
|
317
319
|
}
|
|
318
320
|
|
|
@@ -340,7 +342,7 @@ impl RawClientProducer for ConfiguredClient<TemporalServiceClient> {
|
|
|
340
342
|
impl RawGrpcCaller for ConfiguredClient<TemporalServiceClient> {}
|
|
341
343
|
|
|
342
344
|
impl RawClientProducer for Client {
|
|
343
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
345
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
|
|
344
346
|
self.inner.get_workers_info()
|
|
345
347
|
}
|
|
346
348
|
|
|
@@ -491,7 +493,7 @@ macro_rules! proxy_impl {
|
|
|
491
493
|
mut request: tonic::Request<$req>,
|
|
492
494
|
) -> BoxFuture<'_, Result<tonic::Response<$resp>, tonic::Status>> {
|
|
493
495
|
type_closure_arg(&mut request, $closure_request);
|
|
494
|
-
let data = type_closure_two_arg(&mut request, Option::<Arc<
|
|
496
|
+
let data = type_closure_two_arg(&mut request, Option::<Arc<ClientWorkerSet>>::None,
|
|
495
497
|
$closure_before);
|
|
496
498
|
async move {
|
|
497
499
|
type_closure_two_arg(<$client_type<_>>::$method(self, request).await,
|
|
@@ -649,16 +651,15 @@ proxier! {
|
|
|
649
651
|
Some(reservation) => {
|
|
650
652
|
// Populate eager_worker_deployment_options from the slot reservation
|
|
651
653
|
if let Some(opts) = reservation.deployment_options {
|
|
652
|
-
req_mut.eager_worker_deployment_options = Some(
|
|
654
|
+
req_mut.eager_worker_deployment_options = Some(temporalio_common::protos::temporal::api::deployment::v1::WorkerDeploymentOptions {
|
|
653
655
|
deployment_name: opts.version.deployment_name,
|
|
654
656
|
build_id: opts.version.build_id,
|
|
655
657
|
worker_versioning_mode: if opts.use_worker_versioning {
|
|
656
|
-
|
|
658
|
+
temporalio_common::protos::temporal::api::enums::v1::WorkerVersioningMode::Versioned.into()
|
|
657
659
|
} else {
|
|
658
|
-
|
|
660
|
+
temporalio_common::protos::temporal::api::enums::v1::WorkerVersioningMode::Unversioned.into()
|
|
659
661
|
},
|
|
660
|
-
});
|
|
661
|
-
}
|
|
662
|
+
}); }
|
|
662
663
|
slot = Some(reservation.slot);
|
|
663
664
|
}
|
|
664
665
|
None => req_mut.request_eager_execution = false
|
|
@@ -1574,6 +1575,8 @@ proxier! {
|
|
|
1574
1575
|
(get_connectivity_rule, cloudreq::GetConnectivityRuleRequest, cloudreq::GetConnectivityRuleResponse);
|
|
1575
1576
|
(get_connectivity_rules, cloudreq::GetConnectivityRulesRequest, cloudreq::GetConnectivityRulesResponse);
|
|
1576
1577
|
(delete_connectivity_rule, cloudreq::DeleteConnectivityRuleRequest, cloudreq::DeleteConnectivityRuleResponse);
|
|
1578
|
+
(set_service_account_namespace_access, cloudreq::SetServiceAccountNamespaceAccessRequest, cloudreq::SetServiceAccountNamespaceAccessResponse);
|
|
1579
|
+
(validate_account_audit_log_sink, cloudreq::ValidateAccountAuditLogSinkRequest, cloudreq::ValidateAccountAuditLogSinkResponse);
|
|
1577
1580
|
}
|
|
1578
1581
|
|
|
1579
1582
|
proxier! {
|
|
@@ -1595,19 +1598,28 @@ proxier! {
|
|
|
1595
1598
|
#[cfg(test)]
|
|
1596
1599
|
mod tests {
|
|
1597
1600
|
use super::*;
|
|
1598
|
-
use crate::{
|
|
1601
|
+
use crate::{ClientOptions, RetryClient};
|
|
1599
1602
|
use std::collections::HashSet;
|
|
1600
|
-
use
|
|
1601
|
-
|
|
1603
|
+
use temporalio_common::{
|
|
1604
|
+
protos::temporal::api::{
|
|
1605
|
+
operatorservice::v1::DeleteNamespaceRequest, workflowservice::v1::ListNamespacesRequest,
|
|
1606
|
+
},
|
|
1607
|
+
worker::WorkerTaskTypes,
|
|
1602
1608
|
};
|
|
1603
1609
|
use tonic::IntoRequest;
|
|
1610
|
+
use url::Url;
|
|
1611
|
+
use uuid::Uuid;
|
|
1604
1612
|
|
|
1605
1613
|
// Just to help make sure some stuff compiles. Not run.
|
|
1606
1614
|
#[allow(dead_code)]
|
|
1607
1615
|
async fn raw_client_retry_compiles() {
|
|
1608
|
-
let opts =
|
|
1616
|
+
let opts = ClientOptions::builder()
|
|
1617
|
+
.target_url(Url::parse("http://localhost:7233").unwrap())
|
|
1618
|
+
.client_name("test")
|
|
1619
|
+
.client_version("0.0.0")
|
|
1620
|
+
.build();
|
|
1609
1621
|
let raw_client = opts.connect_no_namespace(None).await.unwrap();
|
|
1610
|
-
let mut retry_client = RetryClient::new(raw_client, opts.
|
|
1622
|
+
let mut retry_client = RetryClient::new(raw_client, opts.retry_options);
|
|
1611
1623
|
|
|
1612
1624
|
let list_ns_req = ListNamespacesRequest::default();
|
|
1613
1625
|
let fact = |c: &mut RetryClient<_>, req| {
|
|
@@ -1690,7 +1702,7 @@ mod tests {
|
|
|
1690
1702
|
fn verify_all_workflow_service_methods_implemented() {
|
|
1691
1703
|
// This is less work than trying to hook into the codegen process
|
|
1692
1704
|
let proto_def = include_str!(
|
|
1693
|
-
"../../
|
|
1705
|
+
"../../common/protos/api_upstream/temporal/api/workflowservice/v1/service.proto"
|
|
1694
1706
|
);
|
|
1695
1707
|
verify_methods(proto_def, ALL_IMPLEMENTED_WORKFLOW_SERVICE_RPCS);
|
|
1696
1708
|
}
|
|
@@ -1698,7 +1710,7 @@ mod tests {
|
|
|
1698
1710
|
#[test]
|
|
1699
1711
|
fn verify_all_operator_service_methods_implemented() {
|
|
1700
1712
|
let proto_def = include_str!(
|
|
1701
|
-
"../../
|
|
1713
|
+
"../../common/protos/api_upstream/temporal/api/operatorservice/v1/service.proto"
|
|
1702
1714
|
);
|
|
1703
1715
|
verify_methods(proto_def, ALL_IMPLEMENTED_OPERATOR_SERVICE_RPCS);
|
|
1704
1716
|
}
|
|
@@ -1706,7 +1718,7 @@ mod tests {
|
|
|
1706
1718
|
#[test]
|
|
1707
1719
|
fn verify_all_cloud_service_methods_implemented() {
|
|
1708
1720
|
let proto_def = include_str!(
|
|
1709
|
-
"../../
|
|
1721
|
+
"../../common/protos/api_cloud_upstream/temporal/api/cloud/cloudservice/v1/service.proto"
|
|
1710
1722
|
);
|
|
1711
1723
|
verify_methods(proto_def, ALL_IMPLEMENTED_CLOUD_SERVICE_RPCS);
|
|
1712
1724
|
}
|
|
@@ -1714,14 +1726,14 @@ mod tests {
|
|
|
1714
1726
|
#[test]
|
|
1715
1727
|
fn verify_all_test_service_methods_implemented() {
|
|
1716
1728
|
let proto_def = include_str!(
|
|
1717
|
-
"../../
|
|
1729
|
+
"../../common/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto"
|
|
1718
1730
|
);
|
|
1719
1731
|
verify_methods(proto_def, ALL_IMPLEMENTED_TEST_SERVICE_RPCS);
|
|
1720
1732
|
}
|
|
1721
1733
|
|
|
1722
1734
|
#[test]
|
|
1723
1735
|
fn verify_all_health_service_methods_implemented() {
|
|
1724
|
-
let proto_def = include_str!("../../
|
|
1736
|
+
let proto_def = include_str!("../../common/protos/grpc/health/v1/health.proto");
|
|
1725
1737
|
verify_methods(proto_def, ALL_IMPLEMENTED_HEALTH_SERVICE_RPCS);
|
|
1726
1738
|
}
|
|
1727
1739
|
|
|
@@ -1791,9 +1803,11 @@ mod tests {
|
|
|
1791
1803
|
#[case::without_versioning(false)]
|
|
1792
1804
|
#[tokio::test]
|
|
1793
1805
|
async fn eager_reservations_attach_deployment_options(#[case] use_worker_versioning: bool) {
|
|
1794
|
-
use crate::
|
|
1795
|
-
use
|
|
1796
|
-
|
|
1806
|
+
use crate::worker::{MockClientWorker, MockSlot};
|
|
1807
|
+
use temporalio_common::{
|
|
1808
|
+
protos::temporal::api::enums::v1::WorkerVersioningMode,
|
|
1809
|
+
worker::{WorkerDeploymentOptions, WorkerDeploymentVersion},
|
|
1810
|
+
};
|
|
1797
1811
|
|
|
1798
1812
|
let expected_mode = if use_worker_versioning {
|
|
1799
1813
|
WorkerVersioningMode::Versioned
|
|
@@ -1803,13 +1817,13 @@ mod tests {
|
|
|
1803
1817
|
|
|
1804
1818
|
#[derive(Clone)]
|
|
1805
1819
|
struct MyFakeServices {
|
|
1806
|
-
|
|
1820
|
+
client_worker_set: Arc<ClientWorkerSet>,
|
|
1807
1821
|
expected_mode: WorkerVersioningMode,
|
|
1808
1822
|
}
|
|
1809
1823
|
impl RawGrpcCaller for MyFakeServices {}
|
|
1810
1824
|
impl RawClientProducer for MyFakeServices {
|
|
1811
|
-
fn get_workers_info(&self) -> Option<Arc<
|
|
1812
|
-
Some(self.
|
|
1825
|
+
fn get_workers_info(&self) -> Option<Arc<ClientWorkerSet>> {
|
|
1826
|
+
Some(self.client_worker_set.clone())
|
|
1813
1827
|
}
|
|
1814
1828
|
fn workflow_client(&mut self) -> Box<dyn WorkflowService> {
|
|
1815
1829
|
Box::new(MyFakeWfClient {
|
|
@@ -1839,7 +1853,7 @@ mod tests {
|
|
|
1839
1853
|
default_versioning_behavior: None,
|
|
1840
1854
|
};
|
|
1841
1855
|
|
|
1842
|
-
let mut mock_provider =
|
|
1856
|
+
let mut mock_provider = MockClientWorker::new();
|
|
1843
1857
|
mock_provider
|
|
1844
1858
|
.expect_namespace()
|
|
1845
1859
|
.return_const("test-namespace".to_string());
|
|
@@ -1854,9 +1868,24 @@ mod tests {
|
|
|
1854
1868
|
mock_provider
|
|
1855
1869
|
.expect_deployment_options()
|
|
1856
1870
|
.return_const(Some(deployment_opts.clone()));
|
|
1857
|
-
|
|
1858
|
-
let
|
|
1859
|
-
|
|
1871
|
+
mock_provider.expect_heartbeat_enabled().return_const(false);
|
|
1872
|
+
let uuid = Uuid::new_v4();
|
|
1873
|
+
mock_provider
|
|
1874
|
+
.expect_worker_instance_key()
|
|
1875
|
+
.return_const(uuid);
|
|
1876
|
+
mock_provider
|
|
1877
|
+
.expect_worker_task_types()
|
|
1878
|
+
.return_const(WorkerTaskTypes {
|
|
1879
|
+
enable_workflows: true,
|
|
1880
|
+
enable_local_activities: true,
|
|
1881
|
+
enable_remote_activities: true,
|
|
1882
|
+
enable_nexus: true,
|
|
1883
|
+
});
|
|
1884
|
+
|
|
1885
|
+
let client_worker_set = Arc::new(ClientWorkerSet::new());
|
|
1886
|
+
client_worker_set
|
|
1887
|
+
.register_worker(Arc::new(mock_provider), true)
|
|
1888
|
+
.unwrap();
|
|
1860
1889
|
|
|
1861
1890
|
#[derive(Clone)]
|
|
1862
1891
|
struct MyFakeWfClient {
|
|
@@ -1886,7 +1915,7 @@ mod tests {
|
|
|
1886
1915
|
}
|
|
1887
1916
|
|
|
1888
1917
|
let mut mfs = MyFakeServices {
|
|
1889
|
-
|
|
1918
|
+
client_worker_set,
|
|
1890
1919
|
expected_mode,
|
|
1891
1920
|
};
|
|
1892
1921
|
|
|
@@ -1895,7 +1924,7 @@ mod tests {
|
|
|
1895
1924
|
namespace: "test-namespace".to_string(),
|
|
1896
1925
|
workflow_id: "test-wf-id".to_string(),
|
|
1897
1926
|
workflow_type: Some(
|
|
1898
|
-
|
|
1927
|
+
temporalio_common::protos::temporal::api::common::v1::WorkflowType {
|
|
1899
1928
|
name: "test-workflow".to_string(),
|
|
1900
1929
|
},
|
|
1901
1930
|
),
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
//! Request extensions for tonic gRPC requests.
|
|
2
|
+
//!
|
|
3
|
+
//! These types can be inserted into tonic request extensions to modify behavior of the
|
|
4
|
+
//! [RetryClient](crate::RetryClient) or other request handling logic.
|
|
5
|
+
|
|
6
|
+
use crate::RetryOptions;
|
|
7
|
+
use std::time::Duration;
|
|
8
|
+
|
|
9
|
+
/// A request extension that, when set, should make the [RetryClient](crate::RetryClient) consider
|
|
10
|
+
/// this call to be a [CallType::TaskLongPoll](crate::CallType::TaskLongPoll)
|
|
11
|
+
#[derive(Copy, Clone, Debug)]
|
|
12
|
+
pub struct IsWorkerTaskLongPoll;
|
|
13
|
+
|
|
14
|
+
/// A request extension that, when set, and a call is being processed by a
|
|
15
|
+
/// [RetryClient](crate::RetryClient), allows the caller to request certain matching errors to
|
|
16
|
+
/// short-circuit-return immediately and not follow normal retry logic.
|
|
17
|
+
#[derive(Copy, Clone, Debug)]
|
|
18
|
+
pub struct NoRetryOnMatching {
|
|
19
|
+
/// Return true if the passed-in gRPC error should be immediately returned to the caller
|
|
20
|
+
pub predicate: fn(&tonic::Status) -> bool,
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/// A request extension that forces overriding the current retry policy of the
|
|
24
|
+
/// [RetryClient](crate::RetryClient).
|
|
25
|
+
#[derive(Clone, Debug)]
|
|
26
|
+
pub struct RetryConfigForCall(pub RetryOptions);
|
|
27
|
+
|
|
28
|
+
/// Extension trait for tonic requests to set default timeouts
|
|
29
|
+
pub trait RequestExt {
|
|
30
|
+
/// Set a timeout for a request if one is not already specified in the metadata
|
|
31
|
+
fn set_default_timeout(&mut self, duration: Duration);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
impl<T> RequestExt for tonic::Request<T> {
|
|
35
|
+
fn set_default_timeout(&mut self, duration: Duration) {
|
|
36
|
+
if !self.metadata().contains_key("grpc-timeout") {
|
|
37
|
+
self.set_timeout(duration)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
use crate::{
|
|
2
|
-
ERROR_RETURNED_DUE_TO_SHORT_CIRCUIT,
|
|
3
|
-
|
|
2
|
+
ERROR_RETURNED_DUE_TO_SHORT_CIRCUIT, MESSAGE_TOO_LARGE_KEY, NamespacedClient, Result,
|
|
3
|
+
RetryOptions,
|
|
4
|
+
raw::IsUserLongPoll,
|
|
5
|
+
request_extensions::{IsWorkerTaskLongPoll, NoRetryOnMatching, RetryConfigForCall},
|
|
4
6
|
};
|
|
5
7
|
use backoff::{Clock, SystemClock, backoff::Backoff, exponential::ExponentialBackoff};
|
|
6
8
|
use futures_retry::{ErrorHandler, FutureRetry, RetryPolicy};
|
|
@@ -8,6 +10,7 @@ use std::{error::Error, fmt::Debug, future::Future, sync::Arc, time::Duration};
|
|
|
8
10
|
use tonic::{Code, Request};
|
|
9
11
|
|
|
10
12
|
/// List of gRPC error codes that client will retry.
|
|
13
|
+
#[doc(hidden)]
|
|
11
14
|
pub const RETRYABLE_ERROR_CODES: [Code; 7] = [
|
|
12
15
|
Code::DataLoss,
|
|
13
16
|
Code::Internal,
|
|
@@ -19,17 +22,17 @@ pub const RETRYABLE_ERROR_CODES: [Code; 7] = [
|
|
|
19
22
|
];
|
|
20
23
|
const LONG_POLL_FATAL_GRACE: Duration = Duration::from_secs(60);
|
|
21
24
|
|
|
22
|
-
/// A wrapper for a [WorkflowClientTrait] or [crate::WorkflowService] implementor which
|
|
23
|
-
/// auto-retries
|
|
25
|
+
/// A wrapper for a [crate::WorkflowClientTrait] or [crate::WorkflowService] implementor which
|
|
26
|
+
/// performs auto-retries
|
|
24
27
|
#[derive(Debug, Clone)]
|
|
25
28
|
pub struct RetryClient<SG> {
|
|
26
29
|
client: SG,
|
|
27
|
-
retry_config: Arc<
|
|
30
|
+
retry_config: Arc<RetryOptions>,
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
impl<SG> RetryClient<SG> {
|
|
31
34
|
/// Use the provided retry config with the provided client
|
|
32
|
-
pub fn new(client: SG, retry_config:
|
|
35
|
+
pub fn new(client: SG, retry_config: RetryOptions) -> Self {
|
|
33
36
|
Self {
|
|
34
37
|
client,
|
|
35
38
|
retry_config: Arc::new(retry_config),
|
|
@@ -60,6 +63,7 @@ impl<SG> RetryClient<SG> {
|
|
|
60
63
|
) -> CallInfo {
|
|
61
64
|
let mut call_type = CallType::Normal;
|
|
62
65
|
let mut retry_short_circuit = None;
|
|
66
|
+
let mut retry_cfg_override = None;
|
|
63
67
|
if let Some(r) = request.as_ref() {
|
|
64
68
|
let ext = r.extensions();
|
|
65
69
|
if ext.get::<IsUserLongPoll>().is_some() {
|
|
@@ -69,9 +73,12 @@ impl<SG> RetryClient<SG> {
|
|
|
69
73
|
}
|
|
70
74
|
|
|
71
75
|
retry_short_circuit = ext.get::<NoRetryOnMatching>().cloned();
|
|
76
|
+
retry_cfg_override = ext.get::<RetryConfigForCall>().cloned();
|
|
72
77
|
}
|
|
73
|
-
let retry_cfg = if
|
|
74
|
-
|
|
78
|
+
let retry_cfg = if let Some(ovr) = retry_cfg_override {
|
|
79
|
+
ovr.0
|
|
80
|
+
} else if call_type == CallType::TaskLongPoll {
|
|
81
|
+
RetryOptions::task_poll_retry_policy()
|
|
75
82
|
} else {
|
|
76
83
|
(*self.retry_config).clone()
|
|
77
84
|
};
|
|
@@ -93,7 +100,7 @@ impl<SG> RetryClient<SG> {
|
|
|
93
100
|
{
|
|
94
101
|
FutureRetry::new(
|
|
95
102
|
factory,
|
|
96
|
-
TonicErrorHandler::new(info,
|
|
103
|
+
TonicErrorHandler::new(info, RetryOptions::throttle_retry_policy()),
|
|
97
104
|
)
|
|
98
105
|
}
|
|
99
106
|
}
|
|
@@ -122,7 +129,7 @@ pub(crate) struct TonicErrorHandler<C: Clock> {
|
|
|
122
129
|
retry_short_circuit: Option<NoRetryOnMatching>,
|
|
123
130
|
}
|
|
124
131
|
impl TonicErrorHandler<SystemClock> {
|
|
125
|
-
fn new(call_info: CallInfo, throttle_cfg:
|
|
132
|
+
fn new(call_info: CallInfo, throttle_cfg: RetryOptions) -> Self {
|
|
126
133
|
Self::new_with_clock(
|
|
127
134
|
call_info,
|
|
128
135
|
throttle_cfg,
|
|
@@ -137,7 +144,7 @@ where
|
|
|
137
144
|
{
|
|
138
145
|
fn new_with_clock(
|
|
139
146
|
call_info: CallInfo,
|
|
140
|
-
throttle_cfg:
|
|
147
|
+
throttle_cfg: RetryOptions,
|
|
141
148
|
clock: C,
|
|
142
149
|
throttle_clock: C,
|
|
143
150
|
) -> Self {
|
|
@@ -178,7 +185,7 @@ where
|
|
|
178
185
|
pub(crate) struct CallInfo {
|
|
179
186
|
pub call_type: CallType,
|
|
180
187
|
call_name: &'static str,
|
|
181
|
-
retry_cfg:
|
|
188
|
+
retry_cfg: RetryOptions,
|
|
182
189
|
retry_short_circuit: Option<NoRetryOnMatching>,
|
|
183
190
|
}
|
|
184
191
|
|
|
@@ -304,13 +311,13 @@ mod tests {
|
|
|
304
311
|
use assert_matches::assert_matches;
|
|
305
312
|
use backoff::Clock;
|
|
306
313
|
use std::{ops::Add, time::Instant};
|
|
307
|
-
use
|
|
314
|
+
use temporalio_common::protos::temporal::api::workflowservice::v1::{
|
|
308
315
|
PollActivityTaskQueueRequest, PollNexusTaskQueueRequest, PollWorkflowTaskQueueRequest,
|
|
309
316
|
};
|
|
310
317
|
use tonic::{IntoRequest, Status};
|
|
311
318
|
|
|
312
319
|
/// Predefined retry configs with low durations to make unit tests faster
|
|
313
|
-
const TEST_RETRY_CONFIG:
|
|
320
|
+
const TEST_RETRY_CONFIG: RetryOptions = RetryOptions {
|
|
314
321
|
initial_interval: Duration::from_millis(1),
|
|
315
322
|
randomization_factor: 0.0,
|
|
316
323
|
multiplier: 1.1,
|
|
@@ -403,7 +410,7 @@ mod tests {
|
|
|
403
410
|
retry_cfg: TEST_RETRY_CONFIG,
|
|
404
411
|
retry_short_circuit: None,
|
|
405
412
|
},
|
|
406
|
-
|
|
413
|
+
RetryOptions {
|
|
407
414
|
initial_interval: Duration::from_millis(2),
|
|
408
415
|
randomization_factor: 0.0,
|
|
409
416
|
multiplier: 4.0,
|
|
@@ -524,7 +531,7 @@ mod tests {
|
|
|
524
531
|
for i in 1..=50 {
|
|
525
532
|
let mut err_handler = TonicErrorHandler::new(
|
|
526
533
|
fake_retry.get_call_info::<R>(call_name, Some(&req)),
|
|
527
|
-
|
|
534
|
+
RetryOptions::throttle_retry_policy(),
|
|
528
535
|
);
|
|
529
536
|
let result = err_handler.handle(i, Status::new(Code::Unknown, "Ahh"));
|
|
530
537
|
assert_matches!(result, RetryPolicy::WaitRetry(_));
|
|
@@ -557,7 +564,7 @@ mod tests {
|
|
|
557
564
|
for code in [Code::Cancelled, Code::DeadlineExceeded] {
|
|
558
565
|
let mut err_handler = TonicErrorHandler::new(
|
|
559
566
|
fake_retry.get_call_info::<R>(call_name, Some(&req)),
|
|
560
|
-
|
|
567
|
+
RetryOptions::throttle_retry_policy(),
|
|
561
568
|
);
|
|
562
569
|
for i in 1..=5 {
|
|
563
570
|
let result = err_handler.handle(i, Status::new(code, "retryable failure"));
|