temporalio 0.0.1 → 0.1.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.
- 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
|
@@ -8,11 +8,8 @@ mod complete_workflow_state_machine;
|
|
|
8
8
|
mod continue_as_new_workflow_state_machine;
|
|
9
9
|
mod fail_workflow_state_machine;
|
|
10
10
|
mod local_activity_state_machine;
|
|
11
|
-
|
|
12
|
-
mod mutable_side_effect_state_machine;
|
|
11
|
+
mod modify_workflow_properties_state_machine;
|
|
13
12
|
mod patch_state_machine;
|
|
14
|
-
#[allow(unused)]
|
|
15
|
-
mod side_effect_state_machine;
|
|
16
13
|
mod signal_external_state_machine;
|
|
17
14
|
mod timer_state_machine;
|
|
18
15
|
mod upsert_search_attributes_state_machine;
|
|
@@ -21,9 +18,9 @@ mod workflow_task_state_machine;
|
|
|
21
18
|
#[cfg(test)]
|
|
22
19
|
mod transition_coverage;
|
|
23
20
|
|
|
24
|
-
pub(crate) use workflow_machines::
|
|
21
|
+
pub(crate) use workflow_machines::WorkflowMachines;
|
|
25
22
|
|
|
26
|
-
use crate::telemetry::VecDisplayer;
|
|
23
|
+
use crate::{telemetry::VecDisplayer, worker::workflow::WFMachinesError};
|
|
27
24
|
use activity_state_machine::ActivityMachine;
|
|
28
25
|
use cancel_external_state_machine::CancelExternalMachine;
|
|
29
26
|
use cancel_workflow_state_machine::CancelWorkflowMachine;
|
|
@@ -32,8 +29,8 @@ use complete_workflow_state_machine::CompleteWorkflowMachine;
|
|
|
32
29
|
use continue_as_new_workflow_state_machine::ContinueAsNewWorkflowMachine;
|
|
33
30
|
use fail_workflow_state_machine::FailWorkflowMachine;
|
|
34
31
|
use local_activity_state_machine::LocalActivityMachine;
|
|
32
|
+
use modify_workflow_properties_state_machine::ModifyWorkflowPropertiesMachine;
|
|
35
33
|
use patch_state_machine::PatchMachine;
|
|
36
|
-
use prost::alloc::fmt::Formatter;
|
|
37
34
|
use rustfsm::{MachineError, StateMachine};
|
|
38
35
|
use signal_external_state_machine::SignalExternalMachine;
|
|
39
36
|
use std::{
|
|
@@ -53,23 +50,6 @@ use workflow_task_state_machine::WorkflowTaskMachine;
|
|
|
53
50
|
#[cfg(test)]
|
|
54
51
|
use transition_coverage::add_coverage;
|
|
55
52
|
|
|
56
|
-
#[derive(Copy, Clone, Debug, derive_more::Display, Eq, PartialEq)]
|
|
57
|
-
enum MachineKind {
|
|
58
|
-
Activity,
|
|
59
|
-
CancelWorkflow,
|
|
60
|
-
ChildWorkflow,
|
|
61
|
-
CompleteWorkflow,
|
|
62
|
-
ContinueAsNewWorkflow,
|
|
63
|
-
FailWorkflow,
|
|
64
|
-
Timer,
|
|
65
|
-
Patch,
|
|
66
|
-
WorkflowTask,
|
|
67
|
-
SignalExternalWorkflow,
|
|
68
|
-
CancelExternalWorkflow,
|
|
69
|
-
LocalActivity,
|
|
70
|
-
UpsertSearchAttributes,
|
|
71
|
-
}
|
|
72
|
-
|
|
73
53
|
#[enum_dispatch::enum_dispatch]
|
|
74
54
|
#[allow(clippy::enum_variant_names, clippy::large_enum_variant)]
|
|
75
55
|
enum Machines {
|
|
@@ -86,14 +66,14 @@ enum Machines {
|
|
|
86
66
|
TimerMachine,
|
|
87
67
|
WorkflowTaskMachine,
|
|
88
68
|
UpsertSearchAttributesMachine,
|
|
69
|
+
ModifyWorkflowPropertiesMachine,
|
|
89
70
|
}
|
|
90
71
|
|
|
91
72
|
/// Extends [rustfsm::StateMachine] with some functionality specific to the temporal SDK.
|
|
92
73
|
///
|
|
93
74
|
/// Formerly known as `EntityStateMachine` in Java.
|
|
94
75
|
#[enum_dispatch::enum_dispatch(Machines)]
|
|
95
|
-
trait TemporalStateMachine
|
|
96
|
-
fn kind(&self) -> MachineKind;
|
|
76
|
+
trait TemporalStateMachine {
|
|
97
77
|
fn handle_command(
|
|
98
78
|
&mut self,
|
|
99
79
|
command_type: CommandType,
|
|
@@ -108,8 +88,7 @@ trait TemporalStateMachine: Send {
|
|
|
108
88
|
/// to update the overall state of the workflow. EX: To issue outgoing WF activations.
|
|
109
89
|
fn handle_event(
|
|
110
90
|
&mut self,
|
|
111
|
-
event:
|
|
112
|
-
has_next_event: bool,
|
|
91
|
+
event: HistEventData,
|
|
113
92
|
) -> Result<Vec<MachineResponse>, WFMachinesError>;
|
|
114
93
|
|
|
115
94
|
/// Attempt to cancel the command associated with this state machine, if it is cancellable
|
|
@@ -121,21 +100,20 @@ trait TemporalStateMachine: Send {
|
|
|
121
100
|
|
|
122
101
|
/// Returns true if the state machine is in a final state
|
|
123
102
|
fn is_final_state(&self) -> bool;
|
|
103
|
+
|
|
104
|
+
/// Returns a friendly name for the type of this machine
|
|
105
|
+
fn name(&self) -> &str;
|
|
124
106
|
}
|
|
125
107
|
|
|
126
108
|
impl<SM> TemporalStateMachine for SM
|
|
127
109
|
where
|
|
128
|
-
SM: StateMachine + WFMachinesAdapter + Cancellable + OnEventWrapper + Clone +
|
|
129
|
-
<SM as StateMachine>::Event: TryFrom<
|
|
130
|
-
WFMachinesError: From<<<SM as StateMachine>::Event as TryFrom<
|
|
110
|
+
SM: StateMachine + WFMachinesAdapter + Cancellable + OnEventWrapper + Clone + 'static,
|
|
111
|
+
<SM as StateMachine>::Event: TryFrom<HistEventData> + TryFrom<CommandType> + Display,
|
|
112
|
+
WFMachinesError: From<<<SM as StateMachine>::Event as TryFrom<HistEventData>>::Error>,
|
|
131
113
|
<SM as StateMachine>::Command: Debug + Display,
|
|
132
114
|
<SM as StateMachine>::State: Display,
|
|
133
115
|
<SM as StateMachine>::Error: Into<WFMachinesError> + 'static + Send + Sync,
|
|
134
116
|
{
|
|
135
|
-
fn kind(&self) -> MachineKind {
|
|
136
|
-
self.kind()
|
|
137
|
-
}
|
|
138
|
-
|
|
139
117
|
fn handle_command(
|
|
140
118
|
&mut self,
|
|
141
119
|
command_type: CommandType,
|
|
@@ -162,7 +140,7 @@ where
|
|
|
162
140
|
Err(WFMachinesError::Nondeterminism(format!(
|
|
163
141
|
"Unexpected command {:?} generated by a {:?} machine",
|
|
164
142
|
command_type,
|
|
165
|
-
self.
|
|
143
|
+
self.name()
|
|
166
144
|
)))
|
|
167
145
|
}
|
|
168
146
|
}
|
|
@@ -173,21 +151,19 @@ where
|
|
|
173
151
|
|
|
174
152
|
fn handle_event(
|
|
175
153
|
&mut self,
|
|
176
|
-
|
|
177
|
-
has_next_event: bool,
|
|
154
|
+
event_dat: HistEventData,
|
|
178
155
|
) -> Result<Vec<MachineResponse>, WFMachinesError> {
|
|
179
156
|
trace!(
|
|
180
|
-
event = %event,
|
|
157
|
+
event = %event_dat.event,
|
|
181
158
|
machine_name = %self.name(),
|
|
182
159
|
state = %self.state(),
|
|
183
160
|
"handling event"
|
|
184
161
|
);
|
|
185
162
|
let event_info = EventInfo {
|
|
186
|
-
event_id: event.event_id,
|
|
187
|
-
event_type: event.event_type(),
|
|
188
|
-
has_next_event,
|
|
163
|
+
event_id: event_dat.event.event_id,
|
|
164
|
+
event_type: event_dat.event.event_type(),
|
|
189
165
|
};
|
|
190
|
-
let converted_event: <Self as StateMachine>::Event =
|
|
166
|
+
let converted_event: <Self as StateMachine>::Event = event_dat.try_into()?;
|
|
191
167
|
|
|
192
168
|
match OnEventWrapper::on_event_mut(self, converted_event) {
|
|
193
169
|
Ok(c) => process_machine_commands(self, c, Some(event_info)),
|
|
@@ -220,6 +196,10 @@ where
|
|
|
220
196
|
fn is_final_state(&self) -> bool {
|
|
221
197
|
self.has_reached_final_state()
|
|
222
198
|
}
|
|
199
|
+
|
|
200
|
+
fn name(&self) -> &str {
|
|
201
|
+
self.name()
|
|
202
|
+
}
|
|
223
203
|
}
|
|
224
204
|
|
|
225
205
|
fn process_machine_commands<SM>(
|
|
@@ -234,8 +214,8 @@ where
|
|
|
234
214
|
<SM as StateMachine>::State: Display,
|
|
235
215
|
{
|
|
236
216
|
if !commands.is_empty() {
|
|
237
|
-
|
|
238
|
-
machine_name=%TemporalStateMachine::
|
|
217
|
+
trace!(commands=%commands.display(), state=%machine.state(),
|
|
218
|
+
machine_name=%TemporalStateMachine::name(machine), "Machine produced commands");
|
|
239
219
|
}
|
|
240
220
|
let mut machine_responses = vec![];
|
|
241
221
|
for cmd in commands {
|
|
@@ -260,16 +240,24 @@ trait WFMachinesAdapter: StateMachine {
|
|
|
260
240
|
/// ahead of time if it's worth trying to call [TemporalStateMachine::handle_event] without
|
|
261
241
|
/// requiring mutable access.
|
|
262
242
|
fn matches_event(&self, event: &HistoryEvent) -> bool;
|
|
243
|
+
}
|
|
263
244
|
|
|
264
|
-
|
|
265
|
-
|
|
245
|
+
/// Wraps a history event with extra relevant data that a machine might care about while the event
|
|
246
|
+
/// is being applied to it.
|
|
247
|
+
#[derive(Debug, derive_more::Display)]
|
|
248
|
+
#[display(fmt = "{event}")]
|
|
249
|
+
struct HistEventData {
|
|
250
|
+
event: HistoryEvent,
|
|
251
|
+
/// Is the current workflow task under replay or not during application of this event?
|
|
252
|
+
replaying: bool,
|
|
253
|
+
/// Is the current workflow task the last task in history?
|
|
254
|
+
current_task_is_last_in_history: bool,
|
|
266
255
|
}
|
|
267
256
|
|
|
268
257
|
#[derive(Debug, Copy, Clone)]
|
|
269
258
|
struct EventInfo {
|
|
270
259
|
event_id: i64,
|
|
271
260
|
event_type: EventType,
|
|
272
|
-
has_next_event: bool,
|
|
273
261
|
}
|
|
274
262
|
|
|
275
263
|
trait Cancellable: StateMachine {
|
|
@@ -334,9 +322,3 @@ struct NewMachineWithCommand {
|
|
|
334
322
|
command: ProtoCommand,
|
|
335
323
|
machine: Machines,
|
|
336
324
|
}
|
|
337
|
-
|
|
338
|
-
impl Debug for dyn TemporalStateMachine {
|
|
339
|
-
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
340
|
-
std::fmt::Display::fmt(&self.kind(), f)
|
|
341
|
-
}
|
|
342
|
-
}
|
data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
use super::{workflow_machines::MachineResponse, NewMachineWithCommand};
|
|
2
|
+
use crate::worker::workflow::{
|
|
3
|
+
machines::{Cancellable, EventInfo, HistEventData, WFMachinesAdapter},
|
|
4
|
+
WFMachinesError,
|
|
5
|
+
};
|
|
6
|
+
use rustfsm::{fsm, TransitionResult};
|
|
7
|
+
use temporal_sdk_core_protos::{
|
|
8
|
+
coresdk::workflow_commands::ModifyWorkflowProperties,
|
|
9
|
+
temporal::api::{
|
|
10
|
+
command::v1::Command,
|
|
11
|
+
enums::v1::{CommandType, EventType},
|
|
12
|
+
history::v1::HistoryEvent,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
fsm! {
|
|
17
|
+
pub(super) name ModifyWorkflowPropertiesMachine;
|
|
18
|
+
command ModifyWorkflowPropertiesMachineCommand;
|
|
19
|
+
error WFMachinesError;
|
|
20
|
+
shared_state SharedState;
|
|
21
|
+
|
|
22
|
+
Created --(CommandScheduled) --> CommandIssued;
|
|
23
|
+
CommandIssued --(CommandRecorded) --> Done;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/// Instantiates an ModifyWorkflowPropertiesMachine and packs it together with the command to
|
|
27
|
+
/// be sent to server.
|
|
28
|
+
pub(super) fn modify_workflow_properties(
|
|
29
|
+
lang_cmd: ModifyWorkflowProperties,
|
|
30
|
+
) -> NewMachineWithCommand {
|
|
31
|
+
let sm = ModifyWorkflowPropertiesMachine {
|
|
32
|
+
state: Created {}.into(),
|
|
33
|
+
shared_state: (),
|
|
34
|
+
};
|
|
35
|
+
let cmd = Command {
|
|
36
|
+
command_type: CommandType::ModifyWorkflowProperties as i32,
|
|
37
|
+
attributes: Some(lang_cmd.into()),
|
|
38
|
+
};
|
|
39
|
+
NewMachineWithCommand {
|
|
40
|
+
command: cmd,
|
|
41
|
+
machine: sm.into(),
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type SharedState = ();
|
|
46
|
+
|
|
47
|
+
#[derive(Debug, derive_more::Display)]
|
|
48
|
+
pub(super) enum ModifyWorkflowPropertiesMachineCommand {}
|
|
49
|
+
|
|
50
|
+
#[derive(Debug, Default, Clone, derive_more::Display)]
|
|
51
|
+
pub(super) struct Created {}
|
|
52
|
+
|
|
53
|
+
#[derive(Debug, Default, Clone, derive_more::Display)]
|
|
54
|
+
pub(super) struct CommandIssued {}
|
|
55
|
+
|
|
56
|
+
#[derive(Debug, Default, Clone, derive_more::Display)]
|
|
57
|
+
pub(super) struct Done {}
|
|
58
|
+
|
|
59
|
+
impl WFMachinesAdapter for ModifyWorkflowPropertiesMachine {
|
|
60
|
+
fn adapt_response(
|
|
61
|
+
&self,
|
|
62
|
+
_my_command: Self::Command,
|
|
63
|
+
_event_info: Option<EventInfo>,
|
|
64
|
+
) -> Result<Vec<MachineResponse>, Self::Error> {
|
|
65
|
+
Err(Self::Error::Nondeterminism(
|
|
66
|
+
"ModifyWorkflowProperties does not use state machine commands".to_string(),
|
|
67
|
+
))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
fn matches_event(&self, event: &HistoryEvent) -> bool {
|
|
71
|
+
matches!(event.event_type(), EventType::WorkflowPropertiesModified)
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
impl Cancellable for ModifyWorkflowPropertiesMachine {}
|
|
76
|
+
|
|
77
|
+
impl TryFrom<HistEventData> for ModifyWorkflowPropertiesMachineEvents {
|
|
78
|
+
type Error = WFMachinesError;
|
|
79
|
+
|
|
80
|
+
fn try_from(e: HistEventData) -> Result<Self, Self::Error> {
|
|
81
|
+
let e = e.event;
|
|
82
|
+
match e.event_type() {
|
|
83
|
+
EventType::WorkflowPropertiesModified => {
|
|
84
|
+
Ok(ModifyWorkflowPropertiesMachineEvents::CommandRecorded)
|
|
85
|
+
}
|
|
86
|
+
_ => Err(Self::Error::Nondeterminism(format!(
|
|
87
|
+
"ModifyWorkflowPropertiesMachine does not handle {e}"
|
|
88
|
+
))),
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
impl TryFrom<CommandType> for ModifyWorkflowPropertiesMachineEvents {
|
|
94
|
+
type Error = WFMachinesError;
|
|
95
|
+
|
|
96
|
+
fn try_from(c: CommandType) -> Result<Self, Self::Error> {
|
|
97
|
+
match c {
|
|
98
|
+
CommandType::ModifyWorkflowProperties => {
|
|
99
|
+
Ok(ModifyWorkflowPropertiesMachineEvents::CommandScheduled)
|
|
100
|
+
}
|
|
101
|
+
_ => Err(Self::Error::Nondeterminism(format!(
|
|
102
|
+
"ModifyWorkflowPropertiesMachine does not handle command type {c:?}"
|
|
103
|
+
))),
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
impl From<CommandIssued> for Done {
|
|
109
|
+
fn from(_: CommandIssued) -> Self {
|
|
110
|
+
Self {}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
impl From<Created> for CommandIssued {
|
|
115
|
+
fn from(_: Created) -> Self {
|
|
116
|
+
Self {}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
#[cfg(test)]
|
|
121
|
+
mod tests {
|
|
122
|
+
use super::*;
|
|
123
|
+
use crate::{replay::TestHistoryBuilder, worker::workflow::ManagedWFFunc};
|
|
124
|
+
use temporal_sdk::{WfContext, WorkflowFunction};
|
|
125
|
+
use temporal_sdk_core_protos::temporal::api::{
|
|
126
|
+
command::v1::command::Attributes, common::v1::Payload,
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
#[tokio::test]
|
|
130
|
+
async fn workflow_modify_props() {
|
|
131
|
+
let mut t = TestHistoryBuilder::default();
|
|
132
|
+
t.add_by_type(EventType::WorkflowExecutionStarted);
|
|
133
|
+
t.add_full_wf_task();
|
|
134
|
+
t.add_workflow_execution_completed();
|
|
135
|
+
|
|
136
|
+
let (k1, k2) = ("foo", "bar");
|
|
137
|
+
|
|
138
|
+
let wff = WorkflowFunction::new(move |ctx: WfContext| async move {
|
|
139
|
+
ctx.upsert_memo([
|
|
140
|
+
(
|
|
141
|
+
String::from(k1),
|
|
142
|
+
Payload {
|
|
143
|
+
data: vec![0x01],
|
|
144
|
+
..Default::default()
|
|
145
|
+
},
|
|
146
|
+
),
|
|
147
|
+
(
|
|
148
|
+
String::from(k2),
|
|
149
|
+
Payload {
|
|
150
|
+
data: vec![0x02],
|
|
151
|
+
..Default::default()
|
|
152
|
+
},
|
|
153
|
+
),
|
|
154
|
+
]);
|
|
155
|
+
Ok(().into())
|
|
156
|
+
});
|
|
157
|
+
let mut wfm = ManagedWFFunc::new(t, wff, vec![]);
|
|
158
|
+
|
|
159
|
+
wfm.get_next_activation().await.unwrap();
|
|
160
|
+
let commands = wfm.get_server_commands().commands;
|
|
161
|
+
assert!(!commands.is_empty());
|
|
162
|
+
let cmd = commands[0].clone();
|
|
163
|
+
assert_eq!(
|
|
164
|
+
cmd.command_type,
|
|
165
|
+
CommandType::ModifyWorkflowProperties as i32
|
|
166
|
+
);
|
|
167
|
+
assert_matches!(
|
|
168
|
+
cmd.attributes.unwrap(),
|
|
169
|
+
Attributes::ModifyWorkflowPropertiesCommandAttributes(msg) => {
|
|
170
|
+
let fields = &msg.upserted_memo.unwrap().fields;
|
|
171
|
+
let payload1 = fields.get(k1).unwrap();
|
|
172
|
+
let payload2 = fields.get(k2).unwrap();
|
|
173
|
+
assert_eq!(payload1.data[0], 0x01);
|
|
174
|
+
assert_eq!(payload2.data[0], 0x02);
|
|
175
|
+
assert_eq!(fields.len(), 2);
|
|
176
|
+
});
|
|
177
|
+
wfm.shutdown().await.unwrap();
|
|
178
|
+
}
|
|
179
|
+
}
|