temporalio 0.2.0-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +7 -0
  2. data/lib/temporalio/activity/complete_async_error.rb +11 -0
  3. data/lib/temporalio/activity/context.rb +107 -0
  4. data/lib/temporalio/activity/definition.rb +77 -0
  5. data/lib/temporalio/activity/info.rb +63 -0
  6. data/lib/temporalio/activity.rb +69 -0
  7. data/lib/temporalio/api/batch/v1/message.rb +31 -0
  8. data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +93 -0
  9. data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +25 -0
  10. data/lib/temporalio/api/cloud/cloudservice.rb +3 -0
  11. data/lib/temporalio/api/cloud/identity/v1/message.rb +36 -0
  12. data/lib/temporalio/api/cloud/namespace/v1/message.rb +35 -0
  13. data/lib/temporalio/api/cloud/operation/v1/message.rb +27 -0
  14. data/lib/temporalio/api/cloud/region/v1/message.rb +23 -0
  15. data/lib/temporalio/api/command/v1/message.rb +46 -0
  16. data/lib/temporalio/api/common/v1/grpc_status.rb +23 -0
  17. data/lib/temporalio/api/common/v1/message.rb +41 -0
  18. data/lib/temporalio/api/enums/v1/batch_operation.rb +22 -0
  19. data/lib/temporalio/api/enums/v1/command_type.rb +21 -0
  20. data/lib/temporalio/api/enums/v1/common.rb +26 -0
  21. data/lib/temporalio/api/enums/v1/event_type.rb +21 -0
  22. data/lib/temporalio/api/enums/v1/failed_cause.rb +26 -0
  23. data/lib/temporalio/api/enums/v1/namespace.rb +23 -0
  24. data/lib/temporalio/api/enums/v1/query.rb +22 -0
  25. data/lib/temporalio/api/enums/v1/reset.rb +23 -0
  26. data/lib/temporalio/api/enums/v1/schedule.rb +21 -0
  27. data/lib/temporalio/api/enums/v1/task_queue.rb +25 -0
  28. data/lib/temporalio/api/enums/v1/update.rb +22 -0
  29. data/lib/temporalio/api/enums/v1/workflow.rb +30 -0
  30. data/lib/temporalio/api/errordetails/v1/message.rb +42 -0
  31. data/lib/temporalio/api/export/v1/message.rb +24 -0
  32. data/lib/temporalio/api/failure/v1/message.rb +35 -0
  33. data/lib/temporalio/api/filter/v1/message.rb +27 -0
  34. data/lib/temporalio/api/history/v1/message.rb +90 -0
  35. data/lib/temporalio/api/namespace/v1/message.rb +31 -0
  36. data/lib/temporalio/api/nexus/v1/message.rb +40 -0
  37. data/lib/temporalio/api/operatorservice/v1/request_response.rb +49 -0
  38. data/lib/temporalio/api/operatorservice/v1/service.rb +23 -0
  39. data/lib/temporalio/api/operatorservice.rb +3 -0
  40. data/lib/temporalio/api/protocol/v1/message.rb +23 -0
  41. data/lib/temporalio/api/query/v1/message.rb +27 -0
  42. data/lib/temporalio/api/replication/v1/message.rb +26 -0
  43. data/lib/temporalio/api/schedule/v1/message.rb +42 -0
  44. data/lib/temporalio/api/sdk/v1/enhanced_stack_trace.rb +25 -0
  45. data/lib/temporalio/api/sdk/v1/task_complete_metadata.rb +21 -0
  46. data/lib/temporalio/api/sdk/v1/user_metadata.rb +23 -0
  47. data/lib/temporalio/api/sdk/v1/workflow_metadata.rb +23 -0
  48. data/lib/temporalio/api/taskqueue/v1/message.rb +45 -0
  49. data/lib/temporalio/api/update/v1/message.rb +33 -0
  50. data/lib/temporalio/api/version/v1/message.rb +26 -0
  51. data/lib/temporalio/api/workflow/v1/message.rb +43 -0
  52. data/lib/temporalio/api/workflowservice/v1/request_response.rb +189 -0
  53. data/lib/temporalio/api/workflowservice/v1/service.rb +23 -0
  54. data/lib/temporalio/api/workflowservice.rb +3 -0
  55. data/lib/temporalio/api.rb +13 -0
  56. data/lib/temporalio/cancellation.rb +150 -0
  57. data/lib/temporalio/client/activity_id_reference.rb +32 -0
  58. data/lib/temporalio/client/async_activity_handle.rb +110 -0
  59. data/lib/temporalio/client/connection/cloud_service.rb +648 -0
  60. data/lib/temporalio/client/connection/operator_service.rb +249 -0
  61. data/lib/temporalio/client/connection/service.rb +41 -0
  62. data/lib/temporalio/client/connection/workflow_service.rb +1218 -0
  63. data/lib/temporalio/client/connection.rb +270 -0
  64. data/lib/temporalio/client/interceptor.rb +316 -0
  65. data/lib/temporalio/client/workflow_execution.rb +103 -0
  66. data/lib/temporalio/client/workflow_execution_count.rb +36 -0
  67. data/lib/temporalio/client/workflow_execution_status.rb +18 -0
  68. data/lib/temporalio/client/workflow_handle.rb +446 -0
  69. data/lib/temporalio/client/workflow_query_reject_condition.rb +14 -0
  70. data/lib/temporalio/client/workflow_update_handle.rb +67 -0
  71. data/lib/temporalio/client/workflow_update_wait_stage.rb +17 -0
  72. data/lib/temporalio/client.rb +404 -0
  73. data/lib/temporalio/common_enums.rb +24 -0
  74. data/lib/temporalio/converters/data_converter.rb +102 -0
  75. data/lib/temporalio/converters/failure_converter.rb +200 -0
  76. data/lib/temporalio/converters/payload_codec.rb +26 -0
  77. data/lib/temporalio/converters/payload_converter/binary_null.rb +34 -0
  78. data/lib/temporalio/converters/payload_converter/binary_plain.rb +35 -0
  79. data/lib/temporalio/converters/payload_converter/binary_protobuf.rb +42 -0
  80. data/lib/temporalio/converters/payload_converter/composite.rb +62 -0
  81. data/lib/temporalio/converters/payload_converter/encoding.rb +35 -0
  82. data/lib/temporalio/converters/payload_converter/json_plain.rb +44 -0
  83. data/lib/temporalio/converters/payload_converter/json_protobuf.rb +41 -0
  84. data/lib/temporalio/converters/payload_converter.rb +73 -0
  85. data/lib/temporalio/converters.rb +9 -0
  86. data/lib/temporalio/error/failure.rb +219 -0
  87. data/lib/temporalio/error.rb +147 -0
  88. data/lib/temporalio/internal/bridge/3.1/temporalio_bridge.so +0 -0
  89. data/lib/temporalio/internal/bridge/3.2/temporalio_bridge.so +0 -0
  90. data/lib/temporalio/internal/bridge/3.3/temporalio_bridge.so +0 -0
  91. data/lib/temporalio/internal/bridge/api/activity_result/activity_result.rb +34 -0
  92. data/lib/temporalio/internal/bridge/api/activity_task/activity_task.rb +31 -0
  93. data/lib/temporalio/internal/bridge/api/child_workflow/child_workflow.rb +33 -0
  94. data/lib/temporalio/internal/bridge/api/common/common.rb +26 -0
  95. data/lib/temporalio/internal/bridge/api/core_interface.rb +36 -0
  96. data/lib/temporalio/internal/bridge/api/external_data/external_data.rb +27 -0
  97. data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +52 -0
  98. data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +54 -0
  99. data/lib/temporalio/internal/bridge/api/workflow_completion/workflow_completion.rb +30 -0
  100. data/lib/temporalio/internal/bridge/api.rb +3 -0
  101. data/lib/temporalio/internal/bridge/client.rb +90 -0
  102. data/lib/temporalio/internal/bridge/runtime.rb +53 -0
  103. data/lib/temporalio/internal/bridge/testing.rb +46 -0
  104. data/lib/temporalio/internal/bridge/worker.rb +83 -0
  105. data/lib/temporalio/internal/bridge.rb +36 -0
  106. data/lib/temporalio/internal/client/implementation.rb +525 -0
  107. data/lib/temporalio/internal/proto_utils.rb +54 -0
  108. data/lib/temporalio/internal/worker/activity_worker.rb +345 -0
  109. data/lib/temporalio/internal/worker/multi_runner.rb +169 -0
  110. data/lib/temporalio/internal.rb +7 -0
  111. data/lib/temporalio/retry_policy.rb +51 -0
  112. data/lib/temporalio/runtime.rb +271 -0
  113. data/lib/temporalio/scoped_logger.rb +96 -0
  114. data/lib/temporalio/search_attributes.rb +300 -0
  115. data/lib/temporalio/testing/activity_environment.rb +132 -0
  116. data/lib/temporalio/testing/workflow_environment.rb +137 -0
  117. data/lib/temporalio/testing.rb +10 -0
  118. data/lib/temporalio/version.rb +5 -0
  119. data/lib/temporalio/worker/activity_executor/fiber.rb +49 -0
  120. data/lib/temporalio/worker/activity_executor/thread_pool.rb +254 -0
  121. data/lib/temporalio/worker/activity_executor.rb +55 -0
  122. data/lib/temporalio/worker/interceptor.rb +88 -0
  123. data/lib/temporalio/worker/tuner.rb +151 -0
  124. data/lib/temporalio/worker.rb +426 -0
  125. data/lib/temporalio/workflow_history.rb +22 -0
  126. data/lib/temporalio.rb +7 -0
  127. data/temporalio.gemspec +28 -0
  128. metadata +189 -0
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: temporal/api/workflowservice/v1/service.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'temporalio/api/workflowservice/v1/request_response'
8
+ require 'google/api/annotations_pb'
9
+
10
+
11
+ descriptor_data = "\n-temporal/api/workflowservice/v1/service.proto\x12\x1ftemporal.api.workflowservice.v1\x1a\x36temporal/api/workflowservice/v1/request_response.proto\x1a\x1cgoogle/api/annotations.proto2\xbb\x63\n\x0fWorkflowService\x12\xa2\x01\n\x11RegisterNamespace\x12\x39.temporal.api.workflowservice.v1.RegisterNamespaceRequest\x1a:.temporal.api.workflowservice.v1.RegisterNamespaceResponse\"\x16\x82\xd3\xe4\x93\x02\x10\"\x0b/namespaces:\x01*\x12\xab\x01\n\x11\x44\x65scribeNamespace\x12\x39.temporal.api.workflowservice.v1.DescribeNamespaceRequest\x1a:.temporal.api.workflowservice.v1.DescribeNamespaceResponse\"\x1f\x82\xd3\xe4\x93\x02\x19\x12\x17/namespaces/{namespace}\x12\x96\x01\n\x0eListNamespaces\x12\x36.temporal.api.workflowservice.v1.ListNamespacesRequest\x1a\x37.temporal.api.workflowservice.v1.ListNamespacesResponse\"\x13\x82\xd3\xe4\x93\x02\r\x12\x0b/namespaces\x12\xaf\x01\n\x0fUpdateNamespace\x12\x37.temporal.api.workflowservice.v1.UpdateNamespaceRequest\x1a\x38.temporal.api.workflowservice.v1.UpdateNamespaceResponse\")\x82\xd3\xe4\x93\x02#\"\x1e/namespaces/{namespace}/update:\x01*\x12\x8f\x01\n\x12\x44\x65precateNamespace\x12:.temporal.api.workflowservice.v1.DeprecateNamespaceRequest\x1a;.temporal.api.workflowservice.v1.DeprecateNamespaceResponse\"\x00\x12\xd5\x01\n\x16StartWorkflowExecution\x12>.temporal.api.workflowservice.v1.StartWorkflowExecutionRequest\x1a?.temporal.api.workflowservice.v1.StartWorkflowExecutionResponse\":\x82\xd3\xe4\x93\x02\x34\"//namespaces/{namespace}/workflows/{workflow_id}:\x01*\x12\xdc\x01\n\x15\x45xecuteMultiOperation\x12=.temporal.api.workflowservice.v1.ExecuteMultiOperationRequest\x1a>.temporal.api.workflowservice.v1.ExecuteMultiOperationResponse\"D\x82\xd3\xe4\x93\x02>\"9/namespaces/{namespace}/workflows/execute-multi-operation:\x01*\x12\xf3\x01\n\x1bGetWorkflowExecutionHistory\x12\x43.temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryRequest\x1a\x44.temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryResponse\"I\x82\xd3\xe4\x93\x02\x43\x12\x41/namespaces/{namespace}/workflows/{execution.workflow_id}/history\x12\x90\x02\n\"GetWorkflowExecutionHistoryReverse\x12J.temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryReverseRequest\x1aK.temporal.api.workflowservice.v1.GetWorkflowExecutionHistoryReverseResponse\"Q\x82\xd3\xe4\x93\x02K\x12I/namespaces/{namespace}/workflows/{execution.workflow_id}/history-reverse\x12\x98\x01\n\x15PollWorkflowTaskQueue\x12=.temporal.api.workflowservice.v1.PollWorkflowTaskQueueRequest\x1a>.temporal.api.workflowservice.v1.PollWorkflowTaskQueueResponse\"\x00\x12\xad\x01\n\x1cRespondWorkflowTaskCompleted\x12\x44.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedRequest\x1a\x45.temporal.api.workflowservice.v1.RespondWorkflowTaskCompletedResponse\"\x00\x12\xa4\x01\n\x19RespondWorkflowTaskFailed\x12\x41.temporal.api.workflowservice.v1.RespondWorkflowTaskFailedRequest\x1a\x42.temporal.api.workflowservice.v1.RespondWorkflowTaskFailedResponse\"\x00\x12\x98\x01\n\x15PollActivityTaskQueue\x12=.temporal.api.workflowservice.v1.PollActivityTaskQueueRequest\x1a>.temporal.api.workflowservice.v1.PollActivityTaskQueueResponse\"\x00\x12\xe1\x01\n\x1bRecordActivityTaskHeartbeat\x12\x43.temporal.api.workflowservice.v1.RecordActivityTaskHeartbeatRequest\x1a\x44.temporal.api.workflowservice.v1.RecordActivityTaskHeartbeatResponse\"7\x82\xd3\xe4\x93\x02\x31\",/namespaces/{namespace}/activities/heartbeat:\x01*\x12\xf3\x01\n\x1fRecordActivityTaskHeartbeatById\x12G.temporal.api.workflowservice.v1.RecordActivityTaskHeartbeatByIdRequest\x1aH.temporal.api.workflowservice.v1.RecordActivityTaskHeartbeatByIdResponse\"=\x82\xd3\xe4\x93\x02\x37\"2/namespaces/{namespace}/activities/heartbeat-by-id:\x01*\x12\xe3\x01\n\x1cRespondActivityTaskCompleted\x12\x44.temporal.api.workflowservice.v1.RespondActivityTaskCompletedRequest\x1a\x45.temporal.api.workflowservice.v1.RespondActivityTaskCompletedResponse\"6\x82\xd3\xe4\x93\x02\x30\"+/namespaces/{namespace}/activities/complete:\x01*\x12\xf5\x01\n RespondActivityTaskCompletedById\x12H.temporal.api.workflowservice.v1.RespondActivityTaskCompletedByIdRequest\x1aI.temporal.api.workflowservice.v1.RespondActivityTaskCompletedByIdResponse\"<\x82\xd3\xe4\x93\x02\x36\"1/namespaces/{namespace}/activities/complete-by-id:\x01*\x12\xd6\x01\n\x19RespondActivityTaskFailed\x12\x41.temporal.api.workflowservice.v1.RespondActivityTaskFailedRequest\x1a\x42.temporal.api.workflowservice.v1.RespondActivityTaskFailedResponse\"2\x82\xd3\xe4\x93\x02,\"\'/namespaces/{namespace}/activities/fail:\x01*\x12\xe8\x01\n\x1dRespondActivityTaskFailedById\x12\x45.temporal.api.workflowservice.v1.RespondActivityTaskFailedByIdRequest\x1a\x46.temporal.api.workflowservice.v1.RespondActivityTaskFailedByIdResponse\"8\x82\xd3\xe4\x93\x02\x32\"-/namespaces/{namespace}/activities/fail-by-id:\x01*\x12\xde\x01\n\x1bRespondActivityTaskCanceled\x12\x43.temporal.api.workflowservice.v1.RespondActivityTaskCanceledRequest\x1a\x44.temporal.api.workflowservice.v1.RespondActivityTaskCanceledResponse\"4\x82\xd3\xe4\x93\x02.\")/namespaces/{namespace}/activities/cancel:\x01*\x12\xf0\x01\n\x1fRespondActivityTaskCanceledById\x12G.temporal.api.workflowservice.v1.RespondActivityTaskCanceledByIdRequest\x1aH.temporal.api.workflowservice.v1.RespondActivityTaskCanceledByIdResponse\":\x82\xd3\xe4\x93\x02\x34\"//namespaces/{namespace}/activities/cancel-by-id:\x01*\x12\x87\x02\n\x1eRequestCancelWorkflowExecution\x12\x46.temporal.api.workflowservice.v1.RequestCancelWorkflowExecutionRequest\x1aG.temporal.api.workflowservice.v1.RequestCancelWorkflowExecutionResponse\"T\x82\xd3\xe4\x93\x02N\"I/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/cancel:\x01*\x12\x80\x02\n\x17SignalWorkflowExecution\x12?.temporal.api.workflowservice.v1.SignalWorkflowExecutionRequest\x1a@.temporal.api.workflowservice.v1.SignalWorkflowExecutionResponse\"b\x82\xd3\xe4\x93\x02\\\"W/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/signal/{signal_name}:\x01*\x12\x93\x02\n SignalWithStartWorkflowExecution\x12H.temporal.api.workflowservice.v1.SignalWithStartWorkflowExecutionRequest\x1aI.temporal.api.workflowservice.v1.SignalWithStartWorkflowExecutionResponse\"Z\x82\xd3\xe4\x93\x02T\"O/namespaces/{namespace}/workflows/{workflow_id}/signal-with-start/{signal_name}:\x01*\x12\xee\x01\n\x16ResetWorkflowExecution\x12>.temporal.api.workflowservice.v1.ResetWorkflowExecutionRequest\x1a?.temporal.api.workflowservice.v1.ResetWorkflowExecutionResponse\"S\x82\xd3\xe4\x93\x02M\"H/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/reset:\x01*\x12\xfe\x01\n\x1aTerminateWorkflowExecution\x12\x42.temporal.api.workflowservice.v1.TerminateWorkflowExecutionRequest\x1a\x43.temporal.api.workflowservice.v1.TerminateWorkflowExecutionResponse\"W\x82\xd3\xe4\x93\x02Q\"L/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/terminate:\x01*\x12\x9e\x01\n\x17\x44\x65leteWorkflowExecution\x12?.temporal.api.workflowservice.v1.DeleteWorkflowExecutionRequest\x1a@.temporal.api.workflowservice.v1.DeleteWorkflowExecutionResponse\"\x00\x12\xa7\x01\n\x1aListOpenWorkflowExecutions\x12\x42.temporal.api.workflowservice.v1.ListOpenWorkflowExecutionsRequest\x1a\x43.temporal.api.workflowservice.v1.ListOpenWorkflowExecutionsResponse\"\x00\x12\xad\x01\n\x1cListClosedWorkflowExecutions\x12\x44.temporal.api.workflowservice.v1.ListClosedWorkflowExecutionsRequest\x1a\x45.temporal.api.workflowservice.v1.ListClosedWorkflowExecutionsResponse\"\x00\x12\xc4\x01\n\x16ListWorkflowExecutions\x12>.temporal.api.workflowservice.v1.ListWorkflowExecutionsRequest\x1a?.temporal.api.workflowservice.v1.ListWorkflowExecutionsResponse\")\x82\xd3\xe4\x93\x02#\x12!/namespaces/{namespace}/workflows\x12\xe5\x01\n\x1eListArchivedWorkflowExecutions\x12\x46.temporal.api.workflowservice.v1.ListArchivedWorkflowExecutionsRequest\x1aG.temporal.api.workflowservice.v1.ListArchivedWorkflowExecutionsResponse\"2\x82\xd3\xe4\x93\x02,\x12*/namespaces/{namespace}/archived-workflows\x12\x9b\x01\n\x16ScanWorkflowExecutions\x12>.temporal.api.workflowservice.v1.ScanWorkflowExecutionsRequest\x1a?.temporal.api.workflowservice.v1.ScanWorkflowExecutionsResponse\"\x00\x12\xcc\x01\n\x17\x43ountWorkflowExecutions\x12?.temporal.api.workflowservice.v1.CountWorkflowExecutionsRequest\x1a@.temporal.api.workflowservice.v1.CountWorkflowExecutionsResponse\".\x82\xd3\xe4\x93\x02(\x12&/namespaces/{namespace}/workflow-count\x12\x92\x01\n\x13GetSearchAttributes\x12;.temporal.api.workflowservice.v1.GetSearchAttributesRequest\x1a<.temporal.api.workflowservice.v1.GetSearchAttributesResponse\"\x00\x12\xa4\x01\n\x19RespondQueryTaskCompleted\x12\x41.temporal.api.workflowservice.v1.RespondQueryTaskCompletedRequest\x1a\x42.temporal.api.workflowservice.v1.RespondQueryTaskCompletedResponse\"\x00\x12\x95\x01\n\x14ResetStickyTaskQueue\x12<.temporal.api.workflowservice.v1.ResetStickyTaskQueueRequest\x1a=.temporal.api.workflowservice.v1.ResetStickyTaskQueueResponse\"\x00\x12\xdd\x01\n\rQueryWorkflow\x12\x35.temporal.api.workflowservice.v1.QueryWorkflowRequest\x1a\x36.temporal.api.workflowservice.v1.QueryWorkflowResponse\"]\x82\xd3\xe4\x93\x02W\"R/namespaces/{namespace}/workflows/{execution.workflow_id}/query/{query.query_type}:\x01*\x12\xe5\x01\n\x19\x44\x65scribeWorkflowExecution\x12\x41.temporal.api.workflowservice.v1.DescribeWorkflowExecutionRequest\x1a\x42.temporal.api.workflowservice.v1.DescribeWorkflowExecutionResponse\"A\x82\xd3\xe4\x93\x02;\x12\x39/namespaces/{namespace}/workflows/{execution.workflow_id}\x12\xc9\x01\n\x11\x44\x65scribeTaskQueue\x12\x39.temporal.api.workflowservice.v1.DescribeTaskQueueRequest\x1a:.temporal.api.workflowservice.v1.DescribeTaskQueueResponse\"=\x82\xd3\xe4\x93\x02\x37\x12\x35/namespaces/{namespace}/task-queues/{task_queue.name}\x12\x98\x01\n\x0eGetClusterInfo\x12\x36.temporal.api.workflowservice.v1.GetClusterInfoRequest\x1a\x37.temporal.api.workflowservice.v1.GetClusterInfoResponse\"\x15\x82\xd3\xe4\x93\x02\x0f\x12\r/cluster-info\x12\x94\x01\n\rGetSystemInfo\x12\x35.temporal.api.workflowservice.v1.GetSystemInfoRequest\x1a\x36.temporal.api.workflowservice.v1.GetSystemInfoResponse\"\x14\x82\xd3\xe4\x93\x02\x0e\x12\x0c/system-info\x12\x9e\x01\n\x17ListTaskQueuePartitions\x12?.temporal.api.workflowservice.v1.ListTaskQueuePartitionsRequest\x1a@.temporal.api.workflowservice.v1.ListTaskQueuePartitionsResponse\"\x00\x12\xbd\x01\n\x0e\x43reateSchedule\x12\x36.temporal.api.workflowservice.v1.CreateScheduleRequest\x1a\x37.temporal.api.workflowservice.v1.CreateScheduleResponse\":\x82\xd3\xe4\x93\x02\x34\"//namespaces/{namespace}/schedules/{schedule_id}:\x01*\x12\xc0\x01\n\x10\x44\x65scribeSchedule\x12\x38.temporal.api.workflowservice.v1.DescribeScheduleRequest\x1a\x39.temporal.api.workflowservice.v1.DescribeScheduleResponse\"7\x82\xd3\xe4\x93\x02\x31\x12//namespaces/{namespace}/schedules/{schedule_id}\x12\xc4\x01\n\x0eUpdateSchedule\x12\x36.temporal.api.workflowservice.v1.UpdateScheduleRequest\x1a\x37.temporal.api.workflowservice.v1.UpdateScheduleResponse\"A\x82\xd3\xe4\x93\x02;\"6/namespaces/{namespace}/schedules/{schedule_id}/update:\x01*\x12\xc0\x01\n\rPatchSchedule\x12\x35.temporal.api.workflowservice.v1.PatchScheduleRequest\x1a\x36.temporal.api.workflowservice.v1.PatchScheduleResponse\"@\x82\xd3\xe4\x93\x02:\"5/namespaces/{namespace}/schedules/{schedule_id}/patch:\x01*\x12\xea\x01\n\x19ListScheduleMatchingTimes\x12\x41.temporal.api.workflowservice.v1.ListScheduleMatchingTimesRequest\x1a\x42.temporal.api.workflowservice.v1.ListScheduleMatchingTimesResponse\"F\x82\xd3\xe4\x93\x02@\x12>/namespaces/{namespace}/schedules/{schedule_id}/matching-times\x12\xba\x01\n\x0e\x44\x65leteSchedule\x12\x36.temporal.api.workflowservice.v1.DeleteScheduleRequest\x1a\x37.temporal.api.workflowservice.v1.DeleteScheduleResponse\"7\x82\xd3\xe4\x93\x02\x31*//namespaces/{namespace}/schedules/{schedule_id}\x12\xa9\x01\n\rListSchedules\x12\x35.temporal.api.workflowservice.v1.ListSchedulesRequest\x1a\x36.temporal.api.workflowservice.v1.ListSchedulesResponse\")\x82\xd3\xe4\x93\x02#\x12!/namespaces/{namespace}/schedules\x12\xb9\x01\n UpdateWorkerBuildIdCompatibility\x12H.temporal.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityRequest\x1aI.temporal.api.workflowservice.v1.UpdateWorkerBuildIdCompatibilityResponse\"\x00\x12\x86\x02\n\x1dGetWorkerBuildIdCompatibility\x12\x45.temporal.api.workflowservice.v1.GetWorkerBuildIdCompatibilityRequest\x1a\x46.temporal.api.workflowservice.v1.GetWorkerBuildIdCompatibilityResponse\"V\x82\xd3\xe4\x93\x02P\x12N/namespaces/{namespace}/task-queues/{task_queue}/worker-build-id-compatibility\x12\xaa\x01\n\x1bUpdateWorkerVersioningRules\x12\x43.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesRequest\x1a\x44.temporal.api.workflowservice.v1.UpdateWorkerVersioningRulesResponse\"\x00\x12\xf1\x01\n\x18GetWorkerVersioningRules\x12@.temporal.api.workflowservice.v1.GetWorkerVersioningRulesRequest\x1a\x41.temporal.api.workflowservice.v1.GetWorkerVersioningRulesResponse\"P\x82\xd3\xe4\x93\x02J\x12H/namespaces/{namespace}/task-queues/{task_queue}/worker-versioning-rules\x12\xdc\x01\n\x19GetWorkerTaskReachability\x12\x41.temporal.api.workflowservice.v1.GetWorkerTaskReachabilityRequest\x1a\x42.temporal.api.workflowservice.v1.GetWorkerTaskReachabilityResponse\"8\x82\xd3\xe4\x93\x02\x32\x12\x30/namespaces/{namespace}/worker-task-reachability\x12\x87\x02\n\x17UpdateWorkflowExecution\x12?.temporal.api.workflowservice.v1.UpdateWorkflowExecutionRequest\x1a@.temporal.api.workflowservice.v1.UpdateWorkflowExecutionResponse\"i\x82\xd3\xe4\x93\x02\x63\"^/namespaces/{namespace}/workflows/{workflow_execution.workflow_id}/update/{request.input.name}:\x01*\x12\xaa\x01\n\x1bPollWorkflowExecutionUpdate\x12\x43.temporal.api.workflowservice.v1.PollWorkflowExecutionUpdateRequest\x1a\x44.temporal.api.workflowservice.v1.PollWorkflowExecutionUpdateResponse\"\x00\x12\xce\x01\n\x13StartBatchOperation\x12;.temporal.api.workflowservice.v1.StartBatchOperationRequest\x1a<.temporal.api.workflowservice.v1.StartBatchOperationResponse\"<\x82\xd3\xe4\x93\x02\x36\"1/namespaces/{namespace}/batch-operations/{job_id}:\x01*\x12\xd0\x01\n\x12StopBatchOperation\x12:.temporal.api.workflowservice.v1.StopBatchOperationRequest\x1a;.temporal.api.workflowservice.v1.StopBatchOperationResponse\"A\x82\xd3\xe4\x93\x02;\"6/namespaces/{namespace}/batch-operations/{job_id}/stop:\x01*\x12\xd4\x01\n\x16\x44\x65scribeBatchOperation\x12>.temporal.api.workflowservice.v1.DescribeBatchOperationRequest\x1a?.temporal.api.workflowservice.v1.DescribeBatchOperationResponse\"9\x82\xd3\xe4\x93\x02\x33\x12\x31/namespaces/{namespace}/batch-operations/{job_id}\x12\xc2\x01\n\x13ListBatchOperations\x12;.temporal.api.workflowservice.v1.ListBatchOperationsRequest\x1a<.temporal.api.workflowservice.v1.ListBatchOperationsResponse\"0\x82\xd3\xe4\x93\x02*\x12(/namespaces/{namespace}/batch-operations\x12\x8f\x01\n\x12PollNexusTaskQueue\x12:.temporal.api.workflowservice.v1.PollNexusTaskQueueRequest\x1a;.temporal.api.workflowservice.v1.PollNexusTaskQueueResponse\"\x00\x12\xa4\x01\n\x19RespondNexusTaskCompleted\x12\x41.temporal.api.workflowservice.v1.RespondNexusTaskCompletedRequest\x1a\x42.temporal.api.workflowservice.v1.RespondNexusTaskCompletedResponse\"\x00\x12\x9b\x01\n\x16RespondNexusTaskFailed\x12>.temporal.api.workflowservice.v1.RespondNexusTaskFailedRequest\x1a?.temporal.api.workflowservice.v1.RespondNexusTaskFailedResponse\"\x00\x42\xb6\x01\n\"io.temporal.api.workflowservice.v1B\x0cServiceProtoP\x01Z5go.temporal.io/api/workflowservice/v1;workflowservice\xaa\x02!Temporalio.Api.WorkflowService.V1\xea\x02$Temporalio::Api::WorkflowService::V1b\x06proto3"
12
+
13
+ pool = Google::Protobuf::DescriptorPool.generated_pool
14
+ pool.add_serialized_file(descriptor_data)
15
+
16
+ module Temporalio
17
+ module Api
18
+ module WorkflowService
19
+ module V1
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,3 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/api/workflowservice/v1/request_response'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/api/cloud/cloudservice'
4
+ require 'temporalio/api/common/v1/grpc_status'
5
+ require 'temporalio/api/errordetails/v1/message'
6
+ require 'temporalio/api/operatorservice'
7
+ require 'temporalio/api/workflowservice'
8
+
9
+ module Temporalio
10
+ # Raw protocol buffer models.
11
+ module Api
12
+ end
13
+ end
@@ -0,0 +1,150 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/error'
4
+
5
+ module Temporalio
6
+ # Cancellation representation, often known as a "cancellation token". This is used by clients, activities, and
7
+ # workflows to represent cancellation in a thread/fiber-safe way.
8
+ class Cancellation
9
+ # Create a new cancellation.
10
+ #
11
+ # This is usually created and destructured into a tuple with the second value being the proc to invoke to cancel.
12
+ # For example: `cancel, cancel_proc = Temporalio::Cancellation.new`. This is done via {to_ary} which returns a proc
13
+ # to issue the cancellation in the second value of the array.
14
+ #
15
+ # @param parents [Array<Cancellation>] Parent cancellations to link this one to. This cancellation will be canceled
16
+ # when any parents are canceled.
17
+ def initialize(*parents)
18
+ @canceled = false
19
+ @canceled_reason = nil
20
+ @canceled_mutex = Mutex.new
21
+ @canceled_cond_var = nil
22
+ @cancel_callbacks = []
23
+ @shield_depth = 0
24
+ @shield_pending_cancel = nil # When pending, set as single-reason array
25
+ parents.each { |p| p.add_cancel_callback { on_cancel(reason: p.canceled_reason) } }
26
+ end
27
+
28
+ # @return [Boolean] Whether this cancellation is canceled.
29
+ def canceled?
30
+ @canceled_mutex.synchronize { @canceled }
31
+ end
32
+
33
+ # @return [String, nil] Reason for cancellation. Can be nil if not canceled or no reason provided.
34
+ def canceled_reason
35
+ @canceled_mutex.synchronize { @canceled_reason }
36
+ end
37
+
38
+ # @return [Boolean] Whether a cancel is pending but currently shielded.
39
+ def pending_canceled?
40
+ @canceled_mutex.synchronize { !@shield_pending_cancel.nil? }
41
+ end
42
+
43
+ # @return [String, nil] Reason for pending cancellation. Can be nil if not pending canceled or no reason provided.
44
+ def pending_canceled_reason
45
+ @canceled_mutex.synchronize { @shield_pending_cancel&.first }
46
+ end
47
+
48
+ # Raise an error if this cancellation is canceled.
49
+ #
50
+ # @param err [Exception] Error to raise.
51
+ def check!(err = Error::CanceledError.new('Canceled'))
52
+ raise err if canceled?
53
+ end
54
+
55
+ # @return [Array(Cancellation, Proc)] Self and a proc to call to cancel that accepts an optional string `reason`
56
+ # keyword argument. As a general practice, only the creator of the cancellation should be the one controlling its
57
+ # cancellation.
58
+ def to_ary
59
+ [self, proc { |reason: nil| on_cancel(reason:) }]
60
+ end
61
+
62
+ # Wait on this to be canceled. This is backed by a {::ConditionVariable}.
63
+ def wait
64
+ @canceled_mutex.synchronize do
65
+ break if @canceled
66
+
67
+ # Add cond var if not present
68
+ if @canceled_cond_var.nil?
69
+ @canceled_cond_var = ConditionVariable.new
70
+ @cancel_callbacks.push(proc { @canceled_mutex.synchronize { @canceled_cond_var.broadcast } })
71
+ end
72
+
73
+ # Wait on it
74
+ @canceled_cond_var.wait(@canceled_mutex)
75
+ end
76
+ end
77
+
78
+ # Shield the given block from cancellation. This means any cancellation that occurs while shielded code is running
79
+ # will be set as "pending" and will not take effect until after the block completes. If shield calls are nested, the
80
+ # cancellation remains "pending" until the last shielded block ends.
81
+ #
82
+ # @yield Requires a block to run under shield.
83
+ # @return [Object] Result of the block.
84
+ def shield
85
+ raise ArgumentError, 'Block required' unless block_given?
86
+
87
+ @canceled_mutex.synchronize { @shield_depth += 1 }
88
+ yield
89
+ ensure
90
+ callbacks_to_run = @canceled_mutex.synchronize do
91
+ @shield_depth -= 1
92
+ if @shield_depth.zero? && @shield_pending_cancel
93
+ reason = @shield_pending_cancel.first
94
+ @shield_pending_cancel = nil
95
+ prepare_cancel(reason:)
96
+ end
97
+ end
98
+ callbacks_to_run&.each(&:call)
99
+ end
100
+
101
+ # Advanced call to invoke a proc or block on cancel. The callback usually needs to be quick and thread-safe since it
102
+ # is called in the canceler's thread. Usually the callback will just be something like pushing on a queue or
103
+ # signaling a condition variable. If the cancellation is already canceled, the callback is called inline before
104
+ # returning.
105
+ #
106
+ # @note WARNING: This is advanced API, users should use {wait} or similar.
107
+ #
108
+ # @param proc [Proc, nil] Proc to invoke, or nil to use block.
109
+ # @yield Accepts block if not using `proc`.
110
+ def add_cancel_callback(proc = nil, &block)
111
+ raise ArgumentError, 'Must provide proc or block' unless proc || block
112
+ raise ArgumentError, 'Cannot provide both proc and block' if proc && block
113
+ raise ArgumentError, 'Parameter not a proc' if proc && !proc.is_a?(Proc)
114
+
115
+ callback_to_run_immediately = @canceled_mutex.synchronize do
116
+ callback = proc || block
117
+ @cancel_callbacks.push(proc || block)
118
+ break nil unless @canceled
119
+
120
+ callback
121
+ end
122
+ callback_to_run_immediately&.call
123
+ nil
124
+ end
125
+
126
+ private
127
+
128
+ def on_cancel(reason:)
129
+ callbacks_to_run = @canceled_mutex.synchronize do
130
+ # If we're shielding, set as pending and return nil
131
+ if @shield_depth.positive?
132
+ @shield_pending_cancel = [reason]
133
+ nil
134
+ else
135
+ prepare_cancel(reason:)
136
+ end
137
+ end
138
+ callbacks_to_run&.each(&:call)
139
+ end
140
+
141
+ # Expects to be called inside mutex by caller, returns callbacks to run
142
+ def prepare_cancel(reason:)
143
+ return nil if @canceled
144
+
145
+ @canceled = true
146
+ @canceled_reason = reason
147
+ @cancel_callbacks.dup
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/api'
4
+ require 'temporalio/client/interceptor'
5
+ require 'temporalio/error'
6
+
7
+ module Temporalio
8
+ class Client
9
+ # Reference to an existing activity by its workflow ID, run ID, and activity ID.
10
+ class ActivityIDReference
11
+ # @return [String] ID for the workflow.
12
+ attr_reader :workflow_id
13
+
14
+ # @return [String, nil] Run ID for the workflow.
15
+ attr_reader :run_id
16
+
17
+ # @return [String] ID for the activity.
18
+ attr_reader :activity_id
19
+
20
+ # Create an activity ID reference.
21
+ #
22
+ # @param workflow_id [String] ID for the workflow.
23
+ # @param run_id [String, nil] Run ID for the workflow.
24
+ # @param activity_id [String] ID for the workflow.
25
+ def initialize(workflow_id:, run_id:, activity_id:)
26
+ @workflow_id = workflow_id
27
+ @run_id = run_id
28
+ @activity_id = activity_id
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,110 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'temporalio/api'
4
+ require 'temporalio/client/activity_id_reference'
5
+ require 'temporalio/client/interceptor'
6
+ require 'temporalio/error'
7
+
8
+ module Temporalio
9
+ class Client
10
+ # Handle representing an external activity for completion and heartbeat. This is usually created via
11
+ # {Client.async_activity_handle}.
12
+ class AsyncActivityHandle
13
+ # @return [String, nil] Task token if created with a task token. Mutually exclusive with {id_reference}.
14
+ attr_reader :task_token
15
+
16
+ # @return [ActivityIDReference, nil] Activity ID reference if created with one. Mutually exclusive with
17
+ # {task_token}.
18
+ attr_reader :id_reference
19
+
20
+ # @!visibility private
21
+ def initialize(client:, task_token:, id_reference:)
22
+ @client = client
23
+ @task_token = task_token
24
+ @id_reference = id_reference
25
+ end
26
+
27
+ # Record a heartbeat for the activity.
28
+ #
29
+ # @param details [Array<Object>] Details of the heartbeat.
30
+ # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
31
+ # @param rpc_timeout [Float, nil] Number of seconds before timeout.
32
+ def heartbeat(
33
+ *details,
34
+ rpc_metadata: nil,
35
+ rpc_timeout: nil
36
+ )
37
+ @client._impl.heartbeat_async_activity(Interceptor::HeartbeatAsyncActivityInput.new(
38
+ task_token_or_id_reference:,
39
+ details:,
40
+ rpc_metadata:,
41
+ rpc_timeout:
42
+ ))
43
+ end
44
+
45
+ # Complete the activity.
46
+ #
47
+ # @param result [Object, nil] Result of the activity.
48
+ # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
49
+ # @param rpc_timeout [Float, nil] Number of seconds before timeout.
50
+ def complete(
51
+ result = nil,
52
+ rpc_metadata: nil,
53
+ rpc_timeout: nil
54
+ )
55
+ @client._impl.complete_async_activity(Interceptor::CompleteAsyncActivityInput.new(
56
+ task_token_or_id_reference:,
57
+ result:,
58
+ rpc_metadata:,
59
+ rpc_timeout:
60
+ ))
61
+ end
62
+
63
+ # Fail the activity.
64
+ #
65
+ # @param error [Exception] Error for the activity.
66
+ # @param last_heartbeat_details [Array<Object>] Last heartbeat details for the activity.
67
+ # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
68
+ # @param rpc_timeout [Float, nil] Number of seconds before timeout.
69
+ def fail(
70
+ error,
71
+ last_heartbeat_details: [],
72
+ rpc_metadata: nil,
73
+ rpc_timeout: nil
74
+ )
75
+ @client._impl.fail_async_activity(Interceptor::FailAsyncActivityInput.new(
76
+ task_token_or_id_reference:,
77
+ error:,
78
+ last_heartbeat_details:,
79
+ rpc_metadata:,
80
+ rpc_timeout:
81
+ ))
82
+ end
83
+
84
+ # Report the activity as canceled.
85
+ #
86
+ # @param details [Array<Object>] Cancellation details.
87
+ # @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
88
+ # @param rpc_timeout [Float, nil] Number of seconds before timeout.
89
+ # @raise [AsyncActivityCanceledError] If the activity has been canceled.
90
+ def report_cancellation(
91
+ *details,
92
+ rpc_metadata: nil,
93
+ rpc_timeout: nil
94
+ )
95
+ @client._impl.report_cancellation_async_activity(Interceptor::ReportCancellationAsyncActivityInput.new(
96
+ task_token_or_id_reference:,
97
+ details:,
98
+ rpc_metadata:,
99
+ rpc_timeout:
100
+ ))
101
+ end
102
+
103
+ private
104
+
105
+ def task_token_or_id_reference
106
+ @task_token || @id_reference or raise
107
+ end
108
+ end
109
+ end
110
+ end