temporalio 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (310) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +180 -7
  3. data/bridge/Cargo.lock +208 -76
  4. data/bridge/Cargo.toml +5 -2
  5. data/bridge/sdk-core/Cargo.toml +1 -1
  6. data/bridge/sdk-core/README.md +20 -10
  7. data/bridge/sdk-core/client/Cargo.toml +1 -1
  8. data/bridge/sdk-core/client/src/lib.rs +227 -59
  9. data/bridge/sdk-core/client/src/metrics.rs +17 -8
  10. data/bridge/sdk-core/client/src/raw.rs +13 -12
  11. data/bridge/sdk-core/client/src/retry.rs +132 -43
  12. data/bridge/sdk-core/core/Cargo.toml +28 -15
  13. data/bridge/sdk-core/core/benches/workflow_replay.rs +13 -10
  14. data/bridge/sdk-core/core/src/abstractions.rs +225 -36
  15. data/bridge/sdk-core/core/src/core_tests/activity_tasks.rs +217 -79
  16. data/bridge/sdk-core/core/src/core_tests/determinism.rs +165 -2
  17. data/bridge/sdk-core/core/src/core_tests/local_activities.rs +565 -34
  18. data/bridge/sdk-core/core/src/core_tests/queries.rs +247 -90
  19. data/bridge/sdk-core/core/src/core_tests/workers.rs +3 -5
  20. data/bridge/sdk-core/core/src/core_tests/workflow_cancels.rs +1 -1
  21. data/bridge/sdk-core/core/src/core_tests/workflow_tasks.rs +430 -67
  22. data/bridge/sdk-core/core/src/ephemeral_server/mod.rs +106 -12
  23. data/bridge/sdk-core/core/src/internal_flags.rs +136 -0
  24. data/bridge/sdk-core/core/src/lib.rs +148 -34
  25. data/bridge/sdk-core/core/src/protosext/mod.rs +1 -1
  26. data/bridge/sdk-core/core/src/replay/mod.rs +185 -41
  27. data/bridge/sdk-core/core/src/telemetry/log_export.rs +190 -0
  28. data/bridge/sdk-core/core/src/telemetry/metrics.rs +219 -140
  29. data/bridge/sdk-core/core/src/telemetry/mod.rs +326 -315
  30. data/bridge/sdk-core/core/src/telemetry/prometheus_server.rs +20 -14
  31. data/bridge/sdk-core/core/src/test_help/mod.rs +85 -21
  32. data/bridge/sdk-core/core/src/worker/activities/activity_heartbeat_manager.rs +112 -156
  33. data/bridge/sdk-core/core/src/worker/activities/activity_task_poller_stream.rs +89 -0
  34. data/bridge/sdk-core/core/src/worker/activities/local_activities.rs +364 -128
  35. data/bridge/sdk-core/core/src/worker/activities.rs +263 -170
  36. data/bridge/sdk-core/core/src/worker/client/mocks.rs +23 -3
  37. data/bridge/sdk-core/core/src/worker/client.rs +48 -6
  38. data/bridge/sdk-core/core/src/worker/mod.rs +186 -75
  39. data/bridge/sdk-core/core/src/worker/workflow/bridge.rs +1 -3
  40. data/bridge/sdk-core/core/src/worker/workflow/driven_workflow.rs +13 -24
  41. data/bridge/sdk-core/core/src/worker/workflow/history_update.rs +879 -226
  42. data/bridge/sdk-core/core/src/worker/workflow/machines/activity_state_machine.rs +101 -48
  43. data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_external_state_machine.rs +8 -12
  44. data/bridge/sdk-core/core/src/worker/workflow/machines/cancel_workflow_state_machine.rs +6 -9
  45. data/bridge/sdk-core/core/src/worker/workflow/machines/child_workflow_state_machine.rs +90 -32
  46. data/bridge/sdk-core/core/src/worker/workflow/machines/complete_workflow_state_machine.rs +6 -9
  47. data/bridge/sdk-core/core/src/worker/workflow/machines/continue_as_new_workflow_state_machine.rs +7 -10
  48. data/bridge/sdk-core/core/src/worker/workflow/machines/fail_workflow_state_machine.rs +6 -9
  49. data/bridge/sdk-core/core/src/worker/workflow/machines/local_activity_state_machine.rs +160 -83
  50. data/bridge/sdk-core/core/src/worker/workflow/machines/mod.rs +36 -54
  51. data/bridge/sdk-core/core/src/worker/workflow/machines/modify_workflow_properties_state_machine.rs +179 -0
  52. data/bridge/sdk-core/core/src/worker/workflow/machines/patch_state_machine.rs +104 -157
  53. data/bridge/sdk-core/core/src/worker/workflow/machines/signal_external_state_machine.rs +8 -12
  54. data/bridge/sdk-core/core/src/worker/workflow/machines/timer_state_machine.rs +9 -13
  55. data/bridge/sdk-core/core/src/worker/workflow/machines/transition_coverage.rs +10 -4
  56. data/bridge/sdk-core/core/src/worker/workflow/machines/upsert_search_attributes_state_machine.rs +14 -11
  57. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines/local_acts.rs +6 -17
  58. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_machines.rs +395 -299
  59. data/bridge/sdk-core/core/src/worker/workflow/machines/workflow_task_state_machine.rs +12 -20
  60. data/bridge/sdk-core/core/src/worker/workflow/managed_run/managed_wf_test.rs +33 -18
  61. data/bridge/sdk-core/core/src/worker/workflow/managed_run.rs +1032 -374
  62. data/bridge/sdk-core/core/src/worker/workflow/mod.rs +525 -392
  63. data/bridge/sdk-core/core/src/worker/workflow/run_cache.rs +40 -57
  64. data/bridge/sdk-core/core/src/worker/workflow/wft_extraction.rs +125 -0
  65. data/bridge/sdk-core/core/src/worker/workflow/wft_poller.rs +3 -6
  66. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/saved_wf_inputs.rs +117 -0
  67. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream/tonic_status_serde.rs +24 -0
  68. data/bridge/sdk-core/core/src/worker/workflow/workflow_stream.rs +456 -681
  69. data/bridge/sdk-core/core-api/Cargo.toml +6 -4
  70. data/bridge/sdk-core/core-api/src/errors.rs +1 -34
  71. data/bridge/sdk-core/core-api/src/lib.rs +7 -45
  72. data/bridge/sdk-core/core-api/src/telemetry.rs +141 -0
  73. data/bridge/sdk-core/core-api/src/worker.rs +27 -1
  74. data/bridge/sdk-core/etc/deps.svg +115 -140
  75. data/bridge/sdk-core/etc/regen-depgraph.sh +5 -0
  76. data/bridge/sdk-core/fsm/rustfsm_procmacro/src/lib.rs +18 -15
  77. data/bridge/sdk-core/fsm/rustfsm_procmacro/tests/trybuild/no_handle_conversions_require_into_fail.stderr +1 -1
  78. data/bridge/sdk-core/fsm/rustfsm_trait/src/lib.rs +8 -3
  79. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-16_history.bin +0 -0
  80. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-23_history.bin +0 -0
  81. data/bridge/sdk-core/histories/evict_while_la_running_no_interference-85_history.bin +0 -0
  82. data/bridge/sdk-core/protos/api_upstream/buf.yaml +0 -3
  83. data/bridge/sdk-core/protos/api_upstream/build/go.mod +7 -0
  84. data/bridge/sdk-core/protos/api_upstream/build/go.sum +5 -0
  85. data/bridge/sdk-core/protos/api_upstream/{temporal/api/enums/v1/cluster.proto → build/tools.go} +7 -18
  86. data/bridge/sdk-core/protos/api_upstream/go.mod +6 -0
  87. data/bridge/sdk-core/protos/api_upstream/temporal/api/batch/v1/message.proto +12 -9
  88. data/bridge/sdk-core/protos/api_upstream/temporal/api/command/v1/message.proto +15 -26
  89. data/bridge/sdk-core/protos/api_upstream/temporal/api/common/v1/message.proto +13 -2
  90. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/batch_operation.proto +3 -2
  91. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/command_type.proto +4 -9
  92. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/common.proto +3 -2
  93. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/event_type.proto +10 -8
  94. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/failed_cause.proto +28 -2
  95. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/namespace.proto +2 -2
  96. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/query.proto +2 -2
  97. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/reset.proto +2 -2
  98. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/schedule.proto +2 -2
  99. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/task_queue.proto +2 -2
  100. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/update.proto +24 -19
  101. data/bridge/sdk-core/protos/api_upstream/temporal/api/enums/v1/workflow.proto +2 -2
  102. data/bridge/sdk-core/protos/api_upstream/temporal/api/errordetails/v1/message.proto +2 -2
  103. data/bridge/sdk-core/protos/api_upstream/temporal/api/failure/v1/message.proto +2 -2
  104. data/bridge/sdk-core/protos/api_upstream/temporal/api/filter/v1/message.proto +2 -2
  105. data/bridge/sdk-core/protos/api_upstream/temporal/api/history/v1/message.proto +62 -26
  106. data/bridge/sdk-core/protos/api_upstream/temporal/api/namespace/v1/message.proto +4 -2
  107. data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/request_response.proto +24 -61
  108. data/bridge/sdk-core/protos/api_upstream/temporal/api/operatorservice/v1/service.proto +2 -21
  109. data/bridge/sdk-core/protos/api_upstream/temporal/api/protocol/v1/message.proto +57 -0
  110. data/bridge/sdk-core/protos/api_upstream/temporal/api/query/v1/message.proto +2 -2
  111. data/bridge/sdk-core/protos/api_upstream/temporal/api/replication/v1/message.proto +2 -2
  112. data/bridge/sdk-core/protos/api_upstream/temporal/api/schedule/v1/message.proto +110 -31
  113. data/bridge/sdk-core/protos/api_upstream/temporal/api/sdk/v1/task_complete_metadata.proto +63 -0
  114. data/bridge/sdk-core/protos/api_upstream/temporal/api/taskqueue/v1/message.proto +4 -4
  115. data/bridge/sdk-core/protos/api_upstream/temporal/api/update/v1/message.proto +71 -6
  116. data/bridge/sdk-core/protos/api_upstream/temporal/api/version/v1/message.proto +2 -2
  117. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflow/v1/message.proto +3 -2
  118. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/request_response.proto +111 -36
  119. data/bridge/sdk-core/protos/api_upstream/temporal/api/workflowservice/v1/service.proto +19 -5
  120. data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_result/activity_result.proto +1 -0
  121. data/bridge/sdk-core/protos/local/temporal/sdk/core/activity_task/activity_task.proto +1 -0
  122. data/bridge/sdk-core/protos/local/temporal/sdk/core/child_workflow/child_workflow.proto +1 -0
  123. data/bridge/sdk-core/protos/local/temporal/sdk/core/common/common.proto +1 -0
  124. data/bridge/sdk-core/protos/local/temporal/sdk/core/core_interface.proto +1 -0
  125. data/bridge/sdk-core/protos/local/temporal/sdk/core/external_data/external_data.proto +1 -0
  126. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_activation/workflow_activation.proto +9 -0
  127. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_commands/workflow_commands.proto +9 -1
  128. data/bridge/sdk-core/protos/local/temporal/sdk/core/workflow_completion/workflow_completion.proto +6 -0
  129. data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/request_response.proto +2 -2
  130. data/bridge/sdk-core/protos/testsrv_upstream/temporal/api/testservice/v1/service.proto +2 -2
  131. data/bridge/sdk-core/sdk/Cargo.toml +4 -3
  132. data/bridge/sdk-core/sdk/src/interceptors.rs +36 -3
  133. data/bridge/sdk-core/sdk/src/lib.rs +94 -25
  134. data/bridge/sdk-core/sdk/src/workflow_context.rs +13 -2
  135. data/bridge/sdk-core/sdk/src/workflow_future.rs +10 -13
  136. data/bridge/sdk-core/sdk-core-protos/Cargo.toml +5 -2
  137. data/bridge/sdk-core/sdk-core-protos/build.rs +36 -2
  138. data/bridge/sdk-core/sdk-core-protos/src/history_builder.rs +164 -104
  139. data/bridge/sdk-core/sdk-core-protos/src/history_info.rs +27 -23
  140. data/bridge/sdk-core/sdk-core-protos/src/lib.rs +252 -74
  141. data/bridge/sdk-core/sdk-core-protos/src/task_token.rs +12 -2
  142. data/bridge/sdk-core/test-utils/Cargo.toml +4 -1
  143. data/bridge/sdk-core/test-utils/src/canned_histories.rs +106 -296
  144. data/bridge/sdk-core/test-utils/src/histfetch.rs +1 -1
  145. data/bridge/sdk-core/test-utils/src/lib.rs +161 -50
  146. data/bridge/sdk-core/test-utils/src/wf_input_saver.rs +50 -0
  147. data/bridge/sdk-core/test-utils/src/workflows.rs +29 -0
  148. data/bridge/sdk-core/tests/fuzzy_workflow.rs +130 -0
  149. data/bridge/sdk-core/tests/{load_tests.rs → heavy_tests.rs} +125 -51
  150. data/bridge/sdk-core/tests/integ_tests/ephemeral_server_tests.rs +25 -3
  151. data/bridge/sdk-core/tests/integ_tests/heartbeat_tests.rs +10 -5
  152. data/bridge/sdk-core/tests/integ_tests/metrics_tests.rs +239 -0
  153. data/bridge/sdk-core/tests/integ_tests/polling_tests.rs +4 -60
  154. data/bridge/sdk-core/tests/integ_tests/queries_tests.rs +5 -128
  155. data/bridge/sdk-core/tests/integ_tests/visibility_tests.rs +83 -25
  156. data/bridge/sdk-core/tests/integ_tests/workflow_tests/activities.rs +93 -69
  157. data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_external.rs +1 -0
  158. data/bridge/sdk-core/tests/integ_tests/workflow_tests/cancel_wf.rs +6 -13
  159. data/bridge/sdk-core/tests/integ_tests/workflow_tests/child_workflows.rs +1 -0
  160. data/bridge/sdk-core/tests/integ_tests/workflow_tests/continue_as_new.rs +6 -2
  161. data/bridge/sdk-core/tests/integ_tests/workflow_tests/determinism.rs +3 -10
  162. data/bridge/sdk-core/tests/integ_tests/workflow_tests/local_activities.rs +151 -116
  163. data/bridge/sdk-core/tests/integ_tests/workflow_tests/modify_wf_properties.rs +54 -0
  164. data/bridge/sdk-core/tests/integ_tests/workflow_tests/patches.rs +7 -28
  165. data/bridge/sdk-core/tests/integ_tests/workflow_tests/replay.rs +115 -24
  166. data/bridge/sdk-core/tests/integ_tests/workflow_tests/resets.rs +1 -0
  167. data/bridge/sdk-core/tests/integ_tests/workflow_tests/signals.rs +18 -14
  168. data/bridge/sdk-core/tests/integ_tests/workflow_tests/stickyness.rs +6 -20
  169. data/bridge/sdk-core/tests/integ_tests/workflow_tests/timers.rs +10 -21
  170. data/bridge/sdk-core/tests/integ_tests/workflow_tests/upsert_search_attrs.rs +6 -4
  171. data/bridge/sdk-core/tests/integ_tests/workflow_tests.rs +27 -18
  172. data/bridge/sdk-core/tests/main.rs +8 -16
  173. data/bridge/sdk-core/tests/runner.rs +75 -36
  174. data/bridge/sdk-core/tests/wf_input_replay.rs +32 -0
  175. data/bridge/src/connection.rs +117 -82
  176. data/bridge/src/lib.rs +356 -42
  177. data/bridge/src/runtime.rs +10 -3
  178. data/bridge/src/test_server.rs +153 -0
  179. data/bridge/src/worker.rs +133 -9
  180. data/lib/gen/temporal/api/batch/v1/message_pb.rb +8 -6
  181. data/lib/gen/temporal/api/command/v1/message_pb.rb +10 -16
  182. data/lib/gen/temporal/api/common/v1/message_pb.rb +5 -1
  183. data/lib/gen/temporal/api/enums/v1/batch_operation_pb.rb +2 -1
  184. data/lib/gen/temporal/api/enums/v1/command_type_pb.rb +3 -3
  185. data/lib/gen/temporal/api/enums/v1/common_pb.rb +2 -1
  186. data/lib/gen/temporal/api/enums/v1/event_type_pb.rb +5 -4
  187. data/lib/gen/temporal/api/enums/v1/failed_cause_pb.rb +9 -1
  188. data/lib/gen/temporal/api/enums/v1/namespace_pb.rb +1 -1
  189. data/lib/gen/temporal/api/enums/v1/query_pb.rb +1 -1
  190. data/lib/gen/temporal/api/enums/v1/reset_pb.rb +1 -1
  191. data/lib/gen/temporal/api/enums/v1/schedule_pb.rb +1 -1
  192. data/lib/gen/temporal/api/enums/v1/task_queue_pb.rb +1 -1
  193. data/lib/gen/temporal/api/enums/v1/update_pb.rb +7 -10
  194. data/lib/gen/temporal/api/enums/v1/workflow_pb.rb +1 -1
  195. data/lib/gen/temporal/api/errordetails/v1/message_pb.rb +1 -1
  196. data/lib/gen/temporal/api/failure/v1/message_pb.rb +1 -1
  197. data/lib/gen/temporal/api/filter/v1/message_pb.rb +1 -1
  198. data/lib/gen/temporal/api/history/v1/message_pb.rb +34 -25
  199. data/lib/gen/temporal/api/namespace/v1/message_pb.rb +2 -1
  200. data/lib/gen/temporal/api/operatorservice/v1/request_response_pb.rb +14 -51
  201. data/lib/gen/temporal/api/operatorservice/v1/service_pb.rb +1 -1
  202. data/lib/gen/temporal/api/protocol/v1/message_pb.rb +30 -0
  203. data/lib/gen/temporal/api/query/v1/message_pb.rb +1 -1
  204. data/lib/gen/temporal/api/replication/v1/message_pb.rb +1 -1
  205. data/lib/gen/temporal/api/schedule/v1/message_pb.rb +22 -1
  206. data/lib/gen/temporal/api/sdk/v1/task_complete_metadata_pb.rb +23 -0
  207. data/lib/gen/temporal/api/taskqueue/v1/message_pb.rb +2 -2
  208. data/lib/gen/temporal/api/testservice/v1/request_response_pb.rb +49 -0
  209. data/lib/gen/temporal/api/testservice/v1/service_pb.rb +21 -0
  210. data/lib/gen/temporal/api/update/v1/message_pb.rb +49 -3
  211. data/lib/gen/temporal/api/version/v1/message_pb.rb +1 -1
  212. data/lib/gen/temporal/api/workflow/v1/message_pb.rb +2 -1
  213. data/lib/gen/temporal/api/workflowservice/v1/request_response_pb.rb +47 -20
  214. data/lib/gen/temporal/api/workflowservice/v1/service_pb.rb +1 -1
  215. data/lib/gen/temporal/sdk/core/activity_result/activity_result_pb.rb +13 -9
  216. data/lib/gen/temporal/sdk/core/activity_task/activity_task_pb.rb +10 -6
  217. data/lib/gen/temporal/sdk/core/child_workflow/child_workflow_pb.rb +13 -9
  218. data/lib/gen/temporal/sdk/core/common/common_pb.rb +7 -3
  219. data/lib/gen/temporal/sdk/core/core_interface_pb.rb +9 -3
  220. data/lib/gen/temporal/sdk/core/external_data/external_data_pb.rb +7 -3
  221. data/lib/gen/temporal/sdk/core/workflow_activation/workflow_activation_pb.rb +28 -21
  222. data/lib/gen/temporal/sdk/core/workflow_commands/workflow_commands_pb.rb +32 -24
  223. data/lib/gen/temporal/sdk/core/workflow_completion/workflow_completion_pb.rb +12 -5
  224. data/lib/temporalio/activity/context.rb +102 -0
  225. data/lib/temporalio/activity/info.rb +67 -0
  226. data/lib/temporalio/activity.rb +85 -0
  227. data/lib/temporalio/bridge/connect_options.rb +15 -0
  228. data/lib/temporalio/bridge/error.rb +8 -0
  229. data/lib/temporalio/bridge/retry_config.rb +24 -0
  230. data/lib/temporalio/bridge/tls_options.rb +19 -0
  231. data/lib/temporalio/bridge.rb +14 -0
  232. data/lib/{temporal → temporalio}/client/implementation.rb +57 -56
  233. data/lib/{temporal → temporalio}/client/workflow_handle.rb +35 -35
  234. data/lib/{temporal → temporalio}/client.rb +19 -32
  235. data/lib/temporalio/connection/retry_config.rb +44 -0
  236. data/lib/temporalio/connection/service.rb +20 -0
  237. data/lib/temporalio/connection/test_service.rb +92 -0
  238. data/lib/temporalio/connection/tls_options.rb +51 -0
  239. data/lib/temporalio/connection/workflow_service.rb +731 -0
  240. data/lib/temporalio/connection.rb +86 -0
  241. data/lib/{temporal → temporalio}/data_converter.rb +76 -35
  242. data/lib/{temporal → temporalio}/error/failure.rb +6 -6
  243. data/lib/{temporal → temporalio}/error/workflow_failure.rb +4 -2
  244. data/lib/{temporal → temporalio}/errors.rb +19 -1
  245. data/lib/{temporal → temporalio}/failure_converter/base.rb +5 -5
  246. data/lib/{temporal → temporalio}/failure_converter/basic.rb +58 -52
  247. data/lib/temporalio/failure_converter.rb +7 -0
  248. data/lib/temporalio/interceptor/activity_inbound.rb +22 -0
  249. data/lib/temporalio/interceptor/activity_outbound.rb +24 -0
  250. data/lib/{temporal → temporalio}/interceptor/chain.rb +7 -6
  251. data/lib/{temporal → temporalio}/interceptor/client.rb +27 -2
  252. data/lib/temporalio/interceptor.rb +22 -0
  253. data/lib/{temporal → temporalio}/payload_codec/base.rb +5 -5
  254. data/lib/{temporal → temporalio}/payload_converter/base.rb +3 -3
  255. data/lib/{temporal → temporalio}/payload_converter/bytes.rb +4 -3
  256. data/lib/{temporal → temporalio}/payload_converter/composite.rb +7 -5
  257. data/lib/{temporal → temporalio}/payload_converter/encoding_base.rb +4 -4
  258. data/lib/{temporal → temporalio}/payload_converter/json.rb +4 -3
  259. data/lib/{temporal → temporalio}/payload_converter/nil.rb +4 -3
  260. data/lib/temporalio/payload_converter.rb +14 -0
  261. data/lib/{temporal → temporalio}/retry_policy.rb +17 -7
  262. data/lib/{temporal → temporalio}/retry_state.rb +1 -1
  263. data/lib/temporalio/runtime.rb +25 -0
  264. data/lib/temporalio/testing/time_skipping_handle.rb +32 -0
  265. data/lib/temporalio/testing/time_skipping_interceptor.rb +23 -0
  266. data/lib/temporalio/testing/workflow_environment.rb +112 -0
  267. data/lib/temporalio/testing.rb +175 -0
  268. data/lib/{temporal → temporalio}/timeout_type.rb +2 -2
  269. data/lib/temporalio/version.rb +3 -0
  270. data/lib/temporalio/worker/activity_runner.rb +114 -0
  271. data/lib/temporalio/worker/activity_worker.rb +164 -0
  272. data/lib/temporalio/worker/reactor.rb +46 -0
  273. data/lib/temporalio/worker/runner.rb +63 -0
  274. data/lib/temporalio/worker/sync_worker.rb +124 -0
  275. data/lib/temporalio/worker/thread_pool_executor.rb +51 -0
  276. data/lib/temporalio/worker.rb +204 -0
  277. data/lib/temporalio/workflow/async.rb +46 -0
  278. data/lib/{temporal → temporalio}/workflow/execution_info.rb +4 -4
  279. data/lib/{temporal → temporalio}/workflow/execution_status.rb +1 -1
  280. data/lib/temporalio/workflow/future.rb +138 -0
  281. data/lib/{temporal → temporalio}/workflow/id_reuse_policy.rb +6 -6
  282. data/lib/temporalio/workflow/info.rb +76 -0
  283. data/lib/{temporal → temporalio}/workflow/query_reject_condition.rb +5 -5
  284. data/lib/temporalio.rb +12 -3
  285. data/temporalio.gemspec +11 -6
  286. metadata +137 -64
  287. data/bridge/sdk-core/Cargo.lock +0 -2606
  288. data/bridge/sdk-core/bridge-ffi/Cargo.toml +0 -24
  289. data/bridge/sdk-core/bridge-ffi/LICENSE.txt +0 -23
  290. data/bridge/sdk-core/bridge-ffi/build.rs +0 -25
  291. data/bridge/sdk-core/bridge-ffi/include/sdk-core-bridge.h +0 -249
  292. data/bridge/sdk-core/bridge-ffi/src/lib.rs +0 -825
  293. data/bridge/sdk-core/bridge-ffi/src/wrappers.rs +0 -211
  294. data/bridge/sdk-core/core/src/log_export.rs +0 -62
  295. data/bridge/sdk-core/core/src/worker/workflow/machines/mutable_side_effect_state_machine.rs +0 -127
  296. data/bridge/sdk-core/core/src/worker/workflow/machines/side_effect_state_machine.rs +0 -71
  297. data/bridge/sdk-core/protos/api_upstream/temporal/api/cluster/v1/message.proto +0 -83
  298. data/bridge/sdk-core/protos/local/temporal/sdk/core/bridge/bridge.proto +0 -210
  299. data/bridge/sdk-core/sdk/src/conversions.rs +0 -8
  300. data/lib/bridge.so +0 -0
  301. data/lib/gen/temporal/api/cluster/v1/message_pb.rb +0 -67
  302. data/lib/gen/temporal/api/enums/v1/cluster_pb.rb +0 -26
  303. data/lib/gen/temporal/sdk/core/bridge/bridge_pb.rb +0 -222
  304. data/lib/temporal/bridge.rb +0 -14
  305. data/lib/temporal/connection.rb +0 -736
  306. data/lib/temporal/failure_converter.rb +0 -8
  307. data/lib/temporal/payload_converter.rb +0 -14
  308. data/lib/temporal/runtime.rb +0 -22
  309. data/lib/temporal/version.rb +0 -3
  310. data/lib/temporal.rb +0 -8
@@ -1,187 +1,162 @@
1
1
  <?xml version="1.0" encoding="UTF-8" standalone="no"?>
2
2
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
3
3
  "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <!-- Generated by graphviz version 2.43.0 (0)
4
+ <!-- Generated by graphviz version 7.0.4 (0)
5
5
  -->
6
- <!-- Title: %3 Pages: 1 -->
7
- <svg width="525pt" height="476pt"
8
- viewBox="0.00 0.00 524.50 476.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
- <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 472)">
10
- <title>%3</title>
11
- <polygon fill="white" stroke="transparent" points="-4,4 -4,-472 520.5,-472 520.5,4 -4,4"/>
6
+ <!-- Pages: 1 -->
7
+ <svg width="436pt" height="404pt"
8
+ viewBox="0.00 0.00 436.26 404.00" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
9
+ <g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 400)">
10
+ <polygon fill="white" stroke="none" points="-4,4 -4,-400 432.26,-400 432.26,4 -4,4"/>
12
11
  <!-- 0 -->
13
12
  <g id="node1" class="node">
14
13
  <title>0</title>
15
- <polygon fill="none" stroke="black" points="173,-468 0,-468 0,-432 173,-432 173,-468"/>
16
- <text text-anchor="middle" x="86.5" y="-446.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;bridge&#45;ffi</text>
14
+ <polygon fill="none" stroke="black" points="255,-396 139,-396 139,-360 255,-360 255,-396"/>
15
+ <text text-anchor="middle" x="197" y="-374.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core</text>
17
16
  </g>
18
17
  <!-- 1 -->
19
18
  <g id="node2" class="node">
20
19
  <title>1</title>
21
- <polygon fill="none" stroke="black" points="369.5,-396 253.5,-396 253.5,-360 369.5,-360 369.5,-396"/>
22
- <text text-anchor="middle" x="311.5" y="-374.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core</text>
20
+ <polygon fill="none" stroke="black" points="58,-324 0,-324 0,-288 58,-288 58,-324"/>
21
+ <text text-anchor="middle" x="29" y="-302.3" font-family="Times,serif" font-size="14.00">rustfsm</text>
23
22
  </g>
24
23
  <!-- 0&#45;&gt;1 -->
25
24
  <g id="edge1" class="edge">
26
25
  <title>0&#45;&gt;1</title>
27
- <path fill="none" stroke="black" d="M141.25,-431.97C173.1,-422.06 213.42,-409.51 246.83,-399.12"/>
28
- <polygon fill="black" stroke="black" points="247.99,-402.42 256.5,-396.11 245.91,-395.74 247.99,-402.42"/>
26
+ <path fill="none" stroke="black" d="M155.04,-359.52C128.68,-348.53 94.87,-334.45 68.91,-323.63"/>
27
+ <polygon fill="black" stroke="black" points="70.28,-320.41 59.7,-319.79 67.59,-326.87 70.28,-320.41"/>
29
28
  </g>
30
- <!-- 6 -->
31
- <g id="node5" class="node">
32
- <title>6</title>
33
- <polygon fill="none" stroke="black" points="401,-36 246,-36 246,0 401,0 401,-36"/>
34
- <text text-anchor="middle" x="323.5" y="-14.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;protos</text>
35
- </g>
36
- <!-- 0&#45;&gt;6 -->
37
- <g id="edge3" class="edge">
38
- <title>0&#45;&gt;6</title>
39
- <path fill="none" stroke="black" d="M78.81,-431.91C67.71,-405.62 48.5,-353.45 48.5,-307 48.5,-307 48.5,-307 48.5,-161 48.5,-75.33 155.16,-41.29 235.63,-27.8"/>
40
- <polygon fill="black" stroke="black" points="236.47,-31.21 245.8,-26.18 235.37,-24.3 236.47,-31.21"/>
41
- </g>
42
- <!-- 7 -->
43
- <g id="node6" class="node">
44
- <title>7</title>
45
- <polygon fill="none" stroke="black" points="266,-180 129,-180 129,-144 266,-144 266,-180"/>
46
- <text text-anchor="middle" x="197.5" y="-158.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;api</text>
29
+ <!-- 3 -->
30
+ <g id="node3" class="node">
31
+ <title>3</title>
32
+ <polygon fill="none" stroke="black" points="368,-108 268,-108 268,-72 368,-72 368,-108"/>
33
+ <text text-anchor="middle" x="318" y="-86.3" font-family="Times,serif" font-size="14.00">temporal&#45;client</text>
47
34
  </g>
48
- <!-- 0&#45;&gt;7 -->
35
+ <!-- 0&#45;&gt;3 -->
49
36
  <g id="edge2" class="edge">
50
- <title>0&#45;&gt;7</title>
51
- <path fill="none" stroke="black" d="M85.71,-431.86C84.92,-401.65 85.97,-337.48 105.5,-288 120.88,-249.04 151.5,-211.31 173.18,-187.68"/>
52
- <polygon fill="black" stroke="black" points="175.88,-189.92 180.16,-180.23 170.77,-185.14 175.88,-189.92"/>
37
+ <title>0&#45;&gt;3</title>
38
+ <path fill="none" stroke="black" d="M255.43,-370.58C312.02,-363.02 391.98,-348.3 411,-324 461.94,-258.91 386.25,-162.28 343.68,-116.65"/>
39
+ <polygon fill="black" stroke="black" points="346.38,-114.4 336.95,-109.58 341.31,-119.23 346.38,-114.4"/>
53
40
  </g>
54
- <!-- 2 -->
55
- <g id="node3" class="node">
56
- <title>2</title>
57
- <polygon fill="none" stroke="black" points="172.5,-324 114.5,-324 114.5,-288 172.5,-288 172.5,-324"/>
58
- <text text-anchor="middle" x="143.5" y="-302.3" font-family="Times,serif" font-size="14.00">rustfsm</text>
41
+ <!-- 4 -->
42
+ <g id="node4" class="node">
43
+ <title>4</title>
44
+ <polygon fill="none" stroke="black" points="298.5,-36 143.5,-36 143.5,0 298.5,0 298.5,-36"/>
45
+ <text text-anchor="middle" x="221" y="-14.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;protos</text>
59
46
  </g>
60
- <!-- 1&#45;&gt;2 -->
61
- <g id="edge4" class="edge">
62
- <title>1&#45;&gt;2</title>
63
- <path fill="none" stroke="black" d="M270.4,-359.88C243.41,-348.63 208.34,-334.02 181.91,-323"/>
64
- <polygon fill="black" stroke="black" points="183.17,-319.74 172.59,-319.12 180.47,-326.2 183.17,-319.74"/>
47
+ <!-- 0&#45;&gt;4 -->
48
+ <g id="edge5" class="edge">
49
+ <title>0&#45;&gt;4</title>
50
+ <path fill="none" stroke="black" d="M170.41,-359.59C137.57,-335.74 86,-289.6 86,-235 86,-235 86,-235 86,-161 86,-107.38 137.19,-65.95 176.53,-42.03"/>
51
+ <polygon fill="black" stroke="black" points="178.08,-45.18 184.93,-37.1 174.53,-39.14 178.08,-45.18"/>
65
52
  </g>
66
53
  <!-- 5 -->
67
- <g id="node4" class="node">
54
+ <g id="node5" class="node">
68
55
  <title>5</title>
69
- <polygon fill="none" stroke="black" points="412.5,-108 312.5,-108 312.5,-72 412.5,-72 412.5,-108"/>
70
- <text text-anchor="middle" x="362.5" y="-86.3" font-family="Times,serif" font-size="14.00">temporal&#45;client</text>
56
+ <polygon fill="none" stroke="black" points="289.5,-180 152.5,-180 152.5,-144 289.5,-144 289.5,-180"/>
57
+ <text text-anchor="middle" x="221" y="-158.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;api</text>
71
58
  </g>
72
- <!-- 1&#45;&gt;5 -->
73
- <g id="edge5" class="edge">
74
- <title>1&#45;&gt;5</title>
75
- <path fill="none" stroke="black" d="M369.63,-361.71C391.38,-353.54 414.82,-341.45 431.5,-324 455.23,-299.18 453.17,-285.75 459.5,-252 462.45,-236.27 464.68,-231.14 459.5,-216 445.69,-175.67 412.97,-138.29 389.35,-115.12"/>
76
- <polygon fill="black" stroke="black" points="391.67,-112.5 382.03,-108.11 386.83,-117.55 391.67,-112.5"/>
59
+ <!-- 0&#45;&gt;5 -->
60
+ <g id="edge4" class="edge">
61
+ <title>0&#45;&gt;5</title>
62
+ <path fill="none" stroke="black" d="M188.08,-359.89C173.64,-329.74 148.72,-265.64 169,-216 173.27,-205.55 180.7,-196.05 188.64,-188.07"/>
63
+ <polygon fill="black" stroke="black" points="190.92,-190.72 195.87,-181.35 186.16,-185.59 190.92,-190.72"/>
77
64
  </g>
78
- <!-- 1&#45;&gt;6 -->
79
- <g id="edge8" class="edge">
80
- <title>1&#45;&gt;6</title>
81
- <path fill="none" stroke="black" d="M369.7,-363.34C430.3,-345.24 516.5,-306.87 516.5,-235 516.5,-235 516.5,-235 516.5,-161 516.5,-98.28 449.55,-60.18 394.51,-39.46"/>
82
- <polygon fill="black" stroke="black" points="395.69,-36.16 385.1,-36.04 393.3,-42.74 395.69,-36.16"/>
65
+ <!-- 6 -->
66
+ <g id="node6" class="node">
67
+ <title>6</title>
68
+ <polygon fill="none" stroke="black" points="266.5,-252 177.5,-252 177.5,-216 266.5,-216 266.5,-252"/>
69
+ <text text-anchor="middle" x="222" y="-230.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk</text>
83
70
  </g>
84
- <!-- 1&#45;&gt;7 -->
85
- <g id="edge7" class="edge">
86
- <title>1&#45;&gt;7</title>
87
- <path fill="none" stroke="black" d="M264.03,-359.96C247.39,-351.64 230.2,-339.91 219.5,-324 192.37,-283.65 191.8,-224.66 194.32,-190.41"/>
88
- <polygon fill="black" stroke="black" points="197.83,-190.49 195.22,-180.22 190.86,-189.87 197.83,-190.49"/>
71
+ <!-- 0&#45;&gt;6 -->
72
+ <g id="edge3" class="edge">
73
+ <title>0&#45;&gt;6</title>
74
+ <path fill="none" stroke="blue" d="M195.45,-359.59C197.18,-335.5 204.59,-291.75 211.56,-263.03"/>
75
+ <polygon fill="blue" stroke="blue" points="214.89,-264.13 214.02,-253.58 208.12,-262.37 214.89,-264.13"/>
89
76
  </g>
90
- <!-- 8 -->
77
+ <!-- 7 -->
91
78
  <g id="node7" class="node">
92
- <title>8</title>
93
- <polygon fill="none" stroke="black" points="450,-252 361,-252 361,-216 450,-216 450,-252"/>
94
- <text text-anchor="middle" x="405.5" y="-230.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk</text>
79
+ <title>7</title>
80
+ <polygon fill="none" stroke="black" points="401.5,-324 234.5,-324 234.5,-288 401.5,-288 401.5,-324"/>
81
+ <text text-anchor="middle" x="318" y="-302.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;test&#45;utils</text>
95
82
  </g>
96
- <!-- 1&#45;&gt;8 -->
83
+ <!-- 0&#45;&gt;7 -->
97
84
  <g id="edge6" class="edge">
98
- <title>1&#45;&gt;8</title>
99
- <path fill="none" stroke="blue" d="M354.05,-359.78C369.82,-351.61 386.07,-340.02 395.5,-324 406.38,-305.52 405.76,-280.93 404.34,-262.27"/>
100
- <polygon fill="blue" stroke="blue" points="407.81,-261.75 403.49,-252.07 400.83,-262.32 407.81,-261.75"/>
85
+ <title>0&#45;&gt;7</title>
86
+ <path fill="none" stroke="blue" d="M221.29,-359.52C235.94,-350.51 254.96,-339.42 272.29,-329.76"/>
87
+ <polygon fill="blue" stroke="blue" points="273.86,-332.89 280.93,-324.99 270.48,-326.76 273.86,-332.89"/>
101
88
  </g>
102
- <!-- 9 -->
103
- <g id="node8" class="node">
104
- <title>9</title>
105
- <polygon fill="none" stroke="black" points="395,-324 228,-324 228,-288 395,-288 395,-324"/>
106
- <text text-anchor="middle" x="311.5" y="-302.3" font-family="Times,serif" font-size="14.00">temporal&#45;sdk&#45;core&#45;test&#45;utils</text>
89
+ <!-- 3&#45;&gt;4 -->
90
+ <g id="edge7" class="edge">
91
+ <title>3&#45;&gt;4</title>
92
+ <path fill="none" stroke="black" d="M294.02,-71.7C282.01,-63.03 267.28,-52.4 254.21,-42.96"/>
93
+ <polygon fill="black" stroke="black" points="256.42,-40.25 246.27,-37.23 252.33,-45.92 256.42,-40.25"/>
107
94
  </g>
108
- <!-- 1&#45;&gt;9 -->
109
- <g id="edge9" class="edge">
110
- <title>1&#45;&gt;9</title>
111
- <path fill="none" stroke="blue" d="M305.58,-359.7C304.79,-351.98 304.56,-342.71 304.9,-334.11"/>
112
- <polygon fill="blue" stroke="blue" points="308.4,-334.32 305.6,-324.1 301.42,-333.84 308.4,-334.32"/>
95
+ <!-- 5&#45;&gt;3 -->
96
+ <g id="edge8" class="edge">
97
+ <title>5&#45;&gt;3</title>
98
+ <path fill="none" stroke="black" d="M244.98,-143.7C256.99,-135.03 271.72,-124.4 284.79,-114.96"/>
99
+ <polygon fill="black" stroke="black" points="286.67,-117.92 292.73,-109.23 282.58,-112.25 286.67,-117.92"/>
113
100
  </g>
114
- <!-- 5&#45;&gt;6 -->
115
- <g id="edge10" class="edge">
116
- <title>5&#45;&gt;6</title>
117
- <path fill="none" stroke="black" d="M352.86,-71.7C348.37,-63.64 342.94,-53.89 337.98,-44.98"/>
118
- <polygon fill="black" stroke="black" points="340.95,-43.14 333.03,-36.1 334.84,-46.54 340.95,-43.14"/>
101
+ <!-- 5&#45;&gt;4 -->
102
+ <g id="edge9" class="edge">
103
+ <title>5&#45;&gt;4</title>
104
+ <path fill="none" stroke="black" d="M221,-143.59C221,-119.61 221,-76.14 221,-47.42"/>
105
+ <polygon fill="black" stroke="black" points="224.5,-47.62 221,-37.62 217.5,-47.62 224.5,-47.62"/>
119
106
  </g>
120
- <!-- 7&#45;&gt;5 -->
107
+ <!-- 6&#45;&gt;0 -->
121
108
  <g id="edge11" class="edge">
122
- <title>7&#45;&gt;5</title>
123
- <path fill="none" stroke="black" d="M237.86,-143.88C260.52,-134.26 288.97,-122.19 312.97,-112.01"/>
124
- <polygon fill="black" stroke="black" points="314.43,-115.2 322.27,-108.07 311.69,-108.75 314.43,-115.2"/>
125
- </g>
126
- <!-- 7&#45;&gt;6 -->
127
- <g id="edge12" class="edge">
128
- <title>7&#45;&gt;6</title>
129
- <path fill="none" stroke="black" d="M210.74,-143.85C225.01,-125.62 248.63,-96.14 270.5,-72 279.24,-62.36 289.24,-52.16 298.18,-43.31"/>
130
- <polygon fill="black" stroke="black" points="300.7,-45.74 305.39,-36.24 295.8,-40.75 300.7,-45.74"/>
109
+ <title>6&#45;&gt;0</title>
110
+ <path fill="none" stroke="black" d="M223.57,-252.11C221.89,-276.03 214.51,-319.76 207.53,-348.6"/>
111
+ <polygon fill="black" stroke="black" points="204.18,-347.56 205.06,-358.12 210.96,-349.32 204.18,-347.56"/>
131
112
  </g>
132
- <!-- 8&#45;&gt;1 -->
133
- <g id="edge14" class="edge">
134
- <title>8&#45;&gt;1</title>
135
- <path fill="none" stroke="black" d="M416.59,-252.07C423.07,-271.04 426.51,-301.89 413.5,-324 405.57,-337.47 392.82,-347.8 378.95,-355.62"/>
136
- <polygon fill="black" stroke="black" points="376.99,-352.69 369.71,-360.39 380.2,-358.91 376.99,-352.69"/>
113
+ <!-- 6&#45;&gt;3 -->
114
+ <g id="edge10" class="edge">
115
+ <title>6&#45;&gt;3</title>
116
+ <path fill="none" stroke="black" d="M258.49,-215.67C273.19,-206.93 288.99,-194.98 299,-180 310.95,-162.11 315.57,-138.07 317.27,-119.49"/>
117
+ <polygon fill="black" stroke="black" points="320.75,-119.9 317.91,-109.69 313.76,-119.44 320.75,-119.9"/>
137
118
  </g>
138
- <!-- 8&#45;&gt;5 -->
119
+ <!-- 6&#45;&gt;4 -->
139
120
  <g id="edge13" class="edge">
140
- <title>8&#45;&gt;5</title>
141
- <path fill="none" stroke="black" d="M400.31,-215.87C392.95,-191.56 379.4,-146.82 370.68,-118.01"/>
142
- <polygon fill="black" stroke="black" points="373.95,-116.75 367.71,-108.19 367.25,-118.77 373.95,-116.75"/>
121
+ <title>6&#45;&gt;4</title>
122
+ <path fill="none" stroke="black" d="M181.41,-215.53C166.89,-207.06 152.12,-195.34 144,-180 136.51,-165.86 139.64,-159.39 144,-144 154.67,-106.33 180.26,-68.86 199.02,-44.92"/>
123
+ <polygon fill="black" stroke="black" points="201.6,-47.29 205.13,-37.31 196.14,-42.91 201.6,-47.29"/>
124
+ </g>
125
+ <!-- 6&#45;&gt;5 -->
126
+ <g id="edge12" class="edge">
127
+ <title>6&#45;&gt;5</title>
128
+ <path fill="none" stroke="black" d="M221.75,-215.7C221.65,-208.41 221.52,-199.73 221.41,-191.54"/>
129
+ <polygon fill="black" stroke="black" points="224.91,-191.57 221.27,-181.62 217.91,-191.67 224.91,-191.57"/>
143
130
  </g>
144
- <!-- 8&#45;&gt;6 -->
131
+ <!-- 7&#45;&gt;0 -->
145
132
  <g id="edge16" class="edge">
146
- <title>8&#45;&gt;6</title>
147
- <path fill="none" stroke="black" d="M413.59,-215.56C426.78,-184.32 448.83,-117.84 421.5,-72 413.54,-58.64 400.91,-48.45 387.34,-40.75"/>
148
- <polygon fill="black" stroke="black" points="388.8,-37.56 378.32,-36.04 385.56,-43.77 388.8,-37.56"/>
133
+ <title>7&#45;&gt;0</title>
134
+ <path fill="none" stroke="black" d="M294.08,-324.26C279.5,-333.23 260.5,-344.31 243.14,-354"/>
135
+ <polygon fill="black" stroke="black" points="241.54,-350.89 234.48,-358.78 244.93,-357.01 241.54,-350.89"/>
149
136
  </g>
150
- <!-- 8&#45;&gt;7 -->
151
- <g id="edge15" class="edge">
152
- <title>8&#45;&gt;7</title>
153
- <path fill="none" stroke="black" d="M360.88,-217.98C330.78,-207.86 290.71,-194.37 257.79,-183.29"/>
154
- <polygon fill="black" stroke="black" points="258.86,-179.96 248.26,-180.08 256.62,-186.59 258.86,-179.96"/>
137
+ <!-- 7&#45;&gt;3 -->
138
+ <g id="edge14" class="edge">
139
+ <title>7&#45;&gt;3</title>
140
+ <path fill="none" stroke="black" d="M318.57,-287.61C319.46,-258.08 320.99,-196.26 320,-144 319.85,-136.05 319.57,-127.44 319.27,-119.51"/>
141
+ <polygon fill="black" stroke="black" points="322.78,-119.54 318.87,-109.69 315.78,-119.83 322.78,-119.54"/>
155
142
  </g>
156
- <!-- 9&#45;&gt;1 -->
157
- <g id="edge19" class="edge">
158
- <title>9&#45;&gt;1</title>
159
- <path fill="none" stroke="black" d="M317.4,-324.1C318.2,-331.79 318.44,-341.05 318.1,-349.67"/>
160
- <polygon fill="black" stroke="black" points="314.61,-349.48 317.42,-359.7 321.59,-349.96 314.61,-349.48"/>
143
+ <!-- 7&#45;&gt;4 -->
144
+ <g id="edge18" class="edge">
145
+ <title>7&#45;&gt;4</title>
146
+ <path fill="none" stroke="black" d="M331.1,-287.73C360.65,-246.5 426.21,-140.69 377,-72 361.19,-49.92 335.65,-36.93 309.77,-29.32"/>
147
+ <polygon fill="black" stroke="black" points="310.71,-25.95 300.15,-26.77 308.92,-32.72 310.71,-25.95"/>
161
148
  </g>
162
- <!-- 9&#45;&gt;5 -->
149
+ <!-- 7&#45;&gt;5 -->
163
150
  <g id="edge17" class="edge">
164
- <title>9&#45;&gt;5</title>
165
- <path fill="none" stroke="black" d="M315.59,-287.85C324.43,-250.75 345.39,-162.81 356.04,-118.1"/>
166
- <polygon fill="black" stroke="black" points="359.48,-118.77 358.39,-108.23 352.67,-117.15 359.48,-118.77"/>
167
- </g>
168
- <!-- 9&#45;&gt;6 -->
169
- <g id="edge21" class="edge">
170
- <title>9&#45;&gt;6</title>
171
- <path fill="none" stroke="black" d="M308.43,-287.86C302.03,-249.05 288.97,-151.64 303.5,-72 305.11,-63.2 308.1,-53.95 311.29,-45.7"/>
172
- <polygon fill="black" stroke="black" points="314.62,-46.79 315.19,-36.21 308.15,-44.12 314.62,-46.79"/>
173
- </g>
174
- <!-- 9&#45;&gt;7 -->
175
- <g id="edge20" class="edge">
176
- <title>9&#45;&gt;7</title>
177
- <path fill="none" stroke="black" d="M297.75,-287.87C277.81,-263.03 240.73,-216.85 217.68,-188.14"/>
178
- <polygon fill="black" stroke="black" points="220.29,-185.8 211.3,-180.19 214.83,-190.18 220.29,-185.8"/>
179
- </g>
180
- <!-- 9&#45;&gt;8 -->
181
- <g id="edge18" class="edge">
182
- <title>9&#45;&gt;8</title>
183
- <path fill="none" stroke="black" d="M334.74,-287.7C346.69,-278.8 361.42,-267.82 374.35,-258.2"/>
184
- <polygon fill="black" stroke="black" points="376.6,-260.88 382.53,-252.1 372.42,-255.27 376.6,-260.88"/>
151
+ <title>7&#45;&gt;5</title>
152
+ <path fill="none" stroke="black" d="M311.96,-287.6C304.98,-268.89 292.34,-238.77 276,-216 268.79,-205.96 259.54,-196.2 250.69,-187.86"/>
153
+ <polygon fill="black" stroke="black" points="253.28,-185.48 243.53,-181.34 248.57,-190.66 253.28,-185.48"/>
154
+ </g>
155
+ <!-- 7&#45;&gt;6 -->
156
+ <g id="edge15" class="edge">
157
+ <title>7&#45;&gt;6</title>
158
+ <path fill="none" stroke="black" d="M294.27,-287.7C282.38,-279.03 267.81,-268.4 254.86,-258.96"/>
159
+ <polygon fill="black" stroke="black" points="257.16,-256.3 247.01,-253.24 253.03,-261.96 257.16,-256.3"/>
185
160
  </g>
186
161
  </g>
187
162
  </svg>
@@ -0,0 +1,5 @@
1
+ # Run this from the repo root
2
+ cargo depgraph \
3
+ --focus temporal-sdk,temporal-sdk-core-protos,temporal-client,temporal-sdk-core-api,temporal-sdk-core,rustfsm \
4
+ --dev-deps \
5
+ | dot -Tsvg > etc/deps.svg
@@ -132,17 +132,17 @@ use syn::{
132
132
  /// The macro will generate a few things:
133
133
  /// * A struct for the overall state machine, named with the provided name. Here:
134
134
  /// ```text
135
- /// struct CardMachine {
136
- /// state: CardMachineState,
137
- /// shared_state: CardId,
135
+ /// struct CardReader {
136
+ /// state: CardReaderState,
137
+ /// shared_state: SharedState,
138
138
  /// }
139
139
  /// ```
140
140
  /// * An enum with a variant for each state, named with the provided name + "State".
141
141
  /// ```text
142
- /// enum CardMachineState {
142
+ /// enum CardReaderState {
143
143
  /// Locked(Locked),
144
144
  /// ReadingCard(ReadingCard),
145
- /// Unlocked(Unlocked),
145
+ /// DoorOpen(DoorOpen),
146
146
  /// }
147
147
  /// ```
148
148
  ///
@@ -154,15 +154,18 @@ use syn::{
154
154
  /// * An enum with a variant for each event. You are expected to define the type (if any) contained
155
155
  /// in the event variant.
156
156
  /// ```text
157
- /// enum CardMachineEvents {
158
- /// CardReadable(CardData)
157
+ /// enum CardReaderEvents {
158
+ /// DoorClosed,
159
+ /// CardAccepted,
160
+ /// CardRejected,
161
+ /// CardReadable(CardData),
159
162
  /// }
160
163
  /// ```
161
164
  /// * An implementation of the [StateMachine](trait.StateMachine.html) trait for the generated state
162
- /// machine enum (in this case, `CardMachine`)
165
+ /// machine enum (in this case, `CardReader`)
163
166
  /// * A type alias for a [TransitionResult](enum.TransitionResult.html) with the appropriate generic
164
167
  /// parameters set for your machine. It is named as your machine with `Transition` appended. In
165
- /// this case, `CardMachineTransition`.
168
+ /// this case, `CardReaderTransition`.
166
169
  #[proc_macro]
167
170
  pub fn fsm(input: TokenStream) -> TokenStream {
168
171
  let def: StateMachineDefinition = parse_macro_input!(input as StateMachineDefinition);
@@ -346,12 +349,12 @@ impl StateMachineDefinition {
346
349
  let name = &self.name;
347
350
  let name_str = &self.name.to_string();
348
351
 
349
- let transition_result_name = Ident::new(&format!("{}Transition", name), name.span());
352
+ let transition_result_name = Ident::new(&format!("{name}Transition"), name.span());
350
353
  let transition_type_alias = quote! {
351
354
  type #transition_result_name<Ds, Sm = #name> = TransitionResult<Sm, Ds>;
352
355
  };
353
356
 
354
- let state_enum_name = Ident::new(&format!("{}State", name), name.span());
357
+ let state_enum_name = Ident::new(&format!("{name}State"), name.span());
355
358
  // If user has not defined any shared state, use the unit type.
356
359
  let shared_state_type = self
357
360
  .shared_state_type
@@ -390,7 +393,7 @@ impl StateMachineDefinition {
390
393
 
391
394
  // Build the events enum
392
395
  let events: HashSet<Variant> = self.transitions.iter().map(|t| t.event.clone()).collect();
393
- let events_enum_name = Ident::new(&format!("{}Events", name), name.span());
396
+ let events_enum_name = Ident::new(&format!("{name}Events"), name.span());
394
397
  let events: Vec<_> = events
395
398
  .into_iter()
396
399
  .map(|v| {
@@ -616,11 +619,11 @@ impl StateMachineDefinition {
616
619
  self.all_states()
617
620
  .iter()
618
621
  .filter(|s| self.is_final_state(s))
619
- .map(|s| format!("{} --> [*]", s)),
622
+ .map(|s| format!("{s} --> [*]")),
620
623
  )
621
624
  .collect();
622
625
  let transitions = transitions.join("\n");
623
- format!("@startuml\n{}\n@enduml", transitions)
626
+ format!("@startuml\n{transitions}\n@enduml")
624
627
  }
625
628
  }
626
629
 
@@ -643,5 +646,5 @@ fn merge_transition_dests(transitions: Vec<Transition>) -> Vec<Transition> {
643
646
  }
644
647
  }
645
648
  }
646
- map.into_iter().map(|(_, v)| v).collect()
649
+ map.into_values().collect()
647
650
  }
@@ -4,7 +4,7 @@ error[E0277]: the trait bound `One: From<Two>` is not satisfied
4
4
  11 | Two --(B)--> One;
5
5
  | ^^^ the trait `From<Two>` is not implemented for `One`
6
6
  |
7
- = note: required because of the requirements on the impl of `Into<One>` for `Two`
7
+ = note: required for `Two` to implement `Into<One>`
8
8
  note: required by a bound in `TransitionResult::<Sm, Ds>::from`
9
9
  --> $WORKSPACE/fsm/rustfsm_trait/src/lib.rs
10
10
  |
@@ -34,6 +34,7 @@ pub trait StateMachine: Sized {
34
34
  where
35
35
  Self: Clone,
36
36
  {
37
+ // TODO: Get rid of this clone. It's pointless.
37
38
  // NOTE: This clone is actually nice in some sense, giving us a kind of transactionality.
38
39
  // However if there are really big things in state it could be an issue.
39
40
  let res = self.clone().on_event(event);
@@ -207,10 +208,14 @@ where
207
208
  new_state: Ds::default(),
208
209
  }
209
210
  }
211
+ }
210
212
 
211
- /// Produce a transition with no commands relying on [Default] for the destination state's
212
- /// value
213
- pub fn default() -> Self {
213
+ impl<Sm, Ds> Default for TransitionResult<Sm, Ds>
214
+ where
215
+ Sm: StateMachine,
216
+ Ds: Into<Sm::State> + Default,
217
+ {
218
+ fn default() -> Self {
214
219
  Self::OkNoShare {
215
220
  commands: vec![],
216
221
  new_state: Ds::default(),
@@ -1,8 +1,5 @@
1
1
  version: v1
2
2
  breaking:
3
- ignore:
4
- - temporal/api/schedule/v1
5
- - temporal/api/update/v1
6
3
  use:
7
4
  - PACKAGE
8
5
  lint:
@@ -0,0 +1,7 @@
1
+ module build
2
+
3
+ go 1.18
4
+
5
+ require (
6
+ github.com/temporalio/gogo-protobuf v1.22.1
7
+ )
@@ -0,0 +1,5 @@
1
+ github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
2
+ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
3
+ github.com/temporalio/gogo-protobuf v1.22.1 h1:K5ja5MqmCQKo4tlX7u3g+ZJqbvRr0589ss2cZQx2dSM=
4
+ github.com/temporalio/gogo-protobuf v1.22.1/go.mod h1:tCaEv+fB8tsyLgoaqKr78K/JOhdRe684yyo0z30SHyA=
5
+ golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
@@ -1,6 +1,8 @@
1
1
  // The MIT License
2
2
  //
3
- // Copyright (c) 2022 Temporal Technologies Inc. All rights reserved.
3
+ // Copyright (c) 2020 Temporal Technologies Inc. All rights reserved.
4
+ //
5
+ // Copyright (c) 2020 Uber Technologies, Inc.
4
6
  //
5
7
  // Permission is hereby granted, free of charge, to any person obtaining a copy
6
8
  // of this software and associated documentation files (the "Software"), to deal
@@ -20,21 +22,8 @@
20
22
  // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
23
  // THE SOFTWARE.
22
24
 
23
- syntax = "proto3";
24
-
25
- package temporal.api.enums.v1;
26
-
27
- option go_package = "go.temporal.io/api/enums/v1;enums";
28
- option java_package = "io.temporal.api.enums.v1";
29
- option java_multiple_files = true;
30
- option java_outer_classname = "ClusterProto";
31
- option ruby_package = "Temporal::Api::Enums::V1";
32
- option csharp_namespace = "Temporal.Api.Enums.V1";
25
+ package build
33
26
 
34
- enum ClusterMemberRole {
35
- CLUSTER_MEMBER_ROLE_UNSPECIFIED = 0;
36
- CLUSTER_MEMBER_ROLE_FRONTEND = 1;
37
- CLUSTER_MEMBER_ROLE_HISTORY = 2;
38
- CLUSTER_MEMBER_ROLE_MATCHING = 3;
39
- CLUSTER_MEMBER_ROLE_WORKER = 4;
40
- }
27
+ import (
28
+ _ "github.com/temporalio/gogo-protobuf/gogoproto" // gogoproto is just a random package name for module.
29
+ )
@@ -0,0 +1,6 @@
1
+ // There is special go module in `build` directory that is used to control tools versions.
2
+ // This file exists because go 1.18 doesn't allow go sub modules if root dirrectory is not a go module.
3
+
4
+ module api
5
+
6
+ go 1.18
@@ -28,8 +28,8 @@ option go_package = "go.temporal.io/api/batch/v1;batch";
28
28
  option java_package = "io.temporal.api.batch.v1";
29
29
  option java_multiple_files = true;
30
30
  option java_outer_classname = "MessageProto";
31
- option ruby_package = "Temporal::Api::Batch::V1";
32
- option csharp_namespace = "Temporal.Api.Batch.V1";
31
+ option ruby_package = "Temporalio::Api::Batch::V1";
32
+ option csharp_namespace = "Temporalio.Api.Batch.V1";
33
33
 
34
34
  import "dependencies/gogoproto/gogo.proto";
35
35
  import "google/protobuf/timestamp.proto";
@@ -53,12 +53,10 @@ message BatchOperationInfo {
53
53
  // Keep the parameter in sync with temporal.api.workflowservice.v1.TerminateWorkflowExecutionRequest.
54
54
  // Ignore first_execution_run_id because this is used for single workflow operation.
55
55
  message BatchOperationTermination {
56
- // Reason of terminate workflows
57
- string reason = 1;
58
56
  // Serialized value(s) to provide to the termination event
59
- temporal.api.common.v1.Payloads details = 2;
57
+ temporal.api.common.v1.Payloads details = 1;
60
58
  // The identity of the worker/client
61
- string identity = 3;
59
+ string identity = 2;
62
60
  }
63
61
 
64
62
  // BatchOperationSignal sends signals to batch workflows.
@@ -79,8 +77,13 @@ message BatchOperationSignal {
79
77
  // Keep the parameter in sync with temporal.api.workflowservice.v1.RequestCancelWorkflowExecutionRequest.
80
78
  // Ignore first_execution_run_id because this is used for single workflow operation.
81
79
  message BatchOperationCancellation {
82
- // Reason of cancel workflows
83
- string reason = 1;
84
80
  // The identity of the worker/client
85
- string identity = 2;
81
+ string identity = 1;
82
+ }
83
+
84
+ // BatchOperationDeletion sends deletion requests to batch workflows.
85
+ // Keep the parameter in sync with temporal.api.workflowservice.v1.DeleteWorkflowExecutionRequest.
86
+ message BatchOperationDeletion {
87
+ // The identity of the worker/client
88
+ string identity = 1;
86
89
  }