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
|
@@ -13,14 +13,16 @@ categories = ["development-tools"]
|
|
|
13
13
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
|
14
14
|
|
|
15
15
|
[dependencies]
|
|
16
|
-
anyhow = "1.0"
|
|
17
16
|
async-trait = "0.1"
|
|
18
|
-
derive_builder = "0.
|
|
19
|
-
log = "0.4"
|
|
20
|
-
opentelemetry = "0.18"
|
|
17
|
+
derive_builder = "0.12"
|
|
21
18
|
prost-types = "0.11"
|
|
19
|
+
serde = { version = "1.0", default_features = false, features = ["derive"] }
|
|
20
|
+
serde_json = "1.0"
|
|
22
21
|
thiserror = "1.0"
|
|
22
|
+
tokio = "1.24"
|
|
23
23
|
tonic = "0.8"
|
|
24
|
+
tracing-core = "0.1"
|
|
25
|
+
url = "2.3"
|
|
24
26
|
|
|
25
27
|
[dependencies.temporal-sdk-core-protos]
|
|
26
28
|
path = "../sdk-core-protos"
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
//! Error types exposed by public APIs
|
|
2
2
|
|
|
3
|
-
use
|
|
4
|
-
use temporal_sdk_core_protos::coresdk::{
|
|
5
|
-
activity_result::ActivityExecutionResult,
|
|
6
|
-
workflow_activation::remove_from_cache::EvictionReason,
|
|
7
|
-
};
|
|
3
|
+
use temporal_sdk_core_protos::coresdk::activity_result::ActivityExecutionResult;
|
|
8
4
|
|
|
9
5
|
/// Errors thrown by [crate::Worker::poll_workflow_activation]
|
|
10
6
|
#[derive(thiserror::Error, Debug)]
|
|
@@ -64,32 +60,3 @@ pub enum CompleteActivityError {
|
|
|
64
60
|
completion: Option<ActivityExecutionResult>,
|
|
65
61
|
},
|
|
66
62
|
}
|
|
67
|
-
|
|
68
|
-
/// Errors thrown inside of workflow machines
|
|
69
|
-
#[derive(thiserror::Error, Debug)]
|
|
70
|
-
pub enum WFMachinesError {
|
|
71
|
-
#[error("Nondeterminism error: {0}")]
|
|
72
|
-
Nondeterminism(String),
|
|
73
|
-
#[error("Fatal error in workflow machines: {0}")]
|
|
74
|
-
Fatal(String),
|
|
75
|
-
|
|
76
|
-
#[error("Unrecoverable network error while fetching history: {0}")]
|
|
77
|
-
HistoryFetchingError(tonic::Status),
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
impl WFMachinesError {
|
|
81
|
-
pub fn evict_reason(&self) -> EvictionReason {
|
|
82
|
-
match self {
|
|
83
|
-
WFMachinesError::Nondeterminism(_) => EvictionReason::Nondeterminism,
|
|
84
|
-
WFMachinesError::Fatal(_) | WFMachinesError::HistoryFetchingError(_) => {
|
|
85
|
-
EvictionReason::Fatal
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
impl From<TimestampError> for WFMachinesError {
|
|
92
|
-
fn from(_: TimestampError) -> Self {
|
|
93
|
-
Self::Fatal("Could not decode timestamp".to_string())
|
|
94
|
-
}
|
|
95
|
-
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
pub mod errors;
|
|
2
|
+
pub mod telemetry;
|
|
2
3
|
pub mod worker;
|
|
3
4
|
|
|
4
5
|
use crate::{
|
|
5
6
|
errors::{CompleteActivityError, CompleteWfError, PollActivityError, PollWfError},
|
|
6
7
|
worker::WorkerConfig,
|
|
7
8
|
};
|
|
8
|
-
use log::Level;
|
|
9
|
-
use opentelemetry::metrics::Meter;
|
|
10
|
-
use std::time::{Duration, SystemTime, UNIX_EPOCH};
|
|
11
9
|
use temporal_sdk_core_protos::coresdk::{
|
|
12
10
|
activity_task::ActivityTask, workflow_activation::WorkflowActivation,
|
|
13
11
|
workflow_completion::WorkflowActivationCompletion, ActivityHeartbeat, ActivityTaskCompletion,
|
|
@@ -47,13 +45,17 @@ pub trait Worker: Send + Sync {
|
|
|
47
45
|
/// concurrently internally.
|
|
48
46
|
async fn poll_activity_task(&self) -> Result<ActivityTask, PollActivityError>;
|
|
49
47
|
|
|
50
|
-
/// Tell the worker that a workflow activation has completed. May be freely called
|
|
48
|
+
/// Tell the worker that a workflow activation has completed. May (and should) be freely called
|
|
49
|
+
/// concurrently. The future may take some time to resolve, as fetching more events might be
|
|
50
|
+
/// necessary for completion to... complete - thus SDK implementers should make sure they do
|
|
51
|
+
/// not serialize completions.
|
|
51
52
|
async fn complete_workflow_activation(
|
|
52
53
|
&self,
|
|
53
54
|
completion: WorkflowActivationCompletion,
|
|
54
55
|
) -> Result<(), CompleteWfError>;
|
|
55
56
|
|
|
56
|
-
/// Tell the worker that an activity has finished executing. May be freely called
|
|
57
|
+
/// Tell the worker that an activity has finished executing. May (and should) be freely called
|
|
58
|
+
/// concurrently.
|
|
57
59
|
async fn complete_activity_task(
|
|
58
60
|
&self,
|
|
59
61
|
completion: ActivityTaskCompletion,
|
|
@@ -109,43 +111,3 @@ pub trait Worker: Send + Sync {
|
|
|
109
111
|
/// This should be called only after [Worker::shutdown] has resolved.
|
|
110
112
|
async fn finalize_shutdown(self);
|
|
111
113
|
}
|
|
112
|
-
|
|
113
|
-
/// Should be backed by a process-wide singleton who is responsible for telemetry and logging
|
|
114
|
-
/// management.
|
|
115
|
-
pub trait CoreTelemetry {
|
|
116
|
-
/// Core buffers logs that should be shuttled over to lang so that they may be rendered with
|
|
117
|
-
/// the user's desired logging library. Use this function to grab the most recent buffered logs
|
|
118
|
-
/// since the last time it was called. A fixed number of such logs are retained at maximum, with
|
|
119
|
-
/// the oldest being dropped when full.
|
|
120
|
-
///
|
|
121
|
-
/// Returns the list of logs from oldest to newest. Returns an empty vec if the feature is not
|
|
122
|
-
/// configured.
|
|
123
|
-
fn fetch_buffered_logs(&self) -> Vec<CoreLog>;
|
|
124
|
-
|
|
125
|
-
/// If metrics gathering is enabled, returns the OTel meter for core telemetry, which can be
|
|
126
|
-
/// used to create metrics instruments, or passed to things that create/record metrics (ex:
|
|
127
|
-
/// clients).
|
|
128
|
-
fn get_metric_meter(&self) -> Option<&Meter>;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
/// A log line (which ultimately came from a tracing event) exported from Core->Lang
|
|
132
|
-
#[derive(Debug)]
|
|
133
|
-
pub struct CoreLog {
|
|
134
|
-
/// Log message
|
|
135
|
-
pub message: String,
|
|
136
|
-
/// Time log was generated (not when it was exported to lang)
|
|
137
|
-
pub timestamp: SystemTime,
|
|
138
|
-
/// Message level
|
|
139
|
-
pub level: Level,
|
|
140
|
-
// KV pairs aren't meaningfully exposed yet to the log interface by tracing
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
impl CoreLog {
|
|
144
|
-
/// Return timestamp as ms since epoch
|
|
145
|
-
pub fn millis_since_epoch(&self) -> u128 {
|
|
146
|
-
self.timestamp
|
|
147
|
-
.duration_since(UNIX_EPOCH)
|
|
148
|
-
.unwrap_or(Duration::ZERO)
|
|
149
|
-
.as_millis()
|
|
150
|
-
}
|
|
151
|
-
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
use std::{
|
|
2
|
+
collections::HashMap,
|
|
3
|
+
net::SocketAddr,
|
|
4
|
+
time::{Duration, SystemTime, UNIX_EPOCH},
|
|
5
|
+
};
|
|
6
|
+
use tracing_core::Level;
|
|
7
|
+
use url::Url;
|
|
8
|
+
|
|
9
|
+
/// Each core runtime instance has a telemetry subsystem associated with it, this trait defines the
|
|
10
|
+
/// operations that lang might want to perform on that telemetry after it's initialized.
|
|
11
|
+
pub trait CoreTelemetry {
|
|
12
|
+
/// Each worker buffers logs that should be shuttled over to lang so that they may be rendered
|
|
13
|
+
/// with the user's desired logging library. Use this function to grab the most recent buffered
|
|
14
|
+
/// logs since the last time it was called. A fixed number of such logs are retained at maximum,
|
|
15
|
+
/// with the oldest being dropped when full.
|
|
16
|
+
///
|
|
17
|
+
/// Returns the list of logs from oldest to newest. Returns an empty vec if the feature is not
|
|
18
|
+
/// configured.
|
|
19
|
+
fn fetch_buffered_logs(&self) -> Vec<CoreLog>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/// Telemetry configuration options. Construct with [TelemetryOptionsBuilder]
|
|
23
|
+
#[derive(Debug, Clone, derive_builder::Builder)]
|
|
24
|
+
#[non_exhaustive]
|
|
25
|
+
pub struct TelemetryOptions {
|
|
26
|
+
/// Optional trace exporter - set as None to disable.
|
|
27
|
+
#[builder(setter(into, strip_option), default)]
|
|
28
|
+
pub tracing: Option<TraceExportConfig>,
|
|
29
|
+
/// Optional logger - set as None to disable.
|
|
30
|
+
#[builder(setter(into, strip_option), default)]
|
|
31
|
+
pub logging: Option<Logger>,
|
|
32
|
+
/// Optional metrics exporter - set as None to disable.
|
|
33
|
+
#[builder(setter(into, strip_option), default)]
|
|
34
|
+
pub metrics: Option<MetricsExporter>,
|
|
35
|
+
|
|
36
|
+
/// If set true, do not prefix metrics with `temporal_`. Will be removed eventually as
|
|
37
|
+
/// the prefix is consistent with other SDKs.
|
|
38
|
+
#[builder(default)]
|
|
39
|
+
pub no_temporal_prefix_for_metrics: bool,
|
|
40
|
+
|
|
41
|
+
/// Specifies the aggregation temporality for metric export. Defaults to cumulative.
|
|
42
|
+
#[builder(default = "MetricTemporality::Cumulative")]
|
|
43
|
+
pub metric_temporality: MetricTemporality,
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/// Options for exporting to an OpenTelemetry Collector
|
|
47
|
+
#[derive(Debug, Clone)]
|
|
48
|
+
pub struct OtelCollectorOptions {
|
|
49
|
+
/// The url of the OTel collector to export telemetry and metrics to. Lang SDK should also
|
|
50
|
+
/// export to this same collector.
|
|
51
|
+
pub url: Url,
|
|
52
|
+
/// Optional set of HTTP headers to send to the Collector, e.g for authentication.
|
|
53
|
+
pub headers: HashMap<String, String>,
|
|
54
|
+
/// Optionally specify how frequently metrics should be exported. Defaults to 1 second.
|
|
55
|
+
pub metric_periodicity: Option<Duration>,
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/// Configuration for the external export of traces
|
|
59
|
+
#[derive(Debug, Clone)]
|
|
60
|
+
pub struct TraceExportConfig {
|
|
61
|
+
/// An [EnvFilter](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.EnvFilter.html) filter string.
|
|
62
|
+
pub filter: String,
|
|
63
|
+
/// Where they should go
|
|
64
|
+
pub exporter: TraceExporter,
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/// Control where traces are exported.
|
|
68
|
+
#[derive(Debug, Clone)]
|
|
69
|
+
pub enum TraceExporter {
|
|
70
|
+
/// Export traces to an OpenTelemetry Collector <https://opentelemetry.io/docs/collector/>.
|
|
71
|
+
Otel(OtelCollectorOptions),
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/// Control where metrics are exported
|
|
75
|
+
#[derive(Debug, Clone)]
|
|
76
|
+
pub enum MetricsExporter {
|
|
77
|
+
/// Export metrics to an OpenTelemetry Collector <https://opentelemetry.io/docs/collector/>.
|
|
78
|
+
Otel(OtelCollectorOptions),
|
|
79
|
+
/// Expose metrics directly via an embedded http server bound to the provided address.
|
|
80
|
+
Prometheus(SocketAddr),
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/// Control where logs go
|
|
84
|
+
#[derive(Debug, Clone)]
|
|
85
|
+
pub enum Logger {
|
|
86
|
+
/// Log directly to console.
|
|
87
|
+
Console {
|
|
88
|
+
/// An [EnvFilter](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.EnvFilter.html) filter string.
|
|
89
|
+
filter: String,
|
|
90
|
+
},
|
|
91
|
+
/// Forward logs to Lang - collectable with `fetch_global_buffered_logs`.
|
|
92
|
+
Forward {
|
|
93
|
+
/// An [EnvFilter](https://docs.rs/tracing-subscriber/latest/tracing_subscriber/struct.EnvFilter.html) filter string.
|
|
94
|
+
filter: String,
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/// Types of aggregation temporality for metric export.
|
|
99
|
+
/// See: <https://github.com/open-telemetry/opentelemetry-specification/blob/ce50e4634efcba8da445cc23523243cb893905cb/specification/metrics/datamodel.md#temporality>
|
|
100
|
+
#[derive(Debug, Clone, Copy)]
|
|
101
|
+
pub enum MetricTemporality {
|
|
102
|
+
/// Successive data points repeat the starting timestamp
|
|
103
|
+
Cumulative,
|
|
104
|
+
/// Successive data points advance the starting timestamp
|
|
105
|
+
Delta,
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
impl Default for TelemetryOptions {
|
|
109
|
+
fn default() -> Self {
|
|
110
|
+
TelemetryOptionsBuilder::default().build().unwrap()
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/// A log line (which ultimately came from a tracing event) exported from Core->Lang
|
|
115
|
+
#[derive(Debug)]
|
|
116
|
+
pub struct CoreLog {
|
|
117
|
+
/// The module within core this message originated from
|
|
118
|
+
pub target: String,
|
|
119
|
+
/// Log message
|
|
120
|
+
pub message: String,
|
|
121
|
+
/// Time log was generated (not when it was exported to lang)
|
|
122
|
+
pub timestamp: SystemTime,
|
|
123
|
+
/// Message level
|
|
124
|
+
pub level: Level,
|
|
125
|
+
/// Arbitrary k/v pairs (span k/vs are collapsed with event k/vs here). We could change this
|
|
126
|
+
/// to include them in `span_contexts` instead, but there's probably not much value for log
|
|
127
|
+
/// forwarding.
|
|
128
|
+
pub fields: HashMap<String, serde_json::Value>,
|
|
129
|
+
/// A list of the outermost to the innermost span names
|
|
130
|
+
pub span_contexts: Vec<String>,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
impl CoreLog {
|
|
134
|
+
/// Return timestamp as ms since epoch
|
|
135
|
+
pub fn millis_since_epoch(&self) -> u128 {
|
|
136
|
+
self.timestamp
|
|
137
|
+
.duration_since(UNIX_EPOCH)
|
|
138
|
+
.unwrap_or(Duration::ZERO)
|
|
139
|
+
.as_millis()
|
|
140
|
+
}
|
|
141
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
use std::time::Duration;
|
|
2
|
+
use tokio::sync::mpsc::UnboundedSender;
|
|
2
3
|
|
|
3
4
|
/// Defines per-worker configuration options
|
|
4
|
-
#[derive(Debug, Clone, derive_builder::Builder)]
|
|
5
|
+
#[derive(Debug, Clone, derive_builder::Builder, serde::Serialize, serde::Deserialize)]
|
|
5
6
|
#[builder(setter(into), build_fn(validate = "Self::validate"))]
|
|
6
7
|
#[non_exhaustive]
|
|
7
8
|
pub struct WorkerConfig {
|
|
@@ -95,6 +96,28 @@ pub struct WorkerConfig {
|
|
|
95
96
|
/// todo: link to feature docs
|
|
96
97
|
#[builder(default = "false")]
|
|
97
98
|
pub use_worker_versioning: bool,
|
|
99
|
+
|
|
100
|
+
/// If set false (default), shutdown will not finish until all pending evictions have been
|
|
101
|
+
/// issued and replied to. If set true shutdown will be considered complete when the only
|
|
102
|
+
/// remaining work is pending evictions.
|
|
103
|
+
///
|
|
104
|
+
/// This flag is useful during tests to avoid needing to deal with lots of uninteresting
|
|
105
|
+
/// evictions during shutdown. Alternatively, if a lang implementation finds it easy to clean
|
|
106
|
+
/// up during shutdown, setting this true saves some back-and-forth.
|
|
107
|
+
#[builder(default = "false")]
|
|
108
|
+
pub ignore_evicts_on_shutdown: bool,
|
|
109
|
+
|
|
110
|
+
/// Maximum number of next page (or initial) history event listing requests we'll make
|
|
111
|
+
/// concurrently. I don't this it's worth exposing this to users until we encounter a reason.
|
|
112
|
+
#[builder(default = "5")]
|
|
113
|
+
pub fetching_concurrency: usize,
|
|
114
|
+
|
|
115
|
+
/// If set, and the `save_wf_inputs` feature is enabled in core, will be sent a serialized
|
|
116
|
+
/// instance of every input to workflow state in order. This is for testing purposes, SDK
|
|
117
|
+
/// implementations never need to care about it.
|
|
118
|
+
#[builder(default)]
|
|
119
|
+
#[serde(skip)]
|
|
120
|
+
pub wf_state_inputs: Option<UnboundedSender<Vec<u8>>>,
|
|
98
121
|
}
|
|
99
122
|
|
|
100
123
|
impl WorkerConfig {
|
|
@@ -114,6 +137,9 @@ impl WorkerConfigBuilder {
|
|
|
114
137
|
if self.max_concurrent_wft_polls == Some(0) {
|
|
115
138
|
return Err("`max_concurrent_wft_polls` must be at least 1".to_owned());
|
|
116
139
|
}
|
|
140
|
+
if self.max_concurrent_at_polls == Some(0) {
|
|
141
|
+
return Err("`max_concurrent_at_polls` must be at least 1".to_owned());
|
|
142
|
+
}
|
|
117
143
|
if self.max_cached_workflows > Some(0)
|
|
118
144
|
&& self.max_outstanding_workflow_tasks > self.max_cached_workflows
|
|
119
145
|
{
|