temporalio 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (119) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -0
  3. data/Cargo.lock +659 -370
  4. data/Cargo.toml +2 -2
  5. data/Gemfile +3 -3
  6. data/README.md +589 -47
  7. data/Rakefile +10 -296
  8. data/ext/Cargo.toml +1 -0
  9. data/lib/temporalio/activity/complete_async_error.rb +1 -1
  10. data/lib/temporalio/activity/context.rb +5 -2
  11. data/lib/temporalio/activity/definition.rb +163 -65
  12. data/lib/temporalio/activity/info.rb +22 -21
  13. data/lib/temporalio/activity.rb +2 -59
  14. data/lib/temporalio/api/activity/v1/message.rb +25 -0
  15. data/lib/temporalio/api/cloud/account/v1/message.rb +28 -0
  16. data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +34 -1
  17. data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +1 -1
  18. data/lib/temporalio/api/cloud/identity/v1/message.rb +6 -1
  19. data/lib/temporalio/api/cloud/namespace/v1/message.rb +8 -1
  20. data/lib/temporalio/api/cloud/nexus/v1/message.rb +31 -0
  21. data/lib/temporalio/api/cloud/operation/v1/message.rb +2 -1
  22. data/lib/temporalio/api/cloud/region/v1/message.rb +2 -1
  23. data/lib/temporalio/api/cloud/resource/v1/message.rb +23 -0
  24. data/lib/temporalio/api/cloud/sink/v1/message.rb +24 -0
  25. data/lib/temporalio/api/cloud/usage/v1/message.rb +31 -0
  26. data/lib/temporalio/api/common/v1/message.rb +7 -1
  27. data/lib/temporalio/api/enums/v1/event_type.rb +1 -1
  28. data/lib/temporalio/api/enums/v1/failed_cause.rb +1 -1
  29. data/lib/temporalio/api/enums/v1/reset.rb +1 -1
  30. data/lib/temporalio/api/history/v1/message.rb +1 -1
  31. data/lib/temporalio/api/nexus/v1/message.rb +2 -2
  32. data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
  33. data/lib/temporalio/api/payload_visitor.rb +1513 -0
  34. data/lib/temporalio/api/schedule/v1/message.rb +2 -1
  35. data/lib/temporalio/api/testservice/v1/request_response.rb +31 -0
  36. data/lib/temporalio/api/testservice/v1/service.rb +23 -0
  37. data/lib/temporalio/api/workflow/v1/message.rb +1 -1
  38. data/lib/temporalio/api/workflowservice/v1/request_response.rb +17 -2
  39. data/lib/temporalio/api/workflowservice/v1/service.rb +1 -1
  40. data/lib/temporalio/api.rb +1 -0
  41. data/lib/temporalio/cancellation.rb +34 -14
  42. data/lib/temporalio/client/async_activity_handle.rb +12 -37
  43. data/lib/temporalio/client/connection/cloud_service.rb +309 -231
  44. data/lib/temporalio/client/connection/operator_service.rb +36 -84
  45. data/lib/temporalio/client/connection/service.rb +6 -5
  46. data/lib/temporalio/client/connection/test_service.rb +111 -0
  47. data/lib/temporalio/client/connection/workflow_service.rb +264 -441
  48. data/lib/temporalio/client/connection.rb +90 -44
  49. data/lib/temporalio/client/interceptor.rb +160 -60
  50. data/lib/temporalio/client/schedule.rb +967 -0
  51. data/lib/temporalio/client/schedule_handle.rb +126 -0
  52. data/lib/temporalio/client/workflow_execution.rb +7 -10
  53. data/lib/temporalio/client/workflow_handle.rb +38 -95
  54. data/lib/temporalio/client/workflow_update_handle.rb +3 -5
  55. data/lib/temporalio/client.rb +122 -42
  56. data/lib/temporalio/common_enums.rb +17 -0
  57. data/lib/temporalio/converters/data_converter.rb +4 -7
  58. data/lib/temporalio/converters/failure_converter.rb +5 -3
  59. data/lib/temporalio/converters/payload_converter/composite.rb +4 -0
  60. data/lib/temporalio/converters/payload_converter.rb +6 -8
  61. data/lib/temporalio/converters/raw_value.rb +20 -0
  62. data/lib/temporalio/error/failure.rb +1 -1
  63. data/lib/temporalio/error.rb +10 -2
  64. data/lib/temporalio/internal/bridge/api/core_interface.rb +5 -1
  65. data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +33 -0
  66. data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +5 -1
  67. data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +4 -1
  68. data/lib/temporalio/internal/bridge/client.rb +11 -6
  69. data/lib/temporalio/internal/bridge/testing.rb +20 -0
  70. data/lib/temporalio/internal/bridge/worker.rb +2 -0
  71. data/lib/temporalio/internal/bridge.rb +1 -1
  72. data/lib/temporalio/internal/client/implementation.rb +245 -70
  73. data/lib/temporalio/internal/metric.rb +122 -0
  74. data/lib/temporalio/internal/proto_utils.rb +86 -7
  75. data/lib/temporalio/internal/worker/activity_worker.rb +52 -24
  76. data/lib/temporalio/internal/worker/multi_runner.rb +51 -7
  77. data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +54 -0
  78. data/lib/temporalio/internal/worker/workflow_instance/context.rb +329 -0
  79. data/lib/temporalio/internal/worker/workflow_instance/details.rb +44 -0
  80. data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +32 -0
  81. data/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb +22 -0
  82. data/lib/temporalio/internal/worker/workflow_instance/handler_execution.rb +25 -0
  83. data/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb +41 -0
  84. data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +97 -0
  85. data/lib/temporalio/internal/worker/workflow_instance/inbound_implementation.rb +62 -0
  86. data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +415 -0
  87. data/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb +37 -0
  88. data/lib/temporalio/internal/worker/workflow_instance/replay_safe_metric.rb +40 -0
  89. data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +163 -0
  90. data/lib/temporalio/internal/worker/workflow_instance.rb +730 -0
  91. data/lib/temporalio/internal/worker/workflow_worker.rb +196 -0
  92. data/lib/temporalio/metric.rb +109 -0
  93. data/lib/temporalio/retry_policy.rb +37 -14
  94. data/lib/temporalio/runtime.rb +118 -75
  95. data/lib/temporalio/search_attributes.rb +80 -37
  96. data/lib/temporalio/testing/activity_environment.rb +2 -2
  97. data/lib/temporalio/testing/workflow_environment.rb +251 -5
  98. data/lib/temporalio/version.rb +1 -1
  99. data/lib/temporalio/worker/activity_executor/thread_pool.rb +9 -217
  100. data/lib/temporalio/worker/activity_executor.rb +3 -3
  101. data/lib/temporalio/worker/interceptor.rb +340 -66
  102. data/lib/temporalio/worker/thread_pool.rb +237 -0
  103. data/lib/temporalio/worker/workflow_executor/thread_pool.rb +230 -0
  104. data/lib/temporalio/worker/workflow_executor.rb +26 -0
  105. data/lib/temporalio/worker.rb +201 -30
  106. data/lib/temporalio/workflow/activity_cancellation_type.rb +20 -0
  107. data/lib/temporalio/workflow/child_workflow_cancellation_type.rb +21 -0
  108. data/lib/temporalio/workflow/child_workflow_handle.rb +43 -0
  109. data/lib/temporalio/workflow/definition.rb +566 -0
  110. data/lib/temporalio/workflow/external_workflow_handle.rb +41 -0
  111. data/lib/temporalio/workflow/future.rb +151 -0
  112. data/lib/temporalio/workflow/handler_unfinished_policy.rb +13 -0
  113. data/lib/temporalio/workflow/info.rb +82 -0
  114. data/lib/temporalio/workflow/parent_close_policy.rb +19 -0
  115. data/lib/temporalio/workflow/update_info.rb +20 -0
  116. data/lib/temporalio/workflow.rb +523 -0
  117. data/lib/temporalio.rb +4 -0
  118. data/temporalio.gemspec +2 -2
  119. metadata +50 -8
@@ -6,6 +6,8 @@ require 'temporalio/api'
6
6
  require 'temporalio/client/async_activity_handle'
7
7
  require 'temporalio/client/connection'
8
8
  require 'temporalio/client/interceptor'
9
+ require 'temporalio/client/schedule'
10
+ require 'temporalio/client/schedule_handle'
9
11
  require 'temporalio/client/workflow_execution'
10
12
  require 'temporalio/client/workflow_execution_count'
11
13
  require 'temporalio/client/workflow_handle'
@@ -17,6 +19,7 @@ require 'temporalio/internal/client/implementation'
17
19
  require 'temporalio/retry_policy'
18
20
  require 'temporalio/runtime'
19
21
  require 'temporalio/search_attributes'
22
+ require 'temporalio/workflow/definition'
20
23
 
21
24
  module Temporalio
22
25
  # Client for accessing Temporal.
@@ -30,17 +33,18 @@ module Temporalio
30
33
  # synchronous and asynchronous contexts. Internally they use callbacks based on {::Queue} which means they are
31
34
  # Fiber-compatible.
32
35
  class Client
33
- # Options as returned from {options} for +**to_h+ splat use in {initialize}. See {initialize} for details.
34
- Options = Struct.new(
36
+ Options = Data.define(
35
37
  :connection,
36
38
  :namespace,
37
39
  :data_converter,
38
40
  :interceptors,
39
41
  :logger,
40
- :default_workflow_query_reject_condition,
41
- keyword_init: true
42
+ :default_workflow_query_reject_condition
42
43
  )
43
44
 
45
+ # Options as returned from {options} for +**to_h+ splat use in {initialize}. See {initialize} for details.
46
+ class Options; end # rubocop:disable Lint/EmptyClass
47
+
44
48
  # Connect to Temporal server. This is a shortcut for +Connection.new+ followed by +Client.new+.
45
49
  #
46
50
  # @param target_host [String] +host:port+ for the Temporal server. For local development, this is often
@@ -183,7 +187,7 @@ module Temporalio
183
187
 
184
188
  # Start a workflow and return its handle.
185
189
  #
186
- # @param workflow [Workflow, String] Name of the workflow
190
+ # @param workflow [Class<Workflow::Definition>, String, Symbol] Workflow definition class or workflow name.
187
191
  # @param args [Array<Object>] Arguments to the workflow.
188
192
  # @param id [String] Unique identifier for the workflow execution.
189
193
  # @param task_queue [String] Task queue to run the workflow on.
@@ -197,14 +201,13 @@ module Temporalio
197
201
  # is set to terminate if running.
198
202
  # @param retry_policy [RetryPolicy, nil] Retry policy for the workflow.
199
203
  # @param cron_schedule [String, nil] Cron schedule. Users should use schedules instead of this.
200
- # @param memo [Hash<String, Object>, nil] Memo for the workflow.
204
+ # @param memo [Hash{String, Symbol => Object}, nil] Memo for the workflow.
201
205
  # @param search_attributes [SearchAttributes, nil] Search attributes for the workflow.
202
206
  # @param start_delay [Float, nil] Amount of time in seconds to wait before starting the workflow. This does not work
203
207
  # with `cron_schedule`.
204
208
  # @param request_eager_start [Boolean] Potentially reduce the latency to start this workflow by encouraging the
205
209
  # server to start it on a local worker running with this same client. This is currently experimental.
206
- # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
207
- # @param rpc_timeout [Float, nil] Number of seconds before timeout.
210
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
208
211
  #
209
212
  # @return [WorkflowHandle] A workflow handle to the started workflow.
210
213
  # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists.
@@ -225,8 +228,7 @@ module Temporalio
225
228
  search_attributes: nil,
226
229
  start_delay: nil,
227
230
  request_eager_start: false,
228
- rpc_metadata: nil,
229
- rpc_timeout: nil
231
+ rpc_options: nil
230
232
  )
231
233
  @impl.start_workflow(Interceptor::StartWorkflowInput.new(
232
234
  workflow:,
@@ -245,14 +247,13 @@ module Temporalio
245
247
  start_delay:,
246
248
  request_eager_start:,
247
249
  headers: {},
248
- rpc_metadata:,
249
- rpc_timeout:
250
+ rpc_options:
250
251
  ))
251
252
  end
252
253
 
253
254
  # Start a workflow and wait for its result. This is a shortcut for {start_workflow} + {WorkflowHandle.result}.
254
255
  #
255
- # @param workflow [Workflow, String] Name of the workflow
256
+ # @param workflow [Class<Workflow::Definition>, Symbol, String] Workflow definition class or workflow name.
256
257
  # @param args [Array<Object>] Arguments to the workflow.
257
258
  # @param id [String] Unique identifier for the workflow execution.
258
259
  # @param task_queue [String] Task queue to run the workflow on.
@@ -266,14 +267,13 @@ module Temporalio
266
267
  # is set to terminate if running.
267
268
  # @param retry_policy [RetryPolicy, nil] Retry policy for the workflow.
268
269
  # @param cron_schedule [String, nil] Cron schedule. Users should use schedules instead of this.
269
- # @param memo [Hash<String, Object>, nil] Memo for the workflow.
270
+ # @param memo [Hash{String, Symbol => Object}, nil] Memo for the workflow.
270
271
  # @param search_attributes [SearchAttributes, nil] Search attributes for the workflow.
271
272
  # @param start_delay [Float, nil] Amount of time in seconds to wait before starting the workflow. This does not work
272
273
  # with `cron_schedule`.
273
274
  # @param request_eager_start [Boolean] Potentially reduce the latency to start this workflow by encouraging the
274
275
  # server to start it on a local worker running with this same client. This is currently experimental.
275
- # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
276
- # @param rpc_timeout [Float, nil] Number of seconds before timeout.
276
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
277
277
  #
278
278
  # @return [Object] Successful result of the workflow.
279
279
  # @raise [Error::WorkflowAlreadyStartedError] Workflow already exists.
@@ -295,8 +295,7 @@ module Temporalio
295
295
  search_attributes: nil,
296
296
  start_delay: nil,
297
297
  request_eager_start: false,
298
- rpc_metadata: nil,
299
- rpc_timeout: nil
298
+ rpc_options: nil
300
299
  )
301
300
  start_workflow(
302
301
  workflow,
@@ -314,8 +313,7 @@ module Temporalio
314
313
  search_attributes:,
315
314
  start_delay:,
316
315
  request_eager_start:,
317
- rpc_metadata:,
318
- rpc_timeout:
316
+ rpc_options:
319
317
  ).result
320
318
  end
321
319
 
@@ -339,49 +337,92 @@ module Temporalio
339
337
  # List workflows.
340
338
  #
341
339
  # @param query [String, nil] A Temporal visibility list filter.
342
- # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
343
- # @param rpc_timeout [Float, nil] Number of seconds before timeout.
340
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
344
341
  #
345
342
  # @return [Enumerator<WorkflowExecution>] Enumerable workflow executions.
346
343
  #
347
344
  # @raise [Error::RPCError] RPC error from call.
348
345
  #
349
346
  # @see https://docs.temporal.io/visibility
350
- def list_workflows(
351
- query = nil,
352
- rpc_metadata: nil,
353
- rpc_timeout: nil
354
- )
355
- @impl.list_workflows(Interceptor::ListWorkflowsInput.new(
356
- query:,
357
- rpc_metadata:,
358
- rpc_timeout:
359
- ))
347
+ def list_workflows(query = nil, rpc_options: nil)
348
+ @impl.list_workflows(Interceptor::ListWorkflowsInput.new(query:, rpc_options:))
360
349
  end
361
350
 
362
351
  # Count workflows.
363
352
  #
364
353
  # @param query [String, nil] A Temporal visibility list filter.
365
- # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
366
- # @param rpc_timeout [Float, nil] Number of seconds before timeout.
354
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
367
355
  #
368
356
  # @return [WorkflowExecutionCount] Count of workflows.
369
357
  #
370
358
  # @raise [Error::RPCError] RPC error from call.
371
359
  #
372
360
  # @see https://docs.temporal.io/visibility
373
- def count_workflows(
374
- query = nil,
375
- rpc_metadata: nil,
376
- rpc_timeout: nil
361
+ def count_workflows(query = nil, rpc_options: nil)
362
+ @impl.count_workflows(Interceptor::CountWorkflowsInput.new(query:, rpc_options:))
363
+ end
364
+
365
+ # Create a schedule and return its handle.
366
+ #
367
+ # @param id [String] Unique identifier of the schedule.
368
+ # @param schedule [Schedule] Schedule to create.
369
+ # @param trigger_immediately [Boolean] If true, trigger one action immediately when creating the schedule.
370
+ # @param backfills [Array<Schedule::Backfill>] Set of time periods to take actions on as if that time passed right
371
+ # now.
372
+ # @param memo [Hash<String, Object>, nil] Memo for the schedule. Memo for a scheduled workflow is part of the
373
+ # schedule action.
374
+ # @param search_attributes [SearchAttributes, nil] Search attributes for the schedule. Search attributes for a
375
+ # scheduled workflow are part of the scheduled action.
376
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
377
+ #
378
+ # @return [ScheduleHandle] A handle to the created schedule.
379
+ # @raise [Error::ScheduleAlreadyRunningError] If a schedule with this ID is already running.
380
+ # @raise [Error::RPCError] RPC error from call.
381
+ def create_schedule(
382
+ id,
383
+ schedule,
384
+ trigger_immediately: false,
385
+ backfills: [],
386
+ memo: nil,
387
+ search_attributes: nil,
388
+ rpc_options: nil
377
389
  )
378
- @impl.count_workflows(Interceptor::CountWorkflowsInput.new(
379
- query:,
380
- rpc_metadata:,
381
- rpc_timeout:
390
+ @impl.create_schedule(Interceptor::CreateScheduleInput.new(
391
+ id:,
392
+ schedule:,
393
+ trigger_immediately:,
394
+ backfills:,
395
+ memo:,
396
+ search_attributes:,
397
+ rpc_options:
382
398
  ))
383
399
  end
384
400
 
401
+ # Get a schedule handle to an existing schedule for the given ID.
402
+ #
403
+ # @param id [String] Schedule ID to get a handle to.
404
+ # @return [ScheduleHandle] The schedule handle.
405
+ def schedule_handle(id)
406
+ ScheduleHandle.new(client: self, id:)
407
+ end
408
+
409
+ # List schedules.
410
+ #
411
+ # Note, this list is eventually consistent. Therefore if a schedule is added or deleted, it may not be available in
412
+ # the list immediately.
413
+ #
414
+ # @param query [String] A Temporal visibility list filter.
415
+ # @param rpc_options [RPCOptions, nil] Advanced RPC options.
416
+ #
417
+ # @return [Enumerator<Schedule::List::Description>] Enumerable schedules.
418
+ #
419
+ # @raise [Error::RPCError] RPC error from call.
420
+ #
421
+ # @see https://docs.temporal.io/visibility
422
+ def list_schedules(query = nil, rpc_options: nil)
423
+ @impl.list_schedules(Interceptor::ListSchedulesInput.new(query:, rpc_options:))
424
+ end
425
+
385
426
  # Get an async activity handle.
386
427
  #
387
428
  # @param task_token_or_id_reference [String, ActivityIDReference] Task token string or activity ID reference.
@@ -400,5 +441,44 @@ module Temporalio
400
441
  def _impl
401
442
  @impl
402
443
  end
444
+
445
+ # Set of RPC options for RPC calls.
446
+ class RPCOptions
447
+ # @return [Hash<String, String>, nil] Headers to include on the RPC call.
448
+ attr_accessor :metadata
449
+
450
+ # @return [Float, nil] Number of seconds before timeout of the RPC call.
451
+ attr_accessor :timeout
452
+
453
+ # @return [Cancellation, nil] Cancellation to use to potentially cancel the call. If canceled, the RPC will return
454
+ # {Error::CanceledError}.
455
+ attr_accessor :cancellation
456
+
457
+ # @return [Boolean, nil] Whether to override the default retry option which decides whether to retry calls
458
+ # implicitly when known transient error codes are reached. By default when this is nil, high-level calls retry
459
+ # known transient error codes and low-level/direct calls do not.
460
+ attr_accessor :override_retry
461
+
462
+ # Create RPC options.
463
+ #
464
+ # @param metadata [Hash<String, String>, nil] Headers to include on the RPC call.
465
+ # @param timeout [Float, nil] Number of seconds before timeout of the RPC call.
466
+ # @param cancellation [Cancellation, nil] Cancellation to use to potentially cancel the call. If canceled, the RPC
467
+ # will return {Error::CanceledError}.
468
+ # @param override_retry [Boolean, nil] Whether to override the default retry option which decides whether to retry
469
+ # calls implicitly when known transient error codes are reached. By default when this is nil, high-level calls
470
+ # retry known transient error codes and low-level/direct calls do not.
471
+ def initialize(
472
+ metadata: nil,
473
+ timeout: nil,
474
+ cancellation: nil,
475
+ override_retry: nil
476
+ )
477
+ @metadata = metadata
478
+ @timeout = timeout
479
+ @cancellation = cancellation
480
+ @override_retry = override_retry
481
+ end
482
+ end
403
483
  end
404
484
  end
@@ -7,18 +7,35 @@ module Temporalio
7
7
  #
8
8
  # @see https://docs.temporal.io/workflows#workflow-id-reuse-policy
9
9
  module WorkflowIDReusePolicy
10
+ # Allow starting a workflow execution using the same workflow ID.
10
11
  ALLOW_DUPLICATE = Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE
12
+ # Allow starting a workflow execution using the same workflow ID, only when the last execution's final state is one
13
+ # of terminated, canceled, timed out, or failed.
11
14
  ALLOW_DUPLICATE_FAILED_ONLY =
12
15
  Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_ALLOW_DUPLICATE_FAILED_ONLY
16
+ # Do not permit re-use of the workflow ID for this workflow. Future start workflow requests could potentially change
17
+ # the policy, allowing re-use of the workflow ID.
13
18
  REJECT_DUPLICATE = Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_REJECT_DUPLICATE
19
+ # This option is {WorkflowIDConflictPolicy::TERMINATE_EXISTING} but is here for backwards compatibility. If
20
+ # specified, it acts like {ALLOW_DUPLICATE}, but also the {WorkflowIDConflictPolicy} on the request is treated as
21
+ # {WorkflowIDConflictPolicy::TERMINATE_EXISTING}. If no running workflow, then the behavior is the same as
22
+ # {ALLOW_DUPLICATE}.
23
+ #
24
+ # @deprecated Use {WorkflowIDConflictPolicy::TERMINATE_EXISTING} instead.
14
25
  TERMINATE_IF_RUNNING = Api::Enums::V1::WorkflowIdReusePolicy::WORKFLOW_ID_REUSE_POLICY_TERMINATE_IF_RUNNING
15
26
  end
16
27
 
17
28
  # How already-running workflows of the same ID are handled on start.
29
+ #
30
+ # @see https://docs.temporal.io/workflows#workflow-id-conflict-policy
18
31
  module WorkflowIDConflictPolicy
32
+ # Unset.
19
33
  UNSPECIFIED = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_UNSPECIFIED
34
+ # Don't start a new workflow, instead fail with already-started error.
20
35
  FAIL = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_FAIL
36
+ # Don't start a new workflow, instead return a workflow handle for the running workflow.
21
37
  USE_EXISTING = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_USE_EXISTING
38
+ # Terminate the running workflow before starting a new one.
22
39
  TERMINATE_EXISTING = Api::Enums::V1::WorkflowIdConflictPolicy::WORKFLOW_ID_CONFLICT_POLICY_TERMINATE_EXISTING
23
40
  end
24
41
  end
@@ -8,10 +8,10 @@ module Temporalio
8
8
  module Converters
9
9
  # Data converter for converting/encoding payloads to/from Ruby values.
10
10
  class DataConverter
11
- # @return [PayloadConverter] Payload converter. This must be Ractor shareable.
11
+ # @return [PayloadConverter] Payload converter.
12
12
  attr_reader :payload_converter
13
13
 
14
- # @return [FailureConverter] Failure converter. This must be Ractor shareable.
14
+ # @return [FailureConverter] Failure converter.
15
15
  attr_reader :failure_converter
16
16
 
17
17
  # @return [PayloadCodec, nil] Optional codec for encoding/decoding payload bytes such as for encryption.
@@ -24,17 +24,14 @@ module Temporalio
24
24
 
25
25
  # Create data converter.
26
26
  #
27
- # @param payload_converter [PayloadConverter] Payload converter to use. This must be Ractor shareable.
28
- # @param failure_converter [FailureConverter] Failure converter to use. This must be Ractor shareable.
27
+ # @param payload_converter [PayloadConverter] Payload converter to use.
28
+ # @param failure_converter [FailureConverter] Failure converter to use.
29
29
  # @param payload_codec [PayloadCodec, nil] Payload codec to use.
30
30
  def initialize(
31
31
  payload_converter: PayloadConverter.default,
32
32
  failure_converter: FailureConverter.default,
33
33
  payload_codec: nil
34
34
  )
35
- raise 'Payload converter not shareable' unless Ractor.shareable?(payload_converter)
36
- raise 'Failure converter not shareable' unless Ractor.shareable?(failure_converter)
37
-
38
35
  @payload_converter = payload_converter
39
36
  @failure_converter = failure_converter
40
37
  @payload_codec = payload_codec
@@ -10,7 +10,7 @@ module Temporalio
10
10
  class FailureConverter
11
11
  # @return [FailureConverter] Default failure converter.
12
12
  def self.default
13
- @default ||= Ractor.make_shareable(FailureConverter.new)
13
+ @default ||= FailureConverter.new
14
14
  end
15
15
 
16
16
  # @return [Boolean] If +true+, the message and stack trace of the failure will be moved into the encoded attribute
@@ -85,7 +85,7 @@ module Temporalio
85
85
  )
86
86
  else
87
87
  failure.application_failure_info = Api::Failure::V1::ApplicationFailureInfo.new(
88
- type: error.class.name.split('::').last
88
+ type: error.class.name
89
89
  )
90
90
  end
91
91
 
@@ -130,7 +130,9 @@ module Temporalio
130
130
  *converter.from_payloads(failure.application_failure_info.details),
131
131
  type: Internal::ProtoUtils.string_or(failure.application_failure_info.type),
132
132
  non_retryable: failure.application_failure_info.non_retryable,
133
- next_retry_delay: failure.application_failure_info.next_retry_delay&.to_f
133
+ next_retry_delay: Internal::ProtoUtils.duration_to_seconds(
134
+ failure.application_failure_info.next_retry_delay
135
+ )
134
136
  )
135
137
  elsif failure.timeout_failure_info
136
138
  Error::TimeoutError.new(
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'temporalio/api'
4
4
  require 'temporalio/converters/payload_converter'
5
+ require 'temporalio/converters/raw_value'
5
6
 
6
7
  module Temporalio
7
8
  module Converters
@@ -34,6 +35,9 @@ module Temporalio
34
35
  # @return [Api::Common::V1::Payload] Converted payload.
35
36
  # @raise [ConverterNotFound] If no converters can process the value.
36
37
  def to_payload(value)
38
+ # As a special case, raw values just return the payload within
39
+ return value.payload if value.is_a?(RawValue)
40
+
37
41
  converters.each_value do |converter|
38
42
  payload = converter.to_payload(value)
39
43
  return payload unless payload.nil?
@@ -22,14 +22,12 @@ module Temporalio
22
22
  # @param json_generate_options [Hash] Options for {::JSON.generate}.
23
23
  # @return [PayloadConverter::Composite] Created payload converter.
24
24
  def self.new_with_defaults(json_parse_options: { create_additions: true }, json_generate_options: {})
25
- Ractor.make_shareable(
26
- PayloadConverter::Composite.new(
27
- PayloadConverter::BinaryNull.new,
28
- PayloadConverter::BinaryPlain.new,
29
- PayloadConverter::JSONProtobuf.new,
30
- PayloadConverter::BinaryProtobuf.new,
31
- PayloadConverter::JSONPlain.new(parse_options: json_parse_options, generate_options: json_generate_options)
32
- )
25
+ PayloadConverter::Composite.new(
26
+ PayloadConverter::BinaryNull.new,
27
+ PayloadConverter::BinaryPlain.new,
28
+ PayloadConverter::JSONProtobuf.new,
29
+ PayloadConverter::BinaryProtobuf.new,
30
+ PayloadConverter::JSONPlain.new(parse_options: json_parse_options, generate_options: json_generate_options)
33
31
  )
34
32
  end
35
33
 
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Temporalio
4
+ module Converters
5
+ # Raw value wrapper that has the raw payload. When raw args are configured at implementation time, the inbound
6
+ # arguments will be instances of this class. When instances of this class are sent outbound or returned from
7
+ # inbound calls, the raw payload will be serialized instead of applying traditional conversion.
8
+ class RawValue
9
+ # @return [Api::Common::V1::Payload] Payload.
10
+ attr_reader :payload
11
+
12
+ # Create a raw value.
13
+ #
14
+ # @param payload [Api::Common::V1::Payload] Payload.
15
+ def initialize(payload)
16
+ @payload = payload
17
+ end
18
+ end
19
+ end
20
+ end
@@ -17,7 +17,7 @@ module Temporalio
17
17
  # @return [String] Workflow type name of the already-started workflow.
18
18
  attr_reader :workflow_type
19
19
 
20
- # @return [String] Run ID of the already-started workflow if this was raised by the client.
20
+ # @return [String, nil] Run ID of the already-started workflow if this was raised by the client.
21
21
  attr_reader :run_id
22
22
 
23
23
  # @!visibility private
@@ -35,8 +35,8 @@ module Temporalio
35
35
  # Error that is returned from when a workflow is unsuccessful.
36
36
  class WorkflowFailedError < Error
37
37
  # @!visibility private
38
- def initialize
39
- super('Workflow failed')
38
+ def initialize(message = 'Workflow execution failed')
39
+ super
40
40
  end
41
41
  end
42
42
 
@@ -87,6 +87,14 @@ module Temporalio
87
87
  end
88
88
  end
89
89
 
90
+ # Error when a schedule is already running.
91
+ class ScheduleAlreadyRunningError < Error
92
+ # @!visibility private
93
+ def initialize
94
+ super('Schedule already running')
95
+ end
96
+ end
97
+
90
98
  # Error that occurs when an async activity handle tries to heartbeat and the activity is marked as canceled.
91
99
  class AsyncActivityCanceledError < Error
92
100
  # @!visibility private
@@ -17,7 +17,7 @@ require 'temporalio/internal/bridge/api/workflow_commands/workflow_commands'
17
17
  require 'temporalio/internal/bridge/api/workflow_completion/workflow_completion'
18
18
 
19
19
 
20
- descriptor_data = "\n&temporal/sdk/core/core_interface.proto\x12\x07\x63oresdk\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a$temporal/api/common/v1/message.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x33temporal/sdk/core/activity_task/activity_task.proto\x1a%temporal/sdk/core/common/common.proto\x1a\x33temporal/sdk/core/external_data/external_data.proto\x1a?temporal/sdk/core/workflow_activation/workflow_activation.proto\x1a;temporal/sdk/core/workflow_commands/workflow_commands.proto\x1a?temporal/sdk/core/workflow_completion/workflow_completion.proto\"Y\n\x11\x41\x63tivityHeartbeat\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x30\n\x07\x64\x65tails\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\"n\n\x16\x41\x63tivityTaskCompletion\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12@\n\x06result\x18\x02 \x01(\x0b\x32\x30.coresdk.activity_result.ActivityExecutionResultB3\xea\x02\x30Temporalio::Internal::Bridge::Api::CoreInterfaceb\x06proto3"
20
+ descriptor_data = "\n&temporal/sdk/core/core_interface.proto\x12\x07\x63oresdk\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a$temporal/api/common/v1/message.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x33temporal/sdk/core/activity_task/activity_task.proto\x1a%temporal/sdk/core/common/common.proto\x1a\x33temporal/sdk/core/external_data/external_data.proto\x1a?temporal/sdk/core/workflow_activation/workflow_activation.proto\x1a;temporal/sdk/core/workflow_commands/workflow_commands.proto\x1a?temporal/sdk/core/workflow_completion/workflow_completion.proto\"Y\n\x11\x41\x63tivityHeartbeat\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x30\n\x07\x64\x65tails\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\"n\n\x16\x41\x63tivityTaskCompletion\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12@\n\x06result\x18\x02 \x01(\x0b\x32\x30.coresdk.activity_result.ActivityExecutionResult\"<\n\x10WorkflowSlotInfo\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x11\n\tis_sticky\x18\x02 \x01(\x08\")\n\x10\x41\x63tivitySlotInfo\x12\x15\n\ractivity_type\x18\x01 \x01(\t\".\n\x15LocalActivitySlotInfo\x12\x15\n\ractivity_type\x18\x01 \x01(\t\"3\n\rNexusSlotInfo\x12\x0f\n\x07service\x18\x01 \x01(\t\x12\x11\n\toperation\x18\x02 \x01(\tB3\xea\x02\x30Temporalio::Internal::Bridge::Api::CoreInterfaceb\x06proto3"
21
21
 
22
22
  pool = Google::Protobuf::DescriptorPool.generated_pool
23
23
  pool.add_serialized_file(descriptor_data)
@@ -29,6 +29,10 @@ module Temporalio
29
29
  module CoreInterface
30
30
  ActivityHeartbeat = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.ActivityHeartbeat").msgclass
31
31
  ActivityTaskCompletion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.ActivityTaskCompletion").msgclass
32
+ WorkflowSlotInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.WorkflowSlotInfo").msgclass
33
+ ActivitySlotInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.ActivitySlotInfo").msgclass
34
+ LocalActivitySlotInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.LocalActivitySlotInfo").msgclass
35
+ NexusSlotInfo = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.NexusSlotInfo").msgclass
32
36
  end
33
37
  end
34
38
  end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: temporal/sdk/core/nexus/nexus.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'temporalio/api/common/v1/message'
8
+ require 'temporalio/api/failure/v1/message'
9
+ require 'temporalio/api/nexus/v1/message'
10
+ require 'temporalio/api/workflowservice/v1/request_response'
11
+ require 'temporalio/internal/bridge/api/common/common'
12
+
13
+
14
+ descriptor_data = "\n#temporal/sdk/core/nexus/nexus.proto\x12\rcoresdk.nexus\x1a$temporal/api/common/v1/message.proto\x1a%temporal/api/failure/v1/message.proto\x1a#temporal/api/nexus/v1/message.proto\x1a\x36temporal/api/workflowservice/v1/request_response.proto\x1a%temporal/sdk/core/common/common.proto\"\xf8\x01\n\x14NexusOperationResult\x12\x34\n\tcompleted\x18\x01 \x01(\x0b\x32\x1f.temporal.api.common.v1.PayloadH\x00\x12\x32\n\x06\x66\x61iled\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x12\x35\n\tcancelled\x18\x03 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x12\x35\n\ttimed_out\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\x08\n\x06status\"\xb5\x01\n\x13NexusTaskCompletion\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x34\n\tcompleted\x18\x02 \x01(\x0b\x32\x1f.temporal.api.nexus.v1.ResponseH\x00\x12\x34\n\x05\x65rror\x18\x03 \x01(\x0b\x32#.temporal.api.nexus.v1.HandlerErrorH\x00\x12\x14\n\nack_cancel\x18\x04 \x01(\x08H\x00\x42\x08\n\x06status\"\x9a\x01\n\tNexusTask\x12K\n\x04task\x18\x01 \x01(\x0b\x32;.temporal.api.workflowservice.v1.PollNexusTaskQueueResponseH\x00\x12\x35\n\x0b\x63\x61ncel_task\x18\x02 \x01(\x0b\x32\x1e.coresdk.nexus.CancelNexusTaskH\x00\x42\t\n\x07variant\"[\n\x0f\x43\x61ncelNexusTask\x12\x12\n\ntask_token\x18\x01 \x01(\x0c\x12\x34\n\x06reason\x18\x02 \x01(\x0e\x32$.coresdk.nexus.NexusTaskCancelReason*;\n\x15NexusTaskCancelReason\x12\r\n\tTIMED_OUT\x10\x00\x12\x13\n\x0fWORKER_SHUTDOWN\x10\x01\x42+\xea\x02(Temporalio::Internal::Bridge::Api::Nexusb\x06proto3"
15
+
16
+ pool = Google::Protobuf::DescriptorPool.generated_pool
17
+ pool.add_serialized_file(descriptor_data)
18
+
19
+ module Temporalio
20
+ module Internal
21
+ module Bridge
22
+ module Api
23
+ module Nexus
24
+ NexusOperationResult = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.nexus.NexusOperationResult").msgclass
25
+ NexusTaskCompletion = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.nexus.NexusTaskCompletion").msgclass
26
+ NexusTask = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.nexus.NexusTask").msgclass
27
+ CancelNexusTask = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.nexus.CancelNexusTask").msgclass
28
+ NexusTaskCancelReason = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.nexus.NexusTaskCancelReason").enummodule
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -6,6 +6,7 @@ require 'google/protobuf'
6
6
 
7
7
  require 'google/protobuf/timestamp_pb'
8
8
  require 'google/protobuf/duration_pb'
9
+ require 'google/protobuf/empty_pb'
9
10
  require 'temporalio/api/failure/v1/message'
10
11
  require 'temporalio/api/update/v1/message'
11
12
  require 'temporalio/api/common/v1/message'
@@ -13,9 +14,10 @@ require 'temporalio/api/enums/v1/workflow'
13
14
  require 'temporalio/internal/bridge/api/activity_result/activity_result'
14
15
  require 'temporalio/internal/bridge/api/child_workflow/child_workflow'
15
16
  require 'temporalio/internal/bridge/api/common/common'
17
+ require 'temporalio/internal/bridge/api/nexus/nexus'
16
18
 
17
19
 
18
- descriptor_data = "\n?temporal/sdk/core/workflow_activation/workflow_activation.proto\x12\x1b\x63oresdk.workflow_activation\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a%temporal/sdk/core/common/common.proto\"\xc7\x02\n\x12WorkflowActivation\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cis_replaying\x18\x03 \x01(\x08\x12\x16\n\x0ehistory_length\x18\x04 \x01(\r\x12@\n\x04jobs\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.WorkflowActivationJob\x12 \n\x18\x61vailable_internal_flags\x18\x06 \x03(\r\x12\x1a\n\x12history_size_bytes\x18\x07 \x01(\x04\x12!\n\x19\x63ontinue_as_new_suggested\x18\x08 \x01(\x08\x12!\n\x19\x62uild_id_for_current_task\x18\t \x01(\t\"\xa7\t\n\x15WorkflowActivationJob\x12N\n\x13initialize_workflow\x18\x01 \x01(\x0b\x32/.coresdk.workflow_activation.InitializeWorkflowH\x00\x12<\n\nfire_timer\x18\x02 \x01(\x0b\x32&.coresdk.workflow_activation.FireTimerH\x00\x12K\n\x12update_random_seed\x18\x04 \x01(\x0b\x32-.coresdk.workflow_activation.UpdateRandomSeedH\x00\x12\x44\n\x0equery_workflow\x18\x05 \x01(\x0b\x32*.coresdk.workflow_activation.QueryWorkflowH\x00\x12\x46\n\x0f\x63\x61ncel_workflow\x18\x06 \x01(\x0b\x32+.coresdk.workflow_activation.CancelWorkflowH\x00\x12\x46\n\x0fsignal_workflow\x18\x07 \x01(\x0b\x32+.coresdk.workflow_activation.SignalWorkflowH\x00\x12H\n\x10resolve_activity\x18\x08 \x01(\x0b\x32,.coresdk.workflow_activation.ResolveActivityH\x00\x12G\n\x10notify_has_patch\x18\t \x01(\x0b\x32+.coresdk.workflow_activation.NotifyHasPatchH\x00\x12q\n&resolve_child_workflow_execution_start\x18\n \x01(\x0b\x32?.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartH\x00\x12\x66\n resolve_child_workflow_execution\x18\x0b \x01(\x0b\x32:.coresdk.workflow_activation.ResolveChildWorkflowExecutionH\x00\x12\x66\n resolve_signal_external_workflow\x18\x0c \x01(\x0b\x32:.coresdk.workflow_activation.ResolveSignalExternalWorkflowH\x00\x12u\n(resolve_request_cancel_external_workflow\x18\r \x01(\x0b\x32\x41.coresdk.workflow_activation.ResolveRequestCancelExternalWorkflowH\x00\x12:\n\tdo_update\x18\x0e \x01(\x0b\x32%.coresdk.workflow_activation.DoUpdateH\x00\x12I\n\x11remove_from_cache\x18\x32 \x01(\x0b\x32,.coresdk.workflow_activation.RemoveFromCacheH\x00\x42\t\n\x07variant\"\xe3\t\n\x12InitializeWorkflow\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x17\n\x0frandomness_seed\x18\x04 \x01(\x04\x12M\n\x07headers\x18\x05 \x03(\x0b\x32<.coresdk.workflow_activation.InitializeWorkflow.HeadersEntry\x12\x10\n\x08identity\x18\x06 \x01(\t\x12I\n\x14parent_workflow_info\x18\x07 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12=\n\x1aworkflow_execution_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\'\n\x1f\x63ontinued_from_execution_run_id\x18\x0b \x01(\t\x12J\n\x13\x63ontinued_initiator\x18\x0c \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\r \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1e\n\x16\x66irst_execution_run_id\x18\x0f \x01(\t\x12\x39\n\x0cretry_policy\x18\x10 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x11 \x01(\x05\x12\x15\n\rcron_schedule\x18\x12 \x01(\t\x12\x46\n\"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x45\n\"cron_schedule_to_schedule_interval\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x15 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x16 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\nstart_time\x18\x17 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\x18\n\tFireTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r\"m\n\x0fResolveActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.activity_result.ActivityResolution\x12\x10\n\x08is_local\x18\x03 \x01(\x08\"\xd1\x02\n\"ResolveChildWorkflowExecutionStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12[\n\tsucceeded\x18\x02 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartSuccessH\x00\x12X\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartFailureH\x00\x12]\n\tcancelled\x18\x04 \x01(\x0b\x32H.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelledH\x00\x42\x08\n\x06status\";\n)ResolveChildWorkflowExecutionStartSuccess\x12\x0e\n\x06run_id\x18\x01 \x01(\t\"\xa6\x01\n)ResolveChildWorkflowExecutionStartFailure\x12\x13\n\x0bworkflow_id\x18\x01 \x01(\t\x12\x15\n\rworkflow_type\x18\x02 \x01(\t\x12M\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32>.coresdk.child_workflow.StartChildWorkflowExecutionFailedCause\"`\n+ResolveChildWorkflowExecutionStartCancelled\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"i\n\x1dResolveChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.child_workflow.ChildWorkflowResult\"+\n\x10UpdateRandomSeed\x12\x17\n\x0frandomness_seed\x18\x01 \x01(\x04\"\x84\x02\n\rQueryWorkflow\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12\x12\n\nquery_type\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12H\n\x07headers\x18\x05 \x03(\x0b\x32\x37.coresdk.workflow_activation.QueryWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"B\n\x0e\x43\x61ncelWorkflow\x12\x30\n\x07\x64\x65tails\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\"\x83\x02\n\x0eSignalWorkflow\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12.\n\x05input\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x10\n\x08identity\x18\x03 \x01(\t\x12I\n\x07headers\x18\x05 \x03(\x0b\x32\x38.coresdk.workflow_activation.SignalWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\"\n\x0eNotifyHasPatch\x12\x10\n\x08patch_id\x18\x01 \x01(\t\"_\n\x1dResolveSignalExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"f\n$ResolveRequestCancelExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"\xcb\x02\n\x08\x44oUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1c\n\x14protocol_instance_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x43\n\x07headers\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.DoUpdate.HeadersEntry\x12*\n\x04meta\x18\x06 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x15\n\rrun_validator\x18\x07 \x01(\x08\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\xc1\x02\n\x0fRemoveFromCache\x12\x0f\n\x07message\x18\x01 \x01(\t\x12K\n\x06reason\x18\x02 \x01(\x0e\x32;.coresdk.workflow_activation.RemoveFromCache.EvictionReason\"\xcf\x01\n\x0e\x45victionReason\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nCACHE_FULL\x10\x01\x12\x0e\n\nCACHE_MISS\x10\x02\x12\x12\n\x0eNONDETERMINISM\x10\x03\x12\r\n\tLANG_FAIL\x10\x04\x12\x12\n\x0eLANG_REQUESTED\x10\x05\x12\x12\n\x0eTASK_NOT_FOUND\x10\x06\x12\x15\n\x11UNHANDLED_COMMAND\x10\x07\x12\t\n\x05\x46\x41TAL\x10\x08\x12\x1f\n\x1bPAGINATION_OR_HISTORY_FETCH\x10\tB8\xea\x02\x35Temporalio::Internal::Bridge::Api::WorkflowActivationb\x06proto3"
20
+ descriptor_data = "\n?temporal/sdk/core/workflow_activation/workflow_activation.proto\x12\x1b\x63oresdk.workflow_activation\x1a\x1fgoogle/protobuf/timestamp.proto\x1a\x1egoogle/protobuf/duration.proto\x1a\x1bgoogle/protobuf/empty.proto\x1a%temporal/api/failure/v1/message.proto\x1a$temporal/api/update/v1/message.proto\x1a$temporal/api/common/v1/message.proto\x1a$temporal/api/enums/v1/workflow.proto\x1a\x37temporal/sdk/core/activity_result/activity_result.proto\x1a\x35temporal/sdk/core/child_workflow/child_workflow.proto\x1a%temporal/sdk/core/common/common.proto\x1a#temporal/sdk/core/nexus/nexus.proto\"\xc7\x02\n\x12WorkflowActivation\x12\x0e\n\x06run_id\x18\x01 \x01(\t\x12-\n\ttimestamp\x18\x02 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x14\n\x0cis_replaying\x18\x03 \x01(\x08\x12\x16\n\x0ehistory_length\x18\x04 \x01(\r\x12@\n\x04jobs\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.WorkflowActivationJob\x12 \n\x18\x61vailable_internal_flags\x18\x06 \x03(\r\x12\x1a\n\x12history_size_bytes\x18\x07 \x01(\x04\x12!\n\x19\x63ontinue_as_new_suggested\x18\x08 \x01(\x08\x12!\n\x19\x62uild_id_for_current_task\x18\t \x01(\t\"\xe0\n\n\x15WorkflowActivationJob\x12N\n\x13initialize_workflow\x18\x01 \x01(\x0b\x32/.coresdk.workflow_activation.InitializeWorkflowH\x00\x12<\n\nfire_timer\x18\x02 \x01(\x0b\x32&.coresdk.workflow_activation.FireTimerH\x00\x12K\n\x12update_random_seed\x18\x04 \x01(\x0b\x32-.coresdk.workflow_activation.UpdateRandomSeedH\x00\x12\x44\n\x0equery_workflow\x18\x05 \x01(\x0b\x32*.coresdk.workflow_activation.QueryWorkflowH\x00\x12\x46\n\x0f\x63\x61ncel_workflow\x18\x06 \x01(\x0b\x32+.coresdk.workflow_activation.CancelWorkflowH\x00\x12\x46\n\x0fsignal_workflow\x18\x07 \x01(\x0b\x32+.coresdk.workflow_activation.SignalWorkflowH\x00\x12H\n\x10resolve_activity\x18\x08 \x01(\x0b\x32,.coresdk.workflow_activation.ResolveActivityH\x00\x12G\n\x10notify_has_patch\x18\t \x01(\x0b\x32+.coresdk.workflow_activation.NotifyHasPatchH\x00\x12q\n&resolve_child_workflow_execution_start\x18\n \x01(\x0b\x32?.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartH\x00\x12\x66\n resolve_child_workflow_execution\x18\x0b \x01(\x0b\x32:.coresdk.workflow_activation.ResolveChildWorkflowExecutionH\x00\x12\x66\n resolve_signal_external_workflow\x18\x0c \x01(\x0b\x32:.coresdk.workflow_activation.ResolveSignalExternalWorkflowH\x00\x12u\n(resolve_request_cancel_external_workflow\x18\r \x01(\x0b\x32\x41.coresdk.workflow_activation.ResolveRequestCancelExternalWorkflowH\x00\x12:\n\tdo_update\x18\x0e \x01(\x0b\x32%.coresdk.workflow_activation.DoUpdateH\x00\x12`\n\x1dresolve_nexus_operation_start\x18\x0f \x01(\x0b\x32\x37.coresdk.workflow_activation.ResolveNexusOperationStartH\x00\x12U\n\x17resolve_nexus_operation\x18\x10 \x01(\x0b\x32\x32.coresdk.workflow_activation.ResolveNexusOperationH\x00\x12I\n\x11remove_from_cache\x18\x32 \x01(\x0b\x32,.coresdk.workflow_activation.RemoveFromCacheH\x00\x42\t\n\x07variant\"\xe3\t\n\x12InitializeWorkflow\x12\x15\n\rworkflow_type\x18\x01 \x01(\t\x12\x13\n\x0bworkflow_id\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x17\n\x0frandomness_seed\x18\x04 \x01(\x04\x12M\n\x07headers\x18\x05 \x03(\x0b\x32<.coresdk.workflow_activation.InitializeWorkflow.HeadersEntry\x12\x10\n\x08identity\x18\x06 \x01(\t\x12I\n\x14parent_workflow_info\x18\x07 \x01(\x0b\x32+.coresdk.common.NamespacedWorkflowExecution\x12=\n\x1aworkflow_execution_timeout\x18\x08 \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x37\n\x14workflow_run_timeout\x18\t \x01(\x0b\x32\x19.google.protobuf.Duration\x12\x38\n\x15workflow_task_timeout\x18\n \x01(\x0b\x32\x19.google.protobuf.Duration\x12\'\n\x1f\x63ontinued_from_execution_run_id\x18\x0b \x01(\t\x12J\n\x13\x63ontinued_initiator\x18\x0c \x01(\x0e\x32-.temporal.api.enums.v1.ContinueAsNewInitiator\x12;\n\x11\x63ontinued_failure\x18\r \x01(\x0b\x32 .temporal.api.failure.v1.Failure\x12@\n\x16last_completion_result\x18\x0e \x01(\x0b\x32 .temporal.api.common.v1.Payloads\x12\x1e\n\x16\x66irst_execution_run_id\x18\x0f \x01(\t\x12\x39\n\x0cretry_policy\x18\x10 \x01(\x0b\x32#.temporal.api.common.v1.RetryPolicy\x12\x0f\n\x07\x61ttempt\x18\x11 \x01(\x05\x12\x15\n\rcron_schedule\x18\x12 \x01(\t\x12\x46\n\"workflow_execution_expiration_time\x18\x13 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12\x45\n\"cron_schedule_to_schedule_interval\x18\x14 \x01(\x0b\x32\x19.google.protobuf.Duration\x12*\n\x04memo\x18\x15 \x01(\x0b\x32\x1c.temporal.api.common.v1.Memo\x12\x43\n\x11search_attributes\x18\x16 \x01(\x0b\x32(.temporal.api.common.v1.SearchAttributes\x12.\n\nstart_time\x18\x17 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\x18\n\tFireTimer\x12\x0b\n\x03seq\x18\x01 \x01(\r\"m\n\x0fResolveActivity\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.activity_result.ActivityResolution\x12\x10\n\x08is_local\x18\x03 \x01(\x08\"\xd1\x02\n\"ResolveChildWorkflowExecutionStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12[\n\tsucceeded\x18\x02 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartSuccessH\x00\x12X\n\x06\x66\x61iled\x18\x03 \x01(\x0b\x32\x46.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartFailureH\x00\x12]\n\tcancelled\x18\x04 \x01(\x0b\x32H.coresdk.workflow_activation.ResolveChildWorkflowExecutionStartCancelledH\x00\x42\x08\n\x06status\";\n)ResolveChildWorkflowExecutionStartSuccess\x12\x0e\n\x06run_id\x18\x01 \x01(\t\"\xa6\x01\n)ResolveChildWorkflowExecutionStartFailure\x12\x13\n\x0bworkflow_id\x18\x01 \x01(\t\x12\x15\n\rworkflow_type\x18\x02 \x01(\t\x12M\n\x05\x63\x61use\x18\x03 \x01(\x0e\x32>.coresdk.child_workflow.StartChildWorkflowExecutionFailedCause\"`\n+ResolveChildWorkflowExecutionStartCancelled\x12\x31\n\x07\x66\x61ilure\x18\x01 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"i\n\x1dResolveChildWorkflowExecution\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12;\n\x06result\x18\x02 \x01(\x0b\x32+.coresdk.child_workflow.ChildWorkflowResult\"+\n\x10UpdateRandomSeed\x12\x17\n\x0frandomness_seed\x18\x01 \x01(\x04\"\x84\x02\n\rQueryWorkflow\x12\x10\n\x08query_id\x18\x01 \x01(\t\x12\x12\n\nquery_type\x18\x02 \x01(\t\x12\x32\n\targuments\x18\x03 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12H\n\x07headers\x18\x05 \x03(\x0b\x32\x37.coresdk.workflow_activation.QueryWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"B\n\x0e\x43\x61ncelWorkflow\x12\x30\n\x07\x64\x65tails\x18\x01 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\"\x83\x02\n\x0eSignalWorkflow\x12\x13\n\x0bsignal_name\x18\x01 \x01(\t\x12.\n\x05input\x18\x02 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x10\n\x08identity\x18\x03 \x01(\t\x12I\n\x07headers\x18\x05 \x03(\x0b\x32\x38.coresdk.workflow_activation.SignalWorkflow.HeadersEntry\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\"\n\x0eNotifyHasPatch\x12\x10\n\x08patch_id\x18\x01 \x01(\t\"_\n\x1dResolveSignalExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"f\n$ResolveRequestCancelExternalWorkflow\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x31\n\x07\x66\x61ilure\x18\x02 \x01(\x0b\x32 .temporal.api.failure.v1.Failure\"\xcb\x02\n\x08\x44oUpdate\x12\n\n\x02id\x18\x01 \x01(\t\x12\x1c\n\x14protocol_instance_id\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12.\n\x05input\x18\x04 \x03(\x0b\x32\x1f.temporal.api.common.v1.Payload\x12\x43\n\x07headers\x18\x05 \x03(\x0b\x32\x32.coresdk.workflow_activation.DoUpdate.HeadersEntry\x12*\n\x04meta\x18\x06 \x01(\x0b\x32\x1c.temporal.api.update.v1.Meta\x12\x15\n\rrun_validator\x18\x07 \x01(\x08\x1aO\n\x0cHeadersEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12.\n\x05value\x18\x02 \x01(\x0b\x32\x1f.temporal.api.common.v1.Payload:\x02\x38\x01\"\xa7\x01\n\x1aResolveNexusOperationStart\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x16\n\x0coperation_id\x18\x02 \x01(\tH\x00\x12\x16\n\x0cstarted_sync\x18\x03 \x01(\x08H\x00\x12\x42\n\x16\x63\x61ncelled_before_start\x18\x04 \x01(\x0b\x32 .temporal.api.failure.v1.FailureH\x00\x42\x08\n\x06status\"Y\n\x15ResolveNexusOperation\x12\x0b\n\x03seq\x18\x01 \x01(\r\x12\x33\n\x06result\x18\x02 \x01(\x0b\x32#.coresdk.nexus.NexusOperationResult\"\xe0\x02\n\x0fRemoveFromCache\x12\x0f\n\x07message\x18\x01 \x01(\t\x12K\n\x06reason\x18\x02 \x01(\x0e\x32;.coresdk.workflow_activation.RemoveFromCache.EvictionReason\"\xee\x01\n\x0e\x45victionReason\x12\x0f\n\x0bUNSPECIFIED\x10\x00\x12\x0e\n\nCACHE_FULL\x10\x01\x12\x0e\n\nCACHE_MISS\x10\x02\x12\x12\n\x0eNONDETERMINISM\x10\x03\x12\r\n\tLANG_FAIL\x10\x04\x12\x12\n\x0eLANG_REQUESTED\x10\x05\x12\x12\n\x0eTASK_NOT_FOUND\x10\x06\x12\x15\n\x11UNHANDLED_COMMAND\x10\x07\x12\t\n\x05\x46\x41TAL\x10\x08\x12\x1f\n\x1bPAGINATION_OR_HISTORY_FETCH\x10\t\x12\x1d\n\x19WORKFLOW_EXECUTION_ENDING\x10\nB8\xea\x02\x35Temporalio::Internal::Bridge::Api::WorkflowActivationb\x06proto3"
19
21
 
20
22
  pool = Google::Protobuf::DescriptorPool.generated_pool
21
23
  pool.add_serialized_file(descriptor_data)
@@ -43,6 +45,8 @@ module Temporalio
43
45
  ResolveSignalExternalWorkflow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.ResolveSignalExternalWorkflow").msgclass
44
46
  ResolveRequestCancelExternalWorkflow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.ResolveRequestCancelExternalWorkflow").msgclass
45
47
  DoUpdate = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.DoUpdate").msgclass
48
+ ResolveNexusOperationStart = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.ResolveNexusOperationStart").msgclass
49
+ ResolveNexusOperation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.ResolveNexusOperation").msgclass
46
50
  RemoveFromCache = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.RemoveFromCache").msgclass
47
51
  RemoveFromCache::EvictionReason = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("coresdk.workflow_activation.RemoveFromCache.EvictionReason").enummodule
48
52
  end