temporalio 0.0.0 → 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +130 -0
- data/bridge/Cargo.lock +2865 -0
- data/bridge/Cargo.toml +26 -0
- data/bridge/sdk-core/ARCHITECTURE.md +76 -0
- data/bridge/sdk-core/Cargo.lock +2606 -0
- data/bridge/sdk-core/Cargo.toml +2 -0
- data/bridge/sdk-core/LICENSE.txt +23 -0
- data/bridge/sdk-core/README.md +107 -0
- data/bridge/sdk-core/arch_docs/diagrams/README.md +10 -0
- data/bridge/sdk-core/arch_docs/diagrams/sticky_queues.puml +40 -0
- data/bridge/sdk-core/arch_docs/diagrams/workflow_internals.svg +1 -0
- data/bridge/sdk-core/arch_docs/sticky_queues.md +51 -0
- data/bridge/sdk-core/bridge-ffi/Cargo.toml +24 -0
- data/bridge/sdk-core/bridge-ffi/LICENSE.txt +23 -0
- data/bridge/sdk-core/bridge-ffi/build.rs +25 -0
- data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +249 -0
- data/bridge/sdk-core/bridge-ffi/src/lib.rs +825 -0
- data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +211 -0
- data/bridge/sdk-core/client/Cargo.toml +40 -0
- data/bridge/sdk-core/client/LICENSE.txt +23 -0
- data/bridge/sdk-core/client/src/lib.rs +1294 -0
- data/bridge/sdk-core/client/src/metrics.rs +165 -0
- data/bridge/sdk-core/client/src/raw.rs +931 -0
- data/bridge/sdk-core/client/src/retry.rs +674 -0
- data/bridge/sdk-core/client/src/workflow_handle/mod.rs +185 -0
- data/bridge/sdk-core/core/Cargo.toml +116 -0
- data/bridge/sdk-core/core/LICENSE.txt +23 -0
- data/bridge/sdk-core/core/benches/workflow_replay.rs +73 -0
- data/bridge/sdk-core/core/src/abstractions.rs +166 -0
- data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +911 -0
- data/bridge/sdk-core/core/src/core_tests/child_workflows.rs +221 -0
- data/bridge/sdk-core/core/src/core_tests/determinism.rs +107 -0
- data/bridge/sdk-core/core/src/core_tests/local_activities.rs +515 -0
- data/bridge/sdk-core/core/src/core_tests/mod.rs +100 -0
- data/bridge/sdk-core/core/src/core_tests/queries.rs +736 -0
- data/bridge/sdk-core/core/src/core_tests/replay_flag.rs +65 -0
- data/bridge/sdk-core/core/src/core_tests/workers.rs +259 -0
- data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +124 -0
- data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +2070 -0
- data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +515 -0
- data/bridge/sdk-core/core/src/lib.rs +175 -0
- data/bridge/sdk-core/core/src/log_export.rs +62 -0
- data/bridge/sdk-core/core/src/pollers/mod.rs +54 -0
- data/bridge/sdk-core/core/src/pollers/poll_buffer.rs +297 -0
- data/bridge/sdk-core/core/src/protosext/mod.rs +428 -0
- data/bridge/sdk-core/core/src/replay/mod.rs +71 -0
- data/bridge/sdk-core/core/src/retry_logic.rs +202 -0
- data/bridge/sdk-core/core/src/telemetry/metrics.rs +383 -0
- data/bridge/sdk-core/core/src/telemetry/mod.rs +412 -0
- data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +77 -0
- data/bridge/sdk-core/core/src/test_help/mod.rs +875 -0
- data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +580 -0
- data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +1042 -0
- data/bridge/sdk-core/core/src/worker/activities.rs +464 -0
- data/bridge/sdk-core/core/src/worker/client/mocks.rs +87 -0
- data/bridge/sdk-core/core/src/worker/client.rs +347 -0
- data/bridge/sdk-core/core/src/worker/mod.rs +566 -0
- data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +37 -0
- data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +110 -0
- data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +458 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +911 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +298 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +171 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +860 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +140 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +161 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +133 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +1448 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +342 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +127 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +712 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +71 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +443 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +439 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +169 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +246 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +96 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +1184 -0
- data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +277 -0
- data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +198 -0
- data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +647 -0
- data/bridge/sdk-core/core/src/worker/workflow/mod.rs +1143 -0
- data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +145 -0
- data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +88 -0
- data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +940 -0
- data/bridge/sdk-core/core-api/Cargo.toml +31 -0
- data/bridge/sdk-core/core-api/LICENSE.txt +23 -0
- data/bridge/sdk-core/core-api/src/errors.rs +95 -0
- data/bridge/sdk-core/core-api/src/lib.rs +151 -0
- data/bridge/sdk-core/core-api/src/worker.rs +135 -0
- data/bridge/sdk-core/etc/deps.svg +187 -0
- data/bridge/sdk-core/etc/dynamic-config.yaml +2 -0
- data/bridge/sdk-core/etc/otel-collector-config.yaml +36 -0
- data/bridge/sdk-core/etc/prometheus.yaml +6 -0
- data/bridge/sdk-core/fsm/Cargo.toml +18 -0
- data/bridge/sdk-core/fsm/LICENSE.txt +23 -0
- data/bridge/sdk-core/fsm/README.md +3 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/Cargo.toml +27 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/LICENSE.txt +23 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +647 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/progress.rs +8 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.rs +18 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dupe_transitions_fail.stderr +12 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/dynamic_dest_pass.rs +41 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.rs +14 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/forgot_name_fail.stderr +11 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_arg_pass.rs +32 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/handler_pass.rs +31 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/medium_complex_pass.rs +46 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.rs +29 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +12 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/simple_pass.rs +32 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.rs +18 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/struct_event_variant_fail.stderr +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.rs +11 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_more_item_event_variant_fail.stderr +5 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.rs +11 -0
- data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/tuple_zero_item_event_variant_fail.stderr +5 -0
- data/bridge/sdk-core/fsm/rustfsm_trait/Cargo.toml +14 -0
- data/bridge/sdk-core/fsm/rustfsm_trait/LICENSE.txt +23 -0
- data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +249 -0
- data/bridge/sdk-core/fsm/src/lib.rs +2 -0
- data/bridge/sdk-core/histories/fail_wf_task.bin +0 -0
- data/bridge/sdk-core/histories/timer_workflow_history.bin +0 -0
- data/bridge/sdk-core/integ-with-otel.sh +7 -0
- data/bridge/sdk-core/protos/api_upstream/README.md +9 -0
- data/bridge/sdk-core/protos/api_upstream/api-linter.yaml +40 -0
- data/bridge/sdk-core/protos/api_upstream/buf.yaml +12 -0
- data/bridge/sdk-core/protos/api_upstream/dependencies/gogoproto/gogo.proto +141 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +86 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +83 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +259 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +112 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +46 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/cluster.proto +40 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +57 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +55 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +168 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +97 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +51 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +50 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +41 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +60 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +59 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +51 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +122 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +108 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +114 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +56 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +751 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +97 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +161 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +99 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +61 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +55 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +300 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +108 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +46 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +59 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +145 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +1124 -0
- data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +401 -0
- data/bridge/sdk-core/protos/grpc/health/v1/health.proto +63 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +78 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +79 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +210 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +77 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +15 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +30 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +30 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +261 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +297 -0
- data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +29 -0
- data/bridge/sdk-core/protos/testsrv_upstream/api-linter.yaml +38 -0
- data/bridge/sdk-core/protos/testsrv_upstream/buf.yaml +13 -0
- data/bridge/sdk-core/protos/testsrv_upstream/dependencies/gogoproto/gogo.proto +141 -0
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +63 -0
- data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +90 -0
- data/bridge/sdk-core/rustfmt.toml +1 -0
- data/bridge/sdk-core/sdk/Cargo.toml +47 -0
- data/bridge/sdk-core/sdk/LICENSE.txt +23 -0
- data/bridge/sdk-core/sdk/src/activity_context.rs +230 -0
- data/bridge/sdk-core/sdk/src/app_data.rs +37 -0
- data/bridge/sdk-core/sdk/src/conversions.rs +8 -0
- data/bridge/sdk-core/sdk/src/interceptors.rs +17 -0
- data/bridge/sdk-core/sdk/src/lib.rs +792 -0
- data/bridge/sdk-core/sdk/src/payload_converter.rs +11 -0
- data/bridge/sdk-core/sdk/src/workflow_context/options.rs +295 -0
- data/bridge/sdk-core/sdk/src/workflow_context.rs +683 -0
- data/bridge/sdk-core/sdk/src/workflow_future.rs +503 -0
- data/bridge/sdk-core/sdk-core-protos/Cargo.toml +30 -0
- data/bridge/sdk-core/sdk-core-protos/LICENSE.txt +23 -0
- data/bridge/sdk-core/sdk-core-protos/build.rs +108 -0
- data/bridge/sdk-core/sdk-core-protos/src/constants.rs +7 -0
- data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +497 -0
- data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +230 -0
- data/bridge/sdk-core/sdk-core-protos/src/lib.rs +1910 -0
- data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +38 -0
- data/bridge/sdk-core/sdk-core-protos/src/utilities.rs +14 -0
- data/bridge/sdk-core/test-utils/Cargo.toml +35 -0
- data/bridge/sdk-core/test-utils/src/canned_histories.rs +1579 -0
- data/bridge/sdk-core/test-utils/src/histfetch.rs +28 -0
- data/bridge/sdk-core/test-utils/src/lib.rs +598 -0
- data/bridge/sdk-core/tests/integ_tests/client_tests.rs +36 -0
- data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +128 -0
- data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +218 -0
- data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +146 -0
- data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +437 -0
- data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +93 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +878 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/appdata_propagation.rs +61 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +59 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +58 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +50 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +60 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +54 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +634 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +113 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +137 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +93 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +167 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +99 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +131 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +75 -0
- data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +587 -0
- data/bridge/sdk-core/tests/load_tests.rs +191 -0
- data/bridge/sdk-core/tests/main.rs +111 -0
- data/bridge/sdk-core/tests/runner.rs +93 -0
- data/bridge/src/connection.rs +167 -0
- data/bridge/src/lib.rs +180 -0
- data/bridge/src/runtime.rs +47 -0
- data/bridge/src/worker.rs +73 -0
- data/ext/Rakefile +9 -0
- data/lib/bridge.so +0 -0
- data/lib/gen/dependencies/gogoproto/gogo_pb.rb +14 -0
- data/lib/gen/temporal/api/batch/v1/message_pb.rb +48 -0
- data/lib/gen/temporal/api/cluster/v1/message_pb.rb +67 -0
- data/lib/gen/temporal/api/command/v1/message_pb.rb +166 -0
- data/lib/gen/temporal/api/common/v1/message_pb.rb +69 -0
- data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +32 -0
- data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +26 -0
- data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +37 -0
- data/lib/gen/temporal/api/enums/v1/common_pb.rb +41 -0
- data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +67 -0
- data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +71 -0
- data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +37 -0
- data/lib/gen/temporal/api/enums/v1/query_pb.rb +31 -0
- data/lib/gen/temporal/api/enums/v1/reset_pb.rb +24 -0
- data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +28 -0
- data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +30 -0
- data/lib/gen/temporal/api/enums/v1/update_pb.rb +28 -0
- data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +89 -0
- data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +84 -0
- data/lib/gen/temporal/api/failure/v1/message_pb.rb +83 -0
- data/lib/gen/temporal/api/filter/v1/message_pb.rb +40 -0
- data/lib/gen/temporal/api/history/v1/message_pb.rb +489 -0
- data/lib/gen/temporal/api/namespace/v1/message_pb.rb +63 -0
- data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +125 -0
- data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +20 -0
- data/lib/gen/temporal/api/query/v1/message_pb.rb +38 -0
- data/lib/gen/temporal/api/replication/v1/message_pb.rb +37 -0
- data/lib/gen/temporal/api/schedule/v1/message_pb.rb +128 -0
- data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +73 -0
- data/lib/gen/temporal/api/update/v1/message_pb.rb +26 -0
- data/lib/gen/temporal/api/version/v1/message_pb.rb +41 -0
- data/lib/gen/temporal/api/workflow/v1/message_pb.rb +110 -0
- data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +771 -0
- data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +20 -0
- data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +58 -0
- data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +57 -0
- data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +222 -0
- data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +57 -0
- data/lib/gen/temporal/sdk/core/common/common_pb.rb +22 -0
- data/lib/gen/temporal/sdk/core/core_interface_pb.rb +34 -0
- data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +27 -0
- data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +164 -0
- data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +192 -0
- data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +34 -0
- data/lib/temporal/bridge.rb +14 -0
- data/lib/temporal/client/implementation.rb +339 -0
- data/lib/temporal/client/workflow_handle.rb +243 -0
- data/lib/temporal/client.rb +144 -0
- data/lib/temporal/connection.rb +736 -0
- data/lib/temporal/data_converter.rb +150 -0
- data/lib/temporal/error/failure.rb +194 -0
- data/lib/temporal/error/workflow_failure.rb +17 -0
- data/lib/temporal/errors.rb +22 -0
- data/lib/temporal/failure_converter/base.rb +26 -0
- data/lib/temporal/failure_converter/basic.rb +313 -0
- data/lib/temporal/failure_converter.rb +8 -0
- data/lib/temporal/interceptor/chain.rb +27 -0
- data/lib/temporal/interceptor/client.rb +102 -0
- data/lib/temporal/payload_codec/base.rb +32 -0
- data/lib/temporal/payload_converter/base.rb +24 -0
- data/lib/temporal/payload_converter/bytes.rb +26 -0
- data/lib/temporal/payload_converter/composite.rb +47 -0
- data/lib/temporal/payload_converter/encoding_base.rb +35 -0
- data/lib/temporal/payload_converter/json.rb +25 -0
- data/lib/temporal/payload_converter/nil.rb +25 -0
- data/lib/temporal/payload_converter.rb +14 -0
- data/lib/temporal/retry_policy.rb +82 -0
- data/lib/temporal/retry_state.rb +35 -0
- data/lib/temporal/runtime.rb +22 -0
- data/lib/temporal/timeout_type.rb +29 -0
- data/lib/temporal/version.rb +1 -1
- data/lib/temporal/workflow/execution_info.rb +54 -0
- data/lib/temporal/workflow/execution_status.rb +36 -0
- data/lib/temporal/workflow/id_reuse_policy.rb +36 -0
- data/lib/temporal/workflow/query_reject_condition.rb +33 -0
- data/lib/temporal.rb +4 -0
- data/lib/temporalio.rb +3 -1
- data/lib/thermite_patch.rb +23 -0
- data/temporalio.gemspec +41 -0
- metadata +543 -9
- data/temporal.gemspec +0 -20
@@ -0,0 +1,11 @@
|
|
1
|
+
//! Very much subject to change. Defines traits for converting inputs/outputs to/from payloads
|
2
|
+
|
3
|
+
use serde::{Deserialize, Serialize};
|
4
|
+
|
5
|
+
/// Something that can be deserialized from a payload. Currently just a pass-through to
|
6
|
+
/// [Deserialize] which may actually be the best long-run choice.
|
7
|
+
pub trait FromPayload<'de>: Deserialize<'de> {}
|
8
|
+
|
9
|
+
/// Something that can be serialized into a payload. Currently just a pass-through to
|
10
|
+
/// [Serialize] which may actually be the best long-run choice.
|
11
|
+
pub trait IntoPayload: Serialize {}
|
@@ -0,0 +1,295 @@
|
|
1
|
+
use std::{collections::HashMap, time::Duration};
|
2
|
+
|
3
|
+
use temporal_client::WorkflowOptions;
|
4
|
+
use temporal_sdk_core_protos::{
|
5
|
+
coresdk::{
|
6
|
+
child_workflow::ChildWorkflowCancellationType,
|
7
|
+
workflow_commands::{
|
8
|
+
ActivityCancellationType, ScheduleActivity, ScheduleLocalActivity,
|
9
|
+
StartChildWorkflowExecution,
|
10
|
+
},
|
11
|
+
},
|
12
|
+
temporal::api::common::v1::{Payload, RetryPolicy},
|
13
|
+
};
|
14
|
+
|
15
|
+
// TODO: Before release, probably best to avoid using proto types entirely here. They're awkward.
|
16
|
+
|
17
|
+
pub trait IntoWorkflowCommand {
|
18
|
+
type WFCommandType;
|
19
|
+
|
20
|
+
/// Produces a workflow command from some options
|
21
|
+
fn into_command(self, seq: u32) -> Self::WFCommandType;
|
22
|
+
}
|
23
|
+
|
24
|
+
/// Options for scheduling an activity
|
25
|
+
#[derive(Default, Debug)]
|
26
|
+
pub struct ActivityOptions {
|
27
|
+
/// Identifier to use for tracking the activity in Workflow history.
|
28
|
+
/// The `activityId` can be accessed by the activity function.
|
29
|
+
/// Does not need to be unique.
|
30
|
+
///
|
31
|
+
/// If `None` use the context's sequence number
|
32
|
+
pub activity_id: Option<String>,
|
33
|
+
/// Type of activity to schedule
|
34
|
+
pub activity_type: String,
|
35
|
+
/// Input to the activity
|
36
|
+
pub input: Payload,
|
37
|
+
/// Task queue to schedule the activity in
|
38
|
+
pub task_queue: String,
|
39
|
+
/// Time that the Activity Task can stay in the Task Queue before it is picked up by a Worker.
|
40
|
+
/// Do not specify this timeout unless using host specific Task Queues for Activity Tasks are
|
41
|
+
/// being used for routing.
|
42
|
+
/// `schedule_to_start_timeout` is always non-retryable.
|
43
|
+
/// Retrying after this timeout doesn't make sense as it would just put the Activity Task back
|
44
|
+
/// into the same Task Queue.
|
45
|
+
pub schedule_to_start_timeout: Option<Duration>,
|
46
|
+
/// Maximum time of a single Activity execution attempt.
|
47
|
+
/// Note that the Temporal Server doesn't detect Worker process failures directly.
|
48
|
+
/// It relies on this timeout to detect that an Activity that didn't complete on time.
|
49
|
+
/// So this timeout should be as short as the longest possible execution of the Activity body.
|
50
|
+
/// Potentially long running Activities must specify `heartbeat_timeout` and heartbeat from the
|
51
|
+
/// activity periodically for timely failure detection.
|
52
|
+
/// Either this option or `schedule_to_close_timeout` is required.
|
53
|
+
pub start_to_close_timeout: Option<Duration>,
|
54
|
+
/// Total time that a workflow is willing to wait for Activity to complete.
|
55
|
+
/// `schedule_to_close_timeout` limits the total time of an Activity's execution including
|
56
|
+
/// retries (use `start_to_close_timeout` to limit the time of a single attempt).
|
57
|
+
/// Either this option or `start_to_close_timeout` is required.
|
58
|
+
pub schedule_to_close_timeout: Option<Duration>,
|
59
|
+
/// Heartbeat interval. Activity must heartbeat before this interval passes after a last
|
60
|
+
/// heartbeat or activity start.
|
61
|
+
pub heartbeat_timeout: Option<Duration>,
|
62
|
+
/// Determines what the SDK does when the Activity is cancelled.
|
63
|
+
pub cancellation_type: ActivityCancellationType,
|
64
|
+
/// Activity retry policy
|
65
|
+
pub retry_policy: Option<RetryPolicy>,
|
66
|
+
}
|
67
|
+
|
68
|
+
impl IntoWorkflowCommand for ActivityOptions {
|
69
|
+
type WFCommandType = ScheduleActivity;
|
70
|
+
fn into_command(self, seq: u32) -> ScheduleActivity {
|
71
|
+
ScheduleActivity {
|
72
|
+
seq,
|
73
|
+
activity_id: match self.activity_id {
|
74
|
+
None => seq.to_string(),
|
75
|
+
Some(aid) => aid,
|
76
|
+
},
|
77
|
+
activity_type: self.activity_type,
|
78
|
+
task_queue: self.task_queue,
|
79
|
+
schedule_to_close_timeout: self
|
80
|
+
.schedule_to_close_timeout
|
81
|
+
.and_then(|d| d.try_into().ok()),
|
82
|
+
schedule_to_start_timeout: self
|
83
|
+
.schedule_to_start_timeout
|
84
|
+
.and_then(|d| d.try_into().ok()),
|
85
|
+
start_to_close_timeout: self.start_to_close_timeout.and_then(|d| d.try_into().ok()),
|
86
|
+
heartbeat_timeout: self.heartbeat_timeout.and_then(|d| d.try_into().ok()),
|
87
|
+
cancellation_type: self.cancellation_type as i32,
|
88
|
+
arguments: vec![self.input],
|
89
|
+
retry_policy: self.retry_policy,
|
90
|
+
..Default::default()
|
91
|
+
}
|
92
|
+
}
|
93
|
+
}
|
94
|
+
|
95
|
+
/// Options for scheduling a local activity
|
96
|
+
#[derive(Default, Debug, Clone)]
|
97
|
+
pub struct LocalActivityOptions {
|
98
|
+
/// Identifier to use for tracking the activity in Workflow history.
|
99
|
+
/// The `activityId` can be accessed by the activity function.
|
100
|
+
/// Does not need to be unique.
|
101
|
+
///
|
102
|
+
/// If `None` use the context's sequence number
|
103
|
+
pub activity_id: Option<String>,
|
104
|
+
/// Type of activity to schedule
|
105
|
+
pub activity_type: String,
|
106
|
+
/// Input to the activity
|
107
|
+
pub input: Payload,
|
108
|
+
/// Retry policy
|
109
|
+
pub retry_policy: RetryPolicy,
|
110
|
+
/// Override attempt number rather than using 1.
|
111
|
+
/// Ideally we would not expose this in a released Rust SDK, but it's needed for test.
|
112
|
+
pub attempt: Option<u32>,
|
113
|
+
/// Override schedule time when doing timer backoff.
|
114
|
+
/// Ideally we would not expose this in a released Rust SDK, but it's needed for test.
|
115
|
+
pub original_schedule_time: Option<prost_types::Timestamp>,
|
116
|
+
/// Retry backoffs over this amount will use a timer rather than a local retry
|
117
|
+
pub timer_backoff_threshold: Option<Duration>,
|
118
|
+
/// How the activity will cancel
|
119
|
+
pub cancel_type: ActivityCancellationType,
|
120
|
+
/// Indicates how long the caller is willing to wait for local activity completion. Limits how
|
121
|
+
/// long retries will be attempted. When not specified defaults to the workflow execution
|
122
|
+
/// timeout (which may be unset).
|
123
|
+
pub schedule_to_close_timeout: Option<Duration>,
|
124
|
+
/// Limits time the local activity can idle internally before being executed. That can happen if
|
125
|
+
/// the worker is currently at max concurrent local activity executions. This timeout is always
|
126
|
+
/// non retryable as all a retry would achieve is to put it back into the same queue. Defaults
|
127
|
+
/// to `schedule_to_close_timeout` if not specified and that is set. Must be <=
|
128
|
+
/// `schedule_to_close_timeout` when set, if not, it will be clamped down.
|
129
|
+
pub schedule_to_start_timeout: Option<Duration>,
|
130
|
+
/// Maximum time the local activity is allowed to execute after the task is dispatched. This
|
131
|
+
/// timeout is always retryable. Either or both of `schedule_to_close_timeout` and this must be
|
132
|
+
/// specified. If set, this must be <= `schedule_to_close_timeout`, if not, it will be clamped
|
133
|
+
/// down.
|
134
|
+
pub start_to_close_timeout: Option<Duration>,
|
135
|
+
}
|
136
|
+
|
137
|
+
impl IntoWorkflowCommand for LocalActivityOptions {
|
138
|
+
type WFCommandType = ScheduleLocalActivity;
|
139
|
+
fn into_command(mut self, seq: u32) -> ScheduleLocalActivity {
|
140
|
+
// Allow tests to avoid extra verbosity when they don't care about timeouts
|
141
|
+
// TODO: Builderize LA options
|
142
|
+
self.schedule_to_close_timeout
|
143
|
+
.get_or_insert(Duration::from_secs(100));
|
144
|
+
|
145
|
+
ScheduleLocalActivity {
|
146
|
+
seq,
|
147
|
+
attempt: self.attempt.unwrap_or(1),
|
148
|
+
original_schedule_time: self.original_schedule_time,
|
149
|
+
activity_id: match self.activity_id {
|
150
|
+
None => seq.to_string(),
|
151
|
+
Some(aid) => aid,
|
152
|
+
},
|
153
|
+
activity_type: self.activity_type,
|
154
|
+
arguments: vec![self.input],
|
155
|
+
retry_policy: Some(self.retry_policy),
|
156
|
+
local_retry_threshold: self.timer_backoff_threshold.and_then(|d| d.try_into().ok()),
|
157
|
+
cancellation_type: self.cancel_type.into(),
|
158
|
+
schedule_to_close_timeout: self
|
159
|
+
.schedule_to_close_timeout
|
160
|
+
.and_then(|d| d.try_into().ok()),
|
161
|
+
schedule_to_start_timeout: self
|
162
|
+
.schedule_to_start_timeout
|
163
|
+
.and_then(|d| d.try_into().ok()),
|
164
|
+
start_to_close_timeout: self.start_to_close_timeout.and_then(|d| d.try_into().ok()),
|
165
|
+
..Default::default()
|
166
|
+
}
|
167
|
+
}
|
168
|
+
}
|
169
|
+
|
170
|
+
/// Options for scheduling a child workflow
|
171
|
+
#[derive(Default, Debug, Clone)]
|
172
|
+
pub struct ChildWorkflowOptions {
|
173
|
+
/// Workflow ID
|
174
|
+
pub workflow_id: String,
|
175
|
+
/// Type of workflow to schedule
|
176
|
+
pub workflow_type: String,
|
177
|
+
/// Input to send the child Workflow
|
178
|
+
pub input: Vec<Payload>,
|
179
|
+
/// Cancellation strategy for the child workflow
|
180
|
+
pub cancel_type: ChildWorkflowCancellationType,
|
181
|
+
/// Common options
|
182
|
+
pub options: WorkflowOptions,
|
183
|
+
}
|
184
|
+
|
185
|
+
impl IntoWorkflowCommand for ChildWorkflowOptions {
|
186
|
+
type WFCommandType = StartChildWorkflowExecution;
|
187
|
+
fn into_command(self, seq: u32) -> StartChildWorkflowExecution {
|
188
|
+
StartChildWorkflowExecution {
|
189
|
+
seq,
|
190
|
+
workflow_id: self.workflow_id,
|
191
|
+
workflow_type: self.workflow_type,
|
192
|
+
input: self.input,
|
193
|
+
cancellation_type: self.cancel_type as i32,
|
194
|
+
workflow_id_reuse_policy: self.options.id_reuse_policy as i32,
|
195
|
+
workflow_execution_timeout: self
|
196
|
+
.options
|
197
|
+
.execution_timeout
|
198
|
+
.and_then(|d| d.try_into().ok()),
|
199
|
+
workflow_run_timeout: self
|
200
|
+
.options
|
201
|
+
.execution_timeout
|
202
|
+
.and_then(|d| d.try_into().ok()),
|
203
|
+
workflow_task_timeout: self.options.task_timeout.and_then(|d| d.try_into().ok()),
|
204
|
+
search_attributes: self.options.search_attributes.unwrap_or_default(),
|
205
|
+
cron_schedule: self.options.cron_schedule.unwrap_or_default(),
|
206
|
+
..Default::default()
|
207
|
+
}
|
208
|
+
}
|
209
|
+
}
|
210
|
+
|
211
|
+
/// Options for sending a signal to an external workflow
|
212
|
+
pub struct SignalWorkflowOptions {
|
213
|
+
/// The workflow's id
|
214
|
+
pub workflow_id: String,
|
215
|
+
/// The particular run to target, or latest if `None`
|
216
|
+
pub run_id: Option<String>,
|
217
|
+
/// The details of the signal to send
|
218
|
+
pub signal: Signal,
|
219
|
+
}
|
220
|
+
|
221
|
+
impl SignalWorkflowOptions {
|
222
|
+
/// Create options for sending a signal to another workflow
|
223
|
+
pub fn new(
|
224
|
+
workflow_id: impl Into<String>,
|
225
|
+
run_id: impl Into<String>,
|
226
|
+
name: impl Into<String>,
|
227
|
+
input: impl IntoIterator<Item = impl Into<Payload>>,
|
228
|
+
) -> Self {
|
229
|
+
Self {
|
230
|
+
workflow_id: workflow_id.into(),
|
231
|
+
run_id: Some(run_id.into()),
|
232
|
+
signal: Signal::new(name, input),
|
233
|
+
}
|
234
|
+
}
|
235
|
+
|
236
|
+
/// Set a header k/v pair attached to the signal
|
237
|
+
pub fn with_header(
|
238
|
+
&mut self,
|
239
|
+
key: impl Into<String>,
|
240
|
+
payload: impl Into<Payload>,
|
241
|
+
) -> &mut Self {
|
242
|
+
self.signal.data.with_header(key.into(), payload.into());
|
243
|
+
self
|
244
|
+
}
|
245
|
+
}
|
246
|
+
|
247
|
+
/// Information needed to send a specific signal
|
248
|
+
pub struct Signal {
|
249
|
+
/// The signal name
|
250
|
+
pub signal_name: String,
|
251
|
+
/// The data the signal carries
|
252
|
+
pub data: SignalData,
|
253
|
+
}
|
254
|
+
|
255
|
+
impl Signal {
|
256
|
+
/// Create a new signal
|
257
|
+
pub fn new(
|
258
|
+
name: impl Into<String>,
|
259
|
+
input: impl IntoIterator<Item = impl Into<Payload>>,
|
260
|
+
) -> Self {
|
261
|
+
Self {
|
262
|
+
signal_name: name.into(),
|
263
|
+
data: SignalData::new(input),
|
264
|
+
}
|
265
|
+
}
|
266
|
+
}
|
267
|
+
|
268
|
+
/// Data contained within a signal
|
269
|
+
#[derive(Default)]
|
270
|
+
pub struct SignalData {
|
271
|
+
/// The arguments the signal will receive
|
272
|
+
pub input: Vec<Payload>,
|
273
|
+
/// Metadata attached to the signal
|
274
|
+
pub headers: HashMap<String, Payload>,
|
275
|
+
}
|
276
|
+
|
277
|
+
impl SignalData {
|
278
|
+
/// Create data for a signal
|
279
|
+
pub fn new(input: impl IntoIterator<Item = impl Into<Payload>>) -> Self {
|
280
|
+
Self {
|
281
|
+
input: input.into_iter().map(Into::into).collect(),
|
282
|
+
headers: HashMap::new(),
|
283
|
+
}
|
284
|
+
}
|
285
|
+
|
286
|
+
/// Set a header k/v pair attached to the signal
|
287
|
+
pub fn with_header(
|
288
|
+
&mut self,
|
289
|
+
key: impl Into<String>,
|
290
|
+
payload: impl Into<Payload>,
|
291
|
+
) -> &mut Self {
|
292
|
+
self.headers.insert(key.into(), payload.into());
|
293
|
+
self
|
294
|
+
}
|
295
|
+
}
|