temporalio 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +180 -7
- data/bridge/Cargo.lock +208 -76
- data/bridge/Cargo.toml +5 -2
- data/bridge/sdk-core/Cargo.toml +1 -1
- data/bridge/sdk-core/README.md +20 -10
- data/bridge/sdk-core/client/Cargo.toml +1 -1
- data/bridge/sdk-core/client/src/lib.rs +227 -59
- data/bridge/sdk-core/client/src/metrics.rs +17 -8
- data/bridge/sdk-core/client/src/raw.rs +13 -12
- data/bridge/sdk-core/client/src/retry.rs +132 -43
- data/bridge/sdk-core/core/Cargo.toml +28 -15
- data/bridge/sdk-core/core/benches/workflow_replay.rs +13 -10
- data/bridge/sdk-core/core/src/abstractions.rs +225 -36
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +217 -79
- data/bridge/sdk-core/core/src/core_tests/determinism.rs +165 -2
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +565 -34
- data/bridge/sdk-core/core/src/core_tests/queries.rs +247 -90
- data/bridge/sdk-core/core/src/core_tests/workers.rs +3 -5
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +430 -67
- data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +106 -12
- data/bridge/sdk-core/core/src/internal_flags.rs +136 -0
- data/bridge/sdk-core/core/src/lib.rs +148 -34
- data/bridge/sdk-core/core/src/protosext/mod.rs +1 -1
- data/bridge/sdk-core/core/src/replay/mod.rs +185 -41
- data/bridge/sdk-core/core/src/telemetry/log_export.rs +190 -0
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +219 -140
- data/bridge/sdk-core/core/src/telemetry/mod.rs +326 -315
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +20 -14
- data/bridge/sdk-core/core/src/test_help/mod.rs +85 -21
- data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +112 -156
- data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +364 -128
- data/bridge/sdk-core/core/src/worker/activities.rs +263 -170
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +23 -3
- data/bridge/sdk-core/core/src/worker/client.rs +48 -6
- data/bridge/sdk-core/core/src/worker/mod.rs +186 -75
- data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +13 -24
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +879 -226
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +101 -48
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -12
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +90 -32
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +6 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +7 -10
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -9
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +160 -83
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +36 -54
- data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +179 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +104 -157
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +8 -12
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +9 -13
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +10 -4
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +14 -11
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +6 -17
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +395 -299
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +12 -20
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +33 -18
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +1032 -374
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +525 -392
- data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +40 -57
- data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +125 -0
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +3 -6
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +117 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +456 -681
- data/bridge/sdk-core/core-api/Cargo.toml +6 -4
- data/bridge/sdk-core/core-api/src/errors.rs +1 -34
- data/bridge/sdk-core/core-api/src/lib.rs +7 -45
- data/bridge/sdk-core/core-api/src/telemetry.rs +141 -0
- data/bridge/sdk-core/core-api/src/worker.rs +27 -1
- data/bridge/sdk-core/etc/deps.svg +115 -140
- data/bridge/sdk-core/etc/regen-depgraph.sh +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +18 -15
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
- data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +8 -3
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
- data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -3
- data/bridge/sdk-core/protos/api_upstream/build/go.mod +7 -0
- data/bridge/sdk-core/protos/api_upstream/build/go.sum +5 -0
- data/bridge/sdk-core/protos/api_upstream/{temporal/api/enums/v1/cluster.proto → build/tools.go} +7 -18
- data/bridge/sdk-core/protos/api_upstream/go.mod +6 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +12 -9
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +15 -26
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +13 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +4 -9
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +10 -8
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +28 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +24 -19
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +62 -26
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +4 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +24 -61
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -21
- data/bridge/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +57 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +110 -31
- data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +4 -4
- data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +71 -6
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +3 -2
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +111 -36
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +19 -5
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +1 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +9 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +9 -1
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +6 -0
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
- data/bridge/sdk-core/sdk/Cargo.toml +4 -3
- data/bridge/sdk-core/sdk/src/interceptors.rs +36 -3
- data/bridge/sdk-core/sdk/src/lib.rs +94 -25
- data/bridge/sdk-core/sdk/src/workflow_context.rs +13 -2
- data/bridge/sdk-core/sdk/src/workflow_future.rs +10 -13
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +5 -2
- data/bridge/sdk-core/sdk-core-protos/build.rs +36 -2
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +164 -104
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +27 -23
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +252 -74
- data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
- data/bridge/sdk-core/test-utils/Cargo.toml +4 -1
- data/bridge/sdk-core/test-utils/src/canned_histories.rs +106 -296
- data/bridge/sdk-core/test-utils/src/histfetch.rs +1 -1
- data/bridge/sdk-core/test-utils/src/lib.rs +161 -50
- data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
- data/bridge/sdk-core/test-utils/src/workflows.rs +29 -0
- data/bridge/sdk-core/tests/fuzzy_workflow.rs +130 -0
- data/bridge/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +125 -51
- data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +10 -5
- data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +239 -0
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +4 -60
- data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +5 -128
- data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +83 -25
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -69
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +6 -13
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +6 -2
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -10
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +151 -116
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +54 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +7 -28
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +115 -24
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +18 -14
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +6 -20
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -21
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -4
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +27 -18
- data/bridge/sdk-core/tests/main.rs +8 -16
- data/bridge/sdk-core/tests/runner.rs +75 -36
- data/bridge/sdk-core/tests/wf_input_replay.rs +32 -0
- data/bridge/src/connection.rs +117 -82
- data/bridge/src/lib.rs +356 -42
- data/bridge/src/runtime.rs +10 -3
- data/bridge/src/test_server.rs +153 -0
- data/bridge/src/worker.rs +133 -9
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +8 -6
- data/lib/gen/temporal/api/command/v1/message_pb.rb +10 -16
- data/lib/gen/temporal/api/common/v1/message_pb.rb +5 -1
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +3 -3
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +2 -1
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +5 -4
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +9 -1
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +1 -1
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +7 -10
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +1 -1
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/history/v1/message_pb.rb +34 -25
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +2 -1
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +14 -51
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/api/protocol/v1/message_pb.rb +30 -0
- data/lib/gen/temporal/api/query/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +22 -1
- data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +23 -0
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +2 -2
- data/lib/gen/temporal/api/testservice/v1/request_response_pb.rb +49 -0
- data/lib/gen/temporal/api/testservice/v1/service_pb.rb +21 -0
- data/lib/gen/temporal/api/update/v1/message_pb.rb +49 -3
- data/lib/gen/temporal/api/version/v1/message_pb.rb +1 -1
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +2 -1
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +47 -20
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +1 -1
- data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +13 -9
- data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +10 -6
- data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +13 -9
- data/lib/gen/temporal/sdk/core/common/common_pb.rb +7 -3
- data/lib/gen/temporal/sdk/core/core_interface_pb.rb +9 -3
- data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +7 -3
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +28 -21
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +32 -24
- data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +12 -5
- data/lib/temporalio/activity/context.rb +102 -0
- data/lib/temporalio/activity/info.rb +67 -0
- data/lib/temporalio/activity.rb +85 -0
- data/lib/temporalio/bridge/connect_options.rb +15 -0
- data/lib/temporalio/bridge/error.rb +8 -0
- data/lib/temporalio/bridge/retry_config.rb +24 -0
- data/lib/temporalio/bridge/tls_options.rb +19 -0
- data/lib/temporalio/bridge.rb +14 -0
- data/lib/{temporal → temporalio}/client/implementation.rb +57 -56
- data/lib/{temporal → temporalio}/client/workflow_handle.rb +35 -35
- data/lib/{temporal → temporalio}/client.rb +19 -32
- data/lib/temporalio/connection/retry_config.rb +44 -0
- data/lib/temporalio/connection/service.rb +20 -0
- data/lib/temporalio/connection/test_service.rb +92 -0
- data/lib/temporalio/connection/tls_options.rb +51 -0
- data/lib/temporalio/connection/workflow_service.rb +731 -0
- data/lib/temporalio/connection.rb +86 -0
- data/lib/{temporal → temporalio}/data_converter.rb +76 -35
- data/lib/{temporal → temporalio}/error/failure.rb +6 -6
- data/lib/{temporal → temporalio}/error/workflow_failure.rb +4 -2
- data/lib/{temporal → temporalio}/errors.rb +19 -1
- data/lib/{temporal → temporalio}/failure_converter/base.rb +5 -5
- data/lib/{temporal → temporalio}/failure_converter/basic.rb +58 -52
- data/lib/temporalio/failure_converter.rb +7 -0
- data/lib/temporalio/interceptor/activity_inbound.rb +22 -0
- data/lib/temporalio/interceptor/activity_outbound.rb +24 -0
- data/lib/{temporal → temporalio}/interceptor/chain.rb +7 -6
- data/lib/{temporal → temporalio}/interceptor/client.rb +27 -2
- data/lib/temporalio/interceptor.rb +22 -0
- data/lib/{temporal → temporalio}/payload_codec/base.rb +5 -5
- data/lib/{temporal → temporalio}/payload_converter/base.rb +3 -3
- data/lib/{temporal → temporalio}/payload_converter/bytes.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/composite.rb +7 -5
- data/lib/{temporal → temporalio}/payload_converter/encoding_base.rb +4 -4
- data/lib/{temporal → temporalio}/payload_converter/json.rb +4 -3
- data/lib/{temporal → temporalio}/payload_converter/nil.rb +4 -3
- data/lib/temporalio/payload_converter.rb +14 -0
- data/lib/{temporal → temporalio}/retry_policy.rb +17 -7
- data/lib/{temporal → temporalio}/retry_state.rb +1 -1
- data/lib/temporalio/runtime.rb +25 -0
- data/lib/temporalio/testing/time_skipping_handle.rb +32 -0
- data/lib/temporalio/testing/time_skipping_interceptor.rb +23 -0
- data/lib/temporalio/testing/workflow_environment.rb +112 -0
- data/lib/temporalio/testing.rb +175 -0
- data/lib/{temporal → temporalio}/timeout_type.rb +2 -2
- data/lib/temporalio/version.rb +3 -0
- data/lib/temporalio/worker/activity_runner.rb +114 -0
- data/lib/temporalio/worker/activity_worker.rb +164 -0
- data/lib/temporalio/worker/reactor.rb +46 -0
- data/lib/temporalio/worker/runner.rb +63 -0
- data/lib/temporalio/worker/sync_worker.rb +124 -0
- data/lib/temporalio/worker/thread_pool_executor.rb +51 -0
- data/lib/temporalio/worker.rb +204 -0
- data/lib/temporalio/workflow/async.rb +46 -0
- data/lib/{temporal → temporalio}/workflow/execution_info.rb +4 -4
- data/lib/{temporal → temporalio}/workflow/execution_status.rb +1 -1
- data/lib/temporalio/workflow/future.rb +138 -0
- data/lib/{temporal → temporalio}/workflow/id_reuse_policy.rb +6 -6
- data/lib/temporalio/workflow/info.rb +76 -0
- data/lib/{temporal → temporalio}/workflow/query_reject_condition.rb +5 -5
- data/lib/temporalio.rb +12 -3
- data/temporalio.gemspec +11 -6
- metadata +137 -64
- data/bridge/sdk-core/Cargo.lock +0 -2606
- data/bridge/sdk-core/bridge-ffi/Cargo.toml +0 -24
- data/bridge/sdk-core/bridge-ffi/LICENSE.txt +0 -23
- data/bridge/sdk-core/bridge-ffi/build.rs +0 -25
- data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -249
- data/bridge/sdk-core/bridge-ffi/src/lib.rs +0 -825
- data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +0 -211
- data/bridge/sdk-core/core/src/log_export.rs +0 -62
- data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
- data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
- data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
- data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
- data/bridge/sdk-core/sdk/src/conversions.rs +0 -8
- data/lib/bridge.so +0 -0
- data/lib/gen/temporal/api/cluster/v1/message_pb.rb +0 -67
- data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +0 -26
- data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +0 -222
- data/lib/temporal/bridge.rb +0 -14
- data/lib/temporal/connection.rb +0 -736
- data/lib/temporal/failure_converter.rb +0 -8
- data/lib/temporal/payload_converter.rb +0 -14
- data/lib/temporal/runtime.rb +0 -22
- data/lib/temporal/version.rb +0 -3
- data/lib/temporal.rb +0 -8
@@ -18,10 +18,10 @@
|
|
18
18
|
//! | replaying, no marker | deprecate_patch | Call allowed |
|
19
19
|
|
20
20
|
use super::{
|
21
|
-
workflow_machines::MachineResponse, Cancellable, EventInfo,
|
21
|
+
workflow_machines::MachineResponse, Cancellable, EventInfo, NewMachineWithCommand,
|
22
22
|
OnEventWrapper, WFMachinesAdapter, WFMachinesError,
|
23
23
|
};
|
24
|
-
use crate::protosext::HistoryEventExt;
|
24
|
+
use crate::{protosext::HistoryEventExt, worker::workflow::machines::HistEventData};
|
25
25
|
use rustfsm::{fsm, TransitionResult};
|
26
26
|
use std::convert::TryFrom;
|
27
27
|
use temporal_sdk_core_protos::{
|
@@ -186,10 +186,6 @@ impl WFMachinesAdapter for PatchMachine {
|
|
186
186
|
fn matches_event(&self, event: &HistoryEvent) -> bool {
|
187
187
|
event.get_patch_marker_details().is_some()
|
188
188
|
}
|
189
|
-
|
190
|
-
fn kind(&self) -> MachineKind {
|
191
|
-
MachineKind::Patch
|
192
|
-
}
|
193
189
|
}
|
194
190
|
|
195
191
|
impl Cancellable for PatchMachine {}
|
@@ -205,15 +201,15 @@ impl TryFrom<CommandType> for PatchMachineEvents {
|
|
205
201
|
}
|
206
202
|
}
|
207
203
|
|
208
|
-
impl TryFrom<
|
204
|
+
impl TryFrom<HistEventData> for PatchMachineEvents {
|
209
205
|
type Error = WFMachinesError;
|
210
206
|
|
211
|
-
fn try_from(e:
|
207
|
+
fn try_from(e: HistEventData) -> Result<Self, Self::Error> {
|
208
|
+
let e = e.event;
|
212
209
|
match e.get_patch_marker_details() {
|
213
210
|
Some((id, _)) => Ok(Self::MarkerRecorded(id)),
|
214
211
|
_ => Err(WFMachinesError::Nondeterminism(format!(
|
215
|
-
"Change machine cannot handle this event: {}"
|
216
|
-
e
|
212
|
+
"Change machine cannot handle this event: {e}"
|
217
213
|
))),
|
218
214
|
}
|
219
215
|
}
|
@@ -242,15 +238,14 @@ mod tests {
|
|
242
238
|
common::v1::ActivityType,
|
243
239
|
enums::v1::{CommandType, EventType},
|
244
240
|
history::v1::{
|
245
|
-
|
246
|
-
|
247
|
-
TimerFiredEventAttributes,
|
241
|
+
ActivityTaskCompletedEventAttributes, ActivityTaskScheduledEventAttributes,
|
242
|
+
ActivityTaskStartedEventAttributes, TimerFiredEventAttributes,
|
248
243
|
},
|
249
244
|
},
|
250
245
|
};
|
251
246
|
|
252
247
|
const MY_PATCH_ID: &str = "test_patch_id";
|
253
|
-
#[derive(Eq, PartialEq, Copy, Clone)]
|
248
|
+
#[derive(Eq, PartialEq, Copy, Clone, Debug)]
|
254
249
|
enum MarkerType {
|
255
250
|
Deprecated,
|
256
251
|
NotDeprecated,
|
@@ -271,7 +266,11 @@ mod tests {
|
|
271
266
|
/// EVENT_TYPE_WORKFLOW_TASK_STARTED
|
272
267
|
/// EVENT_TYPE_WORKFLOW_TASK_COMPLETED
|
273
268
|
/// EVENT_TYPE_WORKFLOW_EXECUTION_COMPLETED
|
274
|
-
fn patch_marker_single_activity(
|
269
|
+
fn patch_marker_single_activity(
|
270
|
+
marker_type: MarkerType,
|
271
|
+
version: usize,
|
272
|
+
replay: bool,
|
273
|
+
) -> TestHistoryBuilder {
|
275
274
|
let mut t = TestHistoryBuilder::default();
|
276
275
|
t.add_by_type(EventType::WorkflowExecutionStarted);
|
277
276
|
t.add_full_wf_task();
|
@@ -281,41 +280,41 @@ mod tests {
|
|
281
280
|
MarkerType::NoMarker => {}
|
282
281
|
};
|
283
282
|
|
284
|
-
let
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
),
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
)
|
318
|
-
);
|
283
|
+
let activity_id = if replay {
|
284
|
+
match (marker_type, version) {
|
285
|
+
(_, 1) => "no_change",
|
286
|
+
(MarkerType::NotDeprecated, 2) => "had_change",
|
287
|
+
(MarkerType::Deprecated, 2) => "had_change",
|
288
|
+
(MarkerType::NoMarker, 2) => "no_change",
|
289
|
+
(_, 3) => "had_change",
|
290
|
+
(_, 4) => "had_change",
|
291
|
+
v => panic!("Nonsense marker / version combo {v:?}"),
|
292
|
+
}
|
293
|
+
} else {
|
294
|
+
// If the workflow isn't replaying (we're creating history here for a workflow which
|
295
|
+
// wasn't replaying at the time of scheduling the activity, and has done that, and now
|
296
|
+
// we're feeding back the history it would have produced) then it always has the change,
|
297
|
+
// except in v1.
|
298
|
+
if version > 1 {
|
299
|
+
"had_change"
|
300
|
+
} else {
|
301
|
+
"no_change"
|
302
|
+
}
|
303
|
+
};
|
304
|
+
|
305
|
+
let scheduled_event_id = t.add(ActivityTaskScheduledEventAttributes {
|
306
|
+
activity_id: activity_id.to_string(),
|
307
|
+
..Default::default()
|
308
|
+
});
|
309
|
+
let started_event_id = t.add(ActivityTaskStartedEventAttributes {
|
310
|
+
scheduled_event_id,
|
311
|
+
..Default::default()
|
312
|
+
});
|
313
|
+
t.add(ActivityTaskCompletedEventAttributes {
|
314
|
+
scheduled_event_id,
|
315
|
+
started_event_id,
|
316
|
+
..Default::default()
|
317
|
+
});
|
319
318
|
t.add_full_wf_task();
|
320
319
|
t.add_workflow_execution_completed();
|
321
320
|
t
|
@@ -388,7 +387,7 @@ mod tests {
|
|
388
387
|
Ok(().into())
|
389
388
|
});
|
390
389
|
|
391
|
-
let t = patch_marker_single_activity(marker_type);
|
390
|
+
let t = patch_marker_single_activity(marker_type, workflow_version, replaying);
|
392
391
|
let histinfo = if replaying {
|
393
392
|
t.get_full_history_info()
|
394
393
|
} else {
|
@@ -426,7 +425,7 @@ mod tests {
|
|
426
425
|
} else {
|
427
426
|
// Feed more history
|
428
427
|
wfm.new_history(
|
429
|
-
patch_marker_single_activity(marker_type)
|
428
|
+
patch_marker_single_activity(marker_type, wf_version, replaying)
|
430
429
|
.get_full_history_info()
|
431
430
|
.unwrap()
|
432
431
|
.into(),
|
@@ -520,7 +519,7 @@ mod tests {
|
|
520
519
|
// and the history should have the has-change timer. v3 of course always has the change
|
521
520
|
// regardless.
|
522
521
|
wfm.new_history(
|
523
|
-
patch_marker_single_activity(marker_type)
|
522
|
+
patch_marker_single_activity(marker_type, wf_version, replaying)
|
524
523
|
.get_full_history_info()
|
525
524
|
.unwrap()
|
526
525
|
.into(),
|
@@ -569,118 +568,66 @@ mod tests {
|
|
569
568
|
t.add_full_wf_task();
|
570
569
|
if have_marker_in_hist {
|
571
570
|
t.add_has_change_marker(MY_PATCH_ID, false);
|
572
|
-
let scheduled_event_id = t.
|
573
|
-
|
574
|
-
Some(
|
575
|
-
|
576
|
-
ActivityTaskScheduledEventAttributes {
|
577
|
-
activity_id: "1".to_owned(),
|
578
|
-
activity_type: Some(ActivityType {
|
579
|
-
name: "".to_string(),
|
580
|
-
}),
|
581
|
-
..Default::default()
|
582
|
-
},
|
583
|
-
),
|
584
|
-
),
|
585
|
-
);
|
586
|
-
let started_event_id = t.add_get_event_id(
|
587
|
-
EventType::ActivityTaskStarted,
|
588
|
-
Some(
|
589
|
-
history_event::Attributes::ActivityTaskStartedEventAttributes(
|
590
|
-
ActivityTaskStartedEventAttributes {
|
591
|
-
scheduled_event_id,
|
592
|
-
..Default::default()
|
593
|
-
},
|
594
|
-
),
|
595
|
-
),
|
596
|
-
);
|
597
|
-
t.add(
|
598
|
-
EventType::ActivityTaskCompleted,
|
599
|
-
history_event::Attributes::ActivityTaskCompletedEventAttributes(
|
600
|
-
ActivityTaskCompletedEventAttributes {
|
601
|
-
scheduled_event_id,
|
602
|
-
started_event_id,
|
603
|
-
// TODO result: Some(Payloads { payloads: vec![Payload{ metadata: Default::default(), data: vec![] }] }),
|
604
|
-
..Default::default()
|
605
|
-
},
|
606
|
-
),
|
607
|
-
);
|
608
|
-
t.add_full_wf_task();
|
609
|
-
let timer_started_event_id = t.add_get_event_id(EventType::TimerStarted, None);
|
610
|
-
t.add(
|
611
|
-
EventType::TimerFired,
|
612
|
-
history_event::Attributes::TimerFiredEventAttributes(TimerFiredEventAttributes {
|
613
|
-
started_event_id: timer_started_event_id,
|
614
|
-
timer_id: "1".to_owned(),
|
571
|
+
let scheduled_event_id = t.add(ActivityTaskScheduledEventAttributes {
|
572
|
+
activity_id: "1".to_owned(),
|
573
|
+
activity_type: Some(ActivityType {
|
574
|
+
name: "".to_string(),
|
615
575
|
}),
|
616
|
-
|
576
|
+
..Default::default()
|
577
|
+
});
|
578
|
+
let started_event_id = t.add(ActivityTaskStartedEventAttributes {
|
579
|
+
scheduled_event_id,
|
580
|
+
..Default::default()
|
581
|
+
});
|
582
|
+
t.add(ActivityTaskCompletedEventAttributes {
|
583
|
+
scheduled_event_id,
|
584
|
+
started_event_id,
|
585
|
+
..Default::default()
|
586
|
+
});
|
587
|
+
t.add_full_wf_task();
|
588
|
+
let timer_started_event_id = t.add_by_type(EventType::TimerStarted);
|
589
|
+
t.add(TimerFiredEventAttributes {
|
590
|
+
started_event_id: timer_started_event_id,
|
591
|
+
timer_id: "1".to_owned(),
|
592
|
+
});
|
617
593
|
} else {
|
618
|
-
let started_event_id = t.
|
619
|
-
t.add(
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
timer_id: "1".to_owned(),
|
624
|
-
}),
|
625
|
-
);
|
594
|
+
let started_event_id = t.add_by_type(EventType::TimerStarted);
|
595
|
+
t.add(TimerFiredEventAttributes {
|
596
|
+
started_event_id,
|
597
|
+
timer_id: "1".to_owned(),
|
598
|
+
});
|
626
599
|
t.add_full_wf_task();
|
627
|
-
let timer_started_event_id = t.
|
628
|
-
t.add(
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
timer_id: "2".to_owned(),
|
633
|
-
}),
|
634
|
-
);
|
600
|
+
let timer_started_event_id = t.add_by_type(EventType::TimerStarted);
|
601
|
+
t.add(TimerFiredEventAttributes {
|
602
|
+
started_event_id: timer_started_event_id,
|
603
|
+
timer_id: "2".to_owned(),
|
604
|
+
});
|
635
605
|
}
|
636
606
|
t.add_full_wf_task();
|
637
607
|
|
638
608
|
if have_marker_in_hist {
|
639
|
-
let scheduled_event_id = t.
|
640
|
-
|
641
|
-
Some(
|
642
|
-
|
643
|
-
ActivityTaskScheduledEventAttributes {
|
644
|
-
activity_id: "2".to_string(),
|
645
|
-
activity_type: Some(ActivityType {
|
646
|
-
name: "".to_string(),
|
647
|
-
}),
|
648
|
-
..Default::default()
|
649
|
-
},
|
650
|
-
),
|
651
|
-
),
|
652
|
-
);
|
653
|
-
let started_event_id = t.add_get_event_id(
|
654
|
-
EventType::ActivityTaskStarted,
|
655
|
-
Some(
|
656
|
-
history_event::Attributes::ActivityTaskStartedEventAttributes(
|
657
|
-
ActivityTaskStartedEventAttributes {
|
658
|
-
scheduled_event_id,
|
659
|
-
..Default::default()
|
660
|
-
},
|
661
|
-
),
|
662
|
-
),
|
663
|
-
);
|
664
|
-
t.add(
|
665
|
-
EventType::ActivityTaskCompleted,
|
666
|
-
history_event::Attributes::ActivityTaskCompletedEventAttributes(
|
667
|
-
ActivityTaskCompletedEventAttributes {
|
668
|
-
scheduled_event_id,
|
669
|
-
started_event_id,
|
670
|
-
// TODO result: Some(Payloads { payloads: vec![Payload{ metadata: Default::default(), data: vec![] }] }),
|
671
|
-
..Default::default()
|
672
|
-
},
|
673
|
-
),
|
674
|
-
);
|
675
|
-
} else {
|
676
|
-
let started_event_id = t.add_get_event_id(EventType::TimerStarted, None);
|
677
|
-
t.add(
|
678
|
-
EventType::TimerFired,
|
679
|
-
history_event::Attributes::TimerFiredEventAttributes(TimerFiredEventAttributes {
|
680
|
-
started_event_id,
|
681
|
-
timer_id: "3".to_owned(),
|
609
|
+
let scheduled_event_id = t.add(ActivityTaskScheduledEventAttributes {
|
610
|
+
activity_id: "2".to_string(),
|
611
|
+
activity_type: Some(ActivityType {
|
612
|
+
name: "".to_string(),
|
682
613
|
}),
|
683
|
-
|
614
|
+
..Default::default()
|
615
|
+
});
|
616
|
+
let started_event_id = t.add(ActivityTaskStartedEventAttributes {
|
617
|
+
scheduled_event_id,
|
618
|
+
..Default::default()
|
619
|
+
});
|
620
|
+
t.add(ActivityTaskCompletedEventAttributes {
|
621
|
+
scheduled_event_id,
|
622
|
+
started_event_id,
|
623
|
+
..Default::default()
|
624
|
+
});
|
625
|
+
} else {
|
626
|
+
let started_event_id = t.add_by_type(EventType::TimerStarted);
|
627
|
+
t.add(TimerFiredEventAttributes {
|
628
|
+
started_event_id,
|
629
|
+
timer_id: "3".to_owned(),
|
630
|
+
});
|
684
631
|
}
|
685
632
|
t.add_full_wf_task();
|
686
633
|
t.add_workflow_execution_completed();
|
@@ -1,7 +1,8 @@
|
|
1
1
|
use super::{
|
2
|
-
workflow_machines::MachineResponse, Cancellable, EventInfo,
|
2
|
+
workflow_machines::MachineResponse, Cancellable, EventInfo, NewMachineWithCommand,
|
3
3
|
OnEventWrapper, WFMachinesAdapter, WFMachinesError,
|
4
4
|
};
|
5
|
+
use crate::worker::workflow::machines::HistEventData;
|
5
6
|
use rustfsm::{fsm, MachineError, TransitionResult};
|
6
7
|
use std::convert::TryFrom;
|
7
8
|
use temporal_sdk_core_protos::{
|
@@ -183,10 +184,11 @@ impl TryFrom<CommandType> for SignalExternalMachineEvents {
|
|
183
184
|
})
|
184
185
|
}
|
185
186
|
}
|
186
|
-
impl TryFrom<
|
187
|
+
impl TryFrom<HistEventData> for SignalExternalMachineEvents {
|
187
188
|
type Error = WFMachinesError;
|
188
189
|
|
189
|
-
fn try_from(e:
|
190
|
+
fn try_from(e: HistEventData) -> Result<Self, Self::Error> {
|
191
|
+
let e = e.event;
|
190
192
|
Ok(match e.event_type() {
|
191
193
|
EventType::ExternalWorkflowExecutionSignaled => Self::ExternalWorkflowExecutionSignaled,
|
192
194
|
EventType::SignalExternalWorkflowExecutionInitiated => {
|
@@ -202,15 +204,13 @@ impl TryFrom<HistoryEvent> for SignalExternalMachineEvents {
|
|
202
204
|
Self::SignalExternalWorkflowExecutionFailed(attrs.cause())
|
203
205
|
} else {
|
204
206
|
return Err(WFMachinesError::Fatal(format!(
|
205
|
-
"Signal workflow failed attributes were unset: {}"
|
206
|
-
e
|
207
|
+
"Signal workflow failed attributes were unset: {e}"
|
207
208
|
)));
|
208
209
|
}
|
209
210
|
}
|
210
211
|
_ => {
|
211
212
|
return Err(WFMachinesError::Nondeterminism(format!(
|
212
|
-
"Signal external WF machine does not handle this event: {}"
|
213
|
-
e
|
213
|
+
"Signal external WF machine does not handle this event: {e}"
|
214
214
|
)))
|
215
215
|
}
|
216
216
|
})
|
@@ -242,7 +242,7 @@ impl WFMachinesAdapter for SignalExternalMachine {
|
|
242
242
|
seq: self.shared_state.seq,
|
243
243
|
// TODO: Create new failure type upstream for this
|
244
244
|
failure: Some(Failure {
|
245
|
-
message: format!("Unable to signal external workflow because {}"
|
245
|
+
message: format!("Unable to signal external workflow because {reason}"),
|
246
246
|
failure_info: Some(FailureInfo::ApplicationFailureInfo(
|
247
247
|
ApplicationFailureInfo {
|
248
248
|
r#type: f.to_string(),
|
@@ -268,10 +268,6 @@ impl WFMachinesAdapter for SignalExternalMachine {
|
|
268
268
|
| EventType::SignalExternalWorkflowExecutionFailed
|
269
269
|
)
|
270
270
|
}
|
271
|
-
|
272
|
-
fn kind(&self) -> MachineKind {
|
273
|
-
MachineKind::SignalExternalWorkflow
|
274
|
-
}
|
275
271
|
}
|
276
272
|
|
277
273
|
impl Cancellable for SignalExternalMachine {
|
@@ -1,9 +1,10 @@
|
|
1
1
|
#![allow(clippy::large_enum_variant)]
|
2
2
|
|
3
3
|
use super::{
|
4
|
-
workflow_machines::
|
5
|
-
|
4
|
+
workflow_machines::MachineResponse, Cancellable, EventInfo, NewMachineWithCommand,
|
5
|
+
OnEventWrapper, WFMachinesAdapter,
|
6
6
|
};
|
7
|
+
use crate::worker::workflow::{machines::HistEventData, WFMachinesError};
|
7
8
|
use rustfsm::{fsm, MachineError, StateMachine, TransitionResult};
|
8
9
|
use std::convert::TryFrom;
|
9
10
|
use temporal_sdk_core_protos::{
|
@@ -93,10 +94,11 @@ impl TimerMachine {
|
|
93
94
|
}
|
94
95
|
}
|
95
96
|
|
96
|
-
impl TryFrom<
|
97
|
+
impl TryFrom<HistEventData> for TimerMachineEvents {
|
97
98
|
type Error = WFMachinesError;
|
98
99
|
|
99
|
-
fn try_from(e:
|
100
|
+
fn try_from(e: HistEventData) -> Result<Self, Self::Error> {
|
101
|
+
let e = e.event;
|
100
102
|
Ok(match e.event_type() {
|
101
103
|
EventType::TimerStarted => Self::TimerStarted(e.event_id),
|
102
104
|
EventType::TimerCanceled => Self::TimerCanceled,
|
@@ -107,15 +109,13 @@ impl TryFrom<HistoryEvent> for TimerMachineEvents {
|
|
107
109
|
Self::TimerFired(attrs)
|
108
110
|
} else {
|
109
111
|
return Err(WFMachinesError::Fatal(format!(
|
110
|
-
"Timer fired attribs were unset: {}"
|
111
|
-
e
|
112
|
+
"Timer fired attribs were unset: {e}"
|
112
113
|
)));
|
113
114
|
}
|
114
115
|
}
|
115
116
|
_ => {
|
116
117
|
return Err(WFMachinesError::Nondeterminism(format!(
|
117
|
-
"Timer machine does not handle this event: {}"
|
118
|
-
e
|
118
|
+
"Timer machine does not handle this event: {e}"
|
119
119
|
)))
|
120
120
|
}
|
121
121
|
})
|
@@ -246,10 +246,6 @@ impl WFMachinesAdapter for TimerMachine {
|
|
246
246
|
EventType::TimerStarted | EventType::TimerCanceled | EventType::TimerFired
|
247
247
|
)
|
248
248
|
}
|
249
|
-
|
250
|
-
fn kind(&self) -> MachineKind {
|
251
|
-
MachineKind::Timer
|
252
|
-
}
|
253
249
|
}
|
254
250
|
|
255
251
|
impl Cancellable for TimerMachine {
|
@@ -260,7 +256,7 @@ impl Cancellable for TimerMachine {
|
|
260
256
|
vec![MachineResponse::IssueNewCommand(cmd)]
|
261
257
|
}
|
262
258
|
None => vec![],
|
263
|
-
x => panic!("Invalid cancel event response {:?}"
|
259
|
+
x => panic!("Invalid cancel event response {x:?}"),
|
264
260
|
},
|
265
261
|
)
|
266
262
|
}
|
@@ -75,8 +75,10 @@ mod machine_coverage_report {
|
|
75
75
|
complete_workflow_state_machine::CompleteWorkflowMachine,
|
76
76
|
continue_as_new_workflow_state_machine::ContinueAsNewWorkflowMachine,
|
77
77
|
fail_workflow_state_machine::FailWorkflowMachine,
|
78
|
-
local_activity_state_machine::LocalActivityMachine,
|
79
|
-
|
78
|
+
local_activity_state_machine::LocalActivityMachine,
|
79
|
+
modify_workflow_properties_state_machine::ModifyWorkflowPropertiesMachine,
|
80
|
+
patch_state_machine::PatchMachine, signal_external_state_machine::SignalExternalMachine,
|
81
|
+
timer_state_machine::TimerMachine,
|
80
82
|
upsert_search_attributes_state_machine::UpsertSearchAttributesMachine,
|
81
83
|
workflow_task_state_machine::WorkflowTaskMachine,
|
82
84
|
};
|
@@ -115,6 +117,7 @@ mod machine_coverage_report {
|
|
115
117
|
let mut cancel_ext = CancelExternalMachine::visualizer().to_owned();
|
116
118
|
let mut la_mach = LocalActivityMachine::visualizer().to_owned();
|
117
119
|
let mut upsert_search_attr = UpsertSearchAttributesMachine::visualizer().to_owned();
|
120
|
+
let mut modify_wf_props = ModifyWorkflowPropertiesMachine::visualizer().to_owned();
|
118
121
|
|
119
122
|
// This isn't at all efficient but doesn't need to be.
|
120
123
|
// Replace transitions in the vizzes with green color if they are covered.
|
@@ -138,7 +141,10 @@ mod machine_coverage_report {
|
|
138
141
|
m @ "UpsertSearchAttributesMachine" => {
|
139
142
|
cover_transitions(m, &mut upsert_search_attr, coverage)
|
140
143
|
}
|
141
|
-
m
|
144
|
+
m @ "ModifyWorkflowPropertiesMachine" => {
|
145
|
+
cover_transitions(m, &mut modify_wf_props, coverage)
|
146
|
+
}
|
147
|
+
m => panic!("Unknown machine {m}"),
|
142
148
|
}
|
143
149
|
}
|
144
150
|
}
|
@@ -162,7 +168,7 @@ mod machine_coverage_report {
|
|
162
168
|
let mut d = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
|
163
169
|
d.push("machine_coverage");
|
164
170
|
std::fs::create_dir_all(&d).unwrap();
|
165
|
-
d.push(format!("{}_Coverage.puml"
|
171
|
+
d.push(format!("{machine}_Coverage.puml"));
|
166
172
|
let mut file = File::create(d).unwrap();
|
167
173
|
file.write_all(viz.as_bytes()).unwrap();
|
168
174
|
}
|
data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
use super::{
|
2
|
-
|
3
|
-
|
1
|
+
use super::{workflow_machines::MachineResponse, NewMachineWithCommand};
|
2
|
+
use crate::worker::workflow::{
|
3
|
+
machines::{Cancellable, EventInfo, HistEventData, WFMachinesAdapter},
|
4
|
+
WFMachinesError,
|
4
5
|
};
|
5
|
-
use crate::worker::workflow::machines::{Cancellable, EventInfo, MachineKind, WFMachinesAdapter};
|
6
6
|
use rustfsm::{fsm, TransitionResult};
|
7
7
|
use temporal_sdk_core_protos::{
|
8
8
|
coresdk::workflow_commands::UpsertWorkflowSearchAttributes,
|
@@ -102,10 +102,6 @@ impl WFMachinesAdapter for UpsertSearchAttributesMachine {
|
|
102
102
|
EventType::UpsertWorkflowSearchAttributes
|
103
103
|
)
|
104
104
|
}
|
105
|
-
|
106
|
-
fn kind(&self) -> MachineKind {
|
107
|
-
MachineKind::UpsertSearchAttributes
|
108
|
-
}
|
109
105
|
}
|
110
106
|
|
111
107
|
impl Cancellable for UpsertSearchAttributesMachine {}
|
@@ -113,10 +109,11 @@ impl Cancellable for UpsertSearchAttributesMachine {}
|
|
113
109
|
// Converts the generic history event with type EventType::UpsertWorkflowSearchAttributes into the
|
114
110
|
// UpsertSearchAttributesMachine-specific event type
|
115
111
|
// UpsertSearchAttributesMachineEvents::CommandRecorded.
|
116
|
-
impl TryFrom<
|
112
|
+
impl TryFrom<HistEventData> for UpsertSearchAttributesMachineEvents {
|
117
113
|
type Error = WFMachinesError;
|
118
114
|
|
119
|
-
fn try_from(e:
|
115
|
+
fn try_from(e: HistEventData) -> Result<Self, Self::Error> {
|
116
|
+
let e = e.event;
|
120
117
|
match e.event_type() {
|
121
118
|
EventType::UpsertWorkflowSearchAttributes => {
|
122
119
|
Ok(UpsertSearchAttributesMachineEvents::CommandRecorded)
|
@@ -233,7 +230,13 @@ mod tests {
|
|
233
230
|
..Default::default()
|
234
231
|
};
|
235
232
|
assert!(sm.matches_event(&recorded_history_event));
|
236
|
-
let cmd_recorded_sm_event =
|
233
|
+
let cmd_recorded_sm_event = HistEventData {
|
234
|
+
event: recorded_history_event,
|
235
|
+
replaying: false,
|
236
|
+
current_task_is_last_in_history: true,
|
237
|
+
}
|
238
|
+
.try_into()
|
239
|
+
.unwrap();
|
237
240
|
|
238
241
|
OnEventWrapper::on_event_mut(&mut sm, cmd_scheduled_sm_event)
|
239
242
|
.expect("CommandScheduled should transition Created -> CommandIssued");
|
@@ -1,15 +1,13 @@
|
|
1
|
-
use super::super::
|
1
|
+
use super::super::local_activity_state_machine::ResolveDat;
|
2
2
|
use crate::{
|
3
|
-
protosext::{
|
3
|
+
protosext::{CompleteLocalActivityData, ValidScheduleLA},
|
4
4
|
worker::{ExecutingLAId, LocalActRequest, NewLocalAct},
|
5
5
|
};
|
6
6
|
use std::{
|
7
7
|
collections::{HashMap, HashSet},
|
8
8
|
time::SystemTime,
|
9
9
|
};
|
10
|
-
use temporal_sdk_core_protos::temporal::api::
|
11
|
-
common::v1::WorkflowExecution, history::v1::HistoryEvent,
|
12
|
-
};
|
10
|
+
use temporal_sdk_core_protos::temporal::api::common::v1::WorkflowExecution;
|
13
11
|
|
14
12
|
#[derive(Default)]
|
15
13
|
pub(super) struct LocalActivityData {
|
@@ -53,7 +51,7 @@ impl LocalActivityData {
|
|
53
51
|
.chain(self.new_requests.drain(..).map(|sa| {
|
54
52
|
self.executing.insert(sa.seq);
|
55
53
|
LocalActRequest::New(NewLocalAct {
|
56
|
-
schedule_time:
|
54
|
+
schedule_time: SystemTime::now(),
|
57
55
|
schedule_cmd: sa,
|
58
56
|
workflow_type: wf_type.to_string(),
|
59
57
|
workflow_exec_info: WorkflowExecution {
|
@@ -70,17 +68,8 @@ impl LocalActivityData {
|
|
70
68
|
self.executing.len() + self.new_requests.len()
|
71
69
|
}
|
72
70
|
|
73
|
-
pub(super) fn
|
74
|
-
|
75
|
-
self.preresolutions
|
76
|
-
.insert(la_dat.marker_dat.seq, la_dat.into());
|
77
|
-
} else {
|
78
|
-
return Err(WFMachinesError::Fatal(format!(
|
79
|
-
"Local activity marker was unparsable: {:?}",
|
80
|
-
e
|
81
|
-
)));
|
82
|
-
}
|
83
|
-
Ok(())
|
71
|
+
pub(super) fn insert_peeked_marker(&mut self, dat: CompleteLocalActivityData) {
|
72
|
+
self.preresolutions.insert(dat.marker_dat.seq, dat.into());
|
84
73
|
}
|
85
74
|
|
86
75
|
pub(super) fn take_preresolution(&mut self, seq: u32) -> Option<ResolveDat> {
|