temporalio 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/Cargo.lock +659 -370
- data/Cargo.toml +2 -2
- data/Gemfile +3 -3
- data/README.md +589 -47
- data/Rakefile +10 -296
- data/ext/Cargo.toml +1 -0
- data/lib/temporalio/activity/complete_async_error.rb +1 -1
- data/lib/temporalio/activity/context.rb +5 -2
- data/lib/temporalio/activity/definition.rb +163 -65
- data/lib/temporalio/activity/info.rb +22 -21
- data/lib/temporalio/activity.rb +2 -59
- data/lib/temporalio/api/activity/v1/message.rb +25 -0
- data/lib/temporalio/api/cloud/account/v1/message.rb +28 -0
- data/lib/temporalio/api/cloud/cloudservice/v1/request_response.rb +34 -1
- data/lib/temporalio/api/cloud/cloudservice/v1/service.rb +1 -1
- data/lib/temporalio/api/cloud/identity/v1/message.rb +6 -1
- data/lib/temporalio/api/cloud/namespace/v1/message.rb +8 -1
- data/lib/temporalio/api/cloud/nexus/v1/message.rb +31 -0
- data/lib/temporalio/api/cloud/operation/v1/message.rb +2 -1
- data/lib/temporalio/api/cloud/region/v1/message.rb +2 -1
- data/lib/temporalio/api/cloud/resource/v1/message.rb +23 -0
- data/lib/temporalio/api/cloud/sink/v1/message.rb +24 -0
- data/lib/temporalio/api/cloud/usage/v1/message.rb +31 -0
- data/lib/temporalio/api/common/v1/message.rb +7 -1
- data/lib/temporalio/api/enums/v1/event_type.rb +1 -1
- data/lib/temporalio/api/enums/v1/failed_cause.rb +1 -1
- data/lib/temporalio/api/enums/v1/reset.rb +1 -1
- data/lib/temporalio/api/history/v1/message.rb +1 -1
- data/lib/temporalio/api/nexus/v1/message.rb +2 -2
- data/lib/temporalio/api/operatorservice/v1/service.rb +1 -1
- data/lib/temporalio/api/payload_visitor.rb +1513 -0
- data/lib/temporalio/api/schedule/v1/message.rb +2 -1
- data/lib/temporalio/api/testservice/v1/request_response.rb +31 -0
- data/lib/temporalio/api/testservice/v1/service.rb +23 -0
- data/lib/temporalio/api/workflow/v1/message.rb +1 -1
- data/lib/temporalio/api/workflowservice/v1/request_response.rb +17 -2
- data/lib/temporalio/api/workflowservice/v1/service.rb +1 -1
- data/lib/temporalio/api.rb +1 -0
- data/lib/temporalio/cancellation.rb +34 -14
- data/lib/temporalio/client/async_activity_handle.rb +12 -37
- data/lib/temporalio/client/connection/cloud_service.rb +309 -231
- data/lib/temporalio/client/connection/operator_service.rb +36 -84
- data/lib/temporalio/client/connection/service.rb +6 -5
- data/lib/temporalio/client/connection/test_service.rb +111 -0
- data/lib/temporalio/client/connection/workflow_service.rb +264 -441
- data/lib/temporalio/client/connection.rb +90 -44
- data/lib/temporalio/client/interceptor.rb +160 -60
- data/lib/temporalio/client/schedule.rb +967 -0
- data/lib/temporalio/client/schedule_handle.rb +126 -0
- data/lib/temporalio/client/workflow_execution.rb +7 -10
- data/lib/temporalio/client/workflow_handle.rb +38 -95
- data/lib/temporalio/client/workflow_update_handle.rb +3 -5
- data/lib/temporalio/client.rb +122 -42
- data/lib/temporalio/common_enums.rb +17 -0
- data/lib/temporalio/converters/data_converter.rb +4 -7
- data/lib/temporalio/converters/failure_converter.rb +5 -3
- data/lib/temporalio/converters/payload_converter/composite.rb +4 -0
- data/lib/temporalio/converters/payload_converter.rb +6 -8
- data/lib/temporalio/converters/raw_value.rb +20 -0
- data/lib/temporalio/error/failure.rb +1 -1
- data/lib/temporalio/error.rb +10 -2
- data/lib/temporalio/internal/bridge/api/core_interface.rb +5 -1
- data/lib/temporalio/internal/bridge/api/nexus/nexus.rb +33 -0
- data/lib/temporalio/internal/bridge/api/workflow_activation/workflow_activation.rb +5 -1
- data/lib/temporalio/internal/bridge/api/workflow_commands/workflow_commands.rb +4 -1
- data/lib/temporalio/internal/bridge/client.rb +11 -6
- data/lib/temporalio/internal/bridge/testing.rb +20 -0
- data/lib/temporalio/internal/bridge/worker.rb +2 -0
- data/lib/temporalio/internal/bridge.rb +1 -1
- data/lib/temporalio/internal/client/implementation.rb +245 -70
- data/lib/temporalio/internal/metric.rb +122 -0
- data/lib/temporalio/internal/proto_utils.rb +86 -7
- data/lib/temporalio/internal/worker/activity_worker.rb +52 -24
- data/lib/temporalio/internal/worker/multi_runner.rb +51 -7
- data/lib/temporalio/internal/worker/workflow_instance/child_workflow_handle.rb +54 -0
- data/lib/temporalio/internal/worker/workflow_instance/context.rb +329 -0
- data/lib/temporalio/internal/worker/workflow_instance/details.rb +44 -0
- data/lib/temporalio/internal/worker/workflow_instance/external_workflow_handle.rb +32 -0
- data/lib/temporalio/internal/worker/workflow_instance/externally_immutable_hash.rb +22 -0
- data/lib/temporalio/internal/worker/workflow_instance/handler_execution.rb +25 -0
- data/lib/temporalio/internal/worker/workflow_instance/handler_hash.rb +41 -0
- data/lib/temporalio/internal/worker/workflow_instance/illegal_call_tracer.rb +97 -0
- data/lib/temporalio/internal/worker/workflow_instance/inbound_implementation.rb +62 -0
- data/lib/temporalio/internal/worker/workflow_instance/outbound_implementation.rb +415 -0
- data/lib/temporalio/internal/worker/workflow_instance/replay_safe_logger.rb +37 -0
- data/lib/temporalio/internal/worker/workflow_instance/replay_safe_metric.rb +40 -0
- data/lib/temporalio/internal/worker/workflow_instance/scheduler.rb +163 -0
- data/lib/temporalio/internal/worker/workflow_instance.rb +730 -0
- data/lib/temporalio/internal/worker/workflow_worker.rb +196 -0
- data/lib/temporalio/metric.rb +109 -0
- data/lib/temporalio/retry_policy.rb +37 -14
- data/lib/temporalio/runtime.rb +118 -75
- data/lib/temporalio/search_attributes.rb +80 -37
- data/lib/temporalio/testing/activity_environment.rb +2 -2
- data/lib/temporalio/testing/workflow_environment.rb +251 -5
- data/lib/temporalio/version.rb +1 -1
- data/lib/temporalio/worker/activity_executor/thread_pool.rb +9 -217
- data/lib/temporalio/worker/activity_executor.rb +3 -3
- data/lib/temporalio/worker/interceptor.rb +340 -66
- data/lib/temporalio/worker/thread_pool.rb +237 -0
- data/lib/temporalio/worker/workflow_executor/thread_pool.rb +230 -0
- data/lib/temporalio/worker/workflow_executor.rb +26 -0
- data/lib/temporalio/worker.rb +201 -30
- data/lib/temporalio/workflow/activity_cancellation_type.rb +20 -0
- data/lib/temporalio/workflow/child_workflow_cancellation_type.rb +21 -0
- data/lib/temporalio/workflow/child_workflow_handle.rb +43 -0
- data/lib/temporalio/workflow/definition.rb +566 -0
- data/lib/temporalio/workflow/external_workflow_handle.rb +41 -0
- data/lib/temporalio/workflow/future.rb +151 -0
- data/lib/temporalio/workflow/handler_unfinished_policy.rb +13 -0
- data/lib/temporalio/workflow/info.rb +82 -0
- data/lib/temporalio/workflow/parent_close_policy.rb +19 -0
- data/lib/temporalio/workflow/update_info.rb +20 -0
- data/lib/temporalio/workflow.rb +523 -0
- data/lib/temporalio.rb +4 -0
- data/temporalio.gemspec +2 -2
- metadata +50 -8
@@ -19,228 +19,180 @@ module Temporalio
|
|
19
19
|
# Calls OperatorService.AddSearchAttributes API call.
|
20
20
|
#
|
21
21
|
# @param request [Temporalio::Api::OperatorService::V1::AddSearchAttributesRequest] API request.
|
22
|
-
# @param
|
23
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
24
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
22
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
25
23
|
# @return [Temporalio::Api::OperatorService::V1::AddSearchAttributesResponse] API response.
|
26
|
-
def add_search_attributes(request,
|
24
|
+
def add_search_attributes(request, rpc_options: nil)
|
27
25
|
invoke_rpc(
|
28
26
|
rpc: 'add_search_attributes',
|
29
27
|
request_class: Temporalio::Api::OperatorService::V1::AddSearchAttributesRequest,
|
30
28
|
response_class: Temporalio::Api::OperatorService::V1::AddSearchAttributesResponse,
|
31
29
|
request:,
|
32
|
-
|
33
|
-
rpc_metadata:,
|
34
|
-
rpc_timeout:
|
30
|
+
rpc_options:
|
35
31
|
)
|
36
32
|
end
|
37
33
|
|
38
34
|
# Calls OperatorService.RemoveSearchAttributes API call.
|
39
35
|
#
|
40
36
|
# @param request [Temporalio::Api::OperatorService::V1::RemoveSearchAttributesRequest] API request.
|
41
|
-
# @param
|
42
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
43
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
37
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
44
38
|
# @return [Temporalio::Api::OperatorService::V1::RemoveSearchAttributesResponse] API response.
|
45
|
-
def remove_search_attributes(request,
|
39
|
+
def remove_search_attributes(request, rpc_options: nil)
|
46
40
|
invoke_rpc(
|
47
41
|
rpc: 'remove_search_attributes',
|
48
42
|
request_class: Temporalio::Api::OperatorService::V1::RemoveSearchAttributesRequest,
|
49
43
|
response_class: Temporalio::Api::OperatorService::V1::RemoveSearchAttributesResponse,
|
50
44
|
request:,
|
51
|
-
|
52
|
-
rpc_metadata:,
|
53
|
-
rpc_timeout:
|
45
|
+
rpc_options:
|
54
46
|
)
|
55
47
|
end
|
56
48
|
|
57
49
|
# Calls OperatorService.ListSearchAttributes API call.
|
58
50
|
#
|
59
51
|
# @param request [Temporalio::Api::OperatorService::V1::ListSearchAttributesRequest] API request.
|
60
|
-
# @param
|
61
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
62
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
52
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
63
53
|
# @return [Temporalio::Api::OperatorService::V1::ListSearchAttributesResponse] API response.
|
64
|
-
def list_search_attributes(request,
|
54
|
+
def list_search_attributes(request, rpc_options: nil)
|
65
55
|
invoke_rpc(
|
66
56
|
rpc: 'list_search_attributes',
|
67
57
|
request_class: Temporalio::Api::OperatorService::V1::ListSearchAttributesRequest,
|
68
58
|
response_class: Temporalio::Api::OperatorService::V1::ListSearchAttributesResponse,
|
69
59
|
request:,
|
70
|
-
|
71
|
-
rpc_metadata:,
|
72
|
-
rpc_timeout:
|
60
|
+
rpc_options:
|
73
61
|
)
|
74
62
|
end
|
75
63
|
|
76
64
|
# Calls OperatorService.DeleteNamespace API call.
|
77
65
|
#
|
78
66
|
# @param request [Temporalio::Api::OperatorService::V1::DeleteNamespaceRequest] API request.
|
79
|
-
# @param
|
80
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
81
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
67
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
82
68
|
# @return [Temporalio::Api::OperatorService::V1::DeleteNamespaceResponse] API response.
|
83
|
-
def delete_namespace(request,
|
69
|
+
def delete_namespace(request, rpc_options: nil)
|
84
70
|
invoke_rpc(
|
85
71
|
rpc: 'delete_namespace',
|
86
72
|
request_class: Temporalio::Api::OperatorService::V1::DeleteNamespaceRequest,
|
87
73
|
response_class: Temporalio::Api::OperatorService::V1::DeleteNamespaceResponse,
|
88
74
|
request:,
|
89
|
-
|
90
|
-
rpc_metadata:,
|
91
|
-
rpc_timeout:
|
75
|
+
rpc_options:
|
92
76
|
)
|
93
77
|
end
|
94
78
|
|
95
79
|
# Calls OperatorService.AddOrUpdateRemoteCluster API call.
|
96
80
|
#
|
97
81
|
# @param request [Temporalio::Api::OperatorService::V1::AddOrUpdateRemoteClusterRequest] API request.
|
98
|
-
# @param
|
99
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
100
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
82
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
101
83
|
# @return [Temporalio::Api::OperatorService::V1::AddOrUpdateRemoteClusterResponse] API response.
|
102
|
-
def add_or_update_remote_cluster(request,
|
84
|
+
def add_or_update_remote_cluster(request, rpc_options: nil)
|
103
85
|
invoke_rpc(
|
104
86
|
rpc: 'add_or_update_remote_cluster',
|
105
87
|
request_class: Temporalio::Api::OperatorService::V1::AddOrUpdateRemoteClusterRequest,
|
106
88
|
response_class: Temporalio::Api::OperatorService::V1::AddOrUpdateRemoteClusterResponse,
|
107
89
|
request:,
|
108
|
-
|
109
|
-
rpc_metadata:,
|
110
|
-
rpc_timeout:
|
90
|
+
rpc_options:
|
111
91
|
)
|
112
92
|
end
|
113
93
|
|
114
94
|
# Calls OperatorService.RemoveRemoteCluster API call.
|
115
95
|
#
|
116
96
|
# @param request [Temporalio::Api::OperatorService::V1::RemoveRemoteClusterRequest] API request.
|
117
|
-
# @param
|
118
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
119
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
97
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
120
98
|
# @return [Temporalio::Api::OperatorService::V1::RemoveRemoteClusterResponse] API response.
|
121
|
-
def remove_remote_cluster(request,
|
99
|
+
def remove_remote_cluster(request, rpc_options: nil)
|
122
100
|
invoke_rpc(
|
123
101
|
rpc: 'remove_remote_cluster',
|
124
102
|
request_class: Temporalio::Api::OperatorService::V1::RemoveRemoteClusterRequest,
|
125
103
|
response_class: Temporalio::Api::OperatorService::V1::RemoveRemoteClusterResponse,
|
126
104
|
request:,
|
127
|
-
|
128
|
-
rpc_metadata:,
|
129
|
-
rpc_timeout:
|
105
|
+
rpc_options:
|
130
106
|
)
|
131
107
|
end
|
132
108
|
|
133
109
|
# Calls OperatorService.ListClusters API call.
|
134
110
|
#
|
135
111
|
# @param request [Temporalio::Api::OperatorService::V1::ListClustersRequest] API request.
|
136
|
-
# @param
|
137
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
138
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
112
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
139
113
|
# @return [Temporalio::Api::OperatorService::V1::ListClustersResponse] API response.
|
140
|
-
def list_clusters(request,
|
114
|
+
def list_clusters(request, rpc_options: nil)
|
141
115
|
invoke_rpc(
|
142
116
|
rpc: 'list_clusters',
|
143
117
|
request_class: Temporalio::Api::OperatorService::V1::ListClustersRequest,
|
144
118
|
response_class: Temporalio::Api::OperatorService::V1::ListClustersResponse,
|
145
119
|
request:,
|
146
|
-
|
147
|
-
rpc_metadata:,
|
148
|
-
rpc_timeout:
|
120
|
+
rpc_options:
|
149
121
|
)
|
150
122
|
end
|
151
123
|
|
152
124
|
# Calls OperatorService.GetNexusEndpoint API call.
|
153
125
|
#
|
154
126
|
# @param request [Temporalio::Api::OperatorService::V1::GetNexusEndpointRequest] API request.
|
155
|
-
# @param
|
156
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
157
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
127
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
158
128
|
# @return [Temporalio::Api::OperatorService::V1::GetNexusEndpointResponse] API response.
|
159
|
-
def get_nexus_endpoint(request,
|
129
|
+
def get_nexus_endpoint(request, rpc_options: nil)
|
160
130
|
invoke_rpc(
|
161
131
|
rpc: 'get_nexus_endpoint',
|
162
132
|
request_class: Temporalio::Api::OperatorService::V1::GetNexusEndpointRequest,
|
163
133
|
response_class: Temporalio::Api::OperatorService::V1::GetNexusEndpointResponse,
|
164
134
|
request:,
|
165
|
-
|
166
|
-
rpc_metadata:,
|
167
|
-
rpc_timeout:
|
135
|
+
rpc_options:
|
168
136
|
)
|
169
137
|
end
|
170
138
|
|
171
139
|
# Calls OperatorService.CreateNexusEndpoint API call.
|
172
140
|
#
|
173
141
|
# @param request [Temporalio::Api::OperatorService::V1::CreateNexusEndpointRequest] API request.
|
174
|
-
# @param
|
175
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
176
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
142
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
177
143
|
# @return [Temporalio::Api::OperatorService::V1::CreateNexusEndpointResponse] API response.
|
178
|
-
def create_nexus_endpoint(request,
|
144
|
+
def create_nexus_endpoint(request, rpc_options: nil)
|
179
145
|
invoke_rpc(
|
180
146
|
rpc: 'create_nexus_endpoint',
|
181
147
|
request_class: Temporalio::Api::OperatorService::V1::CreateNexusEndpointRequest,
|
182
148
|
response_class: Temporalio::Api::OperatorService::V1::CreateNexusEndpointResponse,
|
183
149
|
request:,
|
184
|
-
|
185
|
-
rpc_metadata:,
|
186
|
-
rpc_timeout:
|
150
|
+
rpc_options:
|
187
151
|
)
|
188
152
|
end
|
189
153
|
|
190
154
|
# Calls OperatorService.UpdateNexusEndpoint API call.
|
191
155
|
#
|
192
156
|
# @param request [Temporalio::Api::OperatorService::V1::UpdateNexusEndpointRequest] API request.
|
193
|
-
# @param
|
194
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
195
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
157
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
196
158
|
# @return [Temporalio::Api::OperatorService::V1::UpdateNexusEndpointResponse] API response.
|
197
|
-
def update_nexus_endpoint(request,
|
159
|
+
def update_nexus_endpoint(request, rpc_options: nil)
|
198
160
|
invoke_rpc(
|
199
161
|
rpc: 'update_nexus_endpoint',
|
200
162
|
request_class: Temporalio::Api::OperatorService::V1::UpdateNexusEndpointRequest,
|
201
163
|
response_class: Temporalio::Api::OperatorService::V1::UpdateNexusEndpointResponse,
|
202
164
|
request:,
|
203
|
-
|
204
|
-
rpc_metadata:,
|
205
|
-
rpc_timeout:
|
165
|
+
rpc_options:
|
206
166
|
)
|
207
167
|
end
|
208
168
|
|
209
169
|
# Calls OperatorService.DeleteNexusEndpoint API call.
|
210
170
|
#
|
211
171
|
# @param request [Temporalio::Api::OperatorService::V1::DeleteNexusEndpointRequest] API request.
|
212
|
-
# @param
|
213
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
214
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
172
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
215
173
|
# @return [Temporalio::Api::OperatorService::V1::DeleteNexusEndpointResponse] API response.
|
216
|
-
def delete_nexus_endpoint(request,
|
174
|
+
def delete_nexus_endpoint(request, rpc_options: nil)
|
217
175
|
invoke_rpc(
|
218
176
|
rpc: 'delete_nexus_endpoint',
|
219
177
|
request_class: Temporalio::Api::OperatorService::V1::DeleteNexusEndpointRequest,
|
220
178
|
response_class: Temporalio::Api::OperatorService::V1::DeleteNexusEndpointResponse,
|
221
179
|
request:,
|
222
|
-
|
223
|
-
rpc_metadata:,
|
224
|
-
rpc_timeout:
|
180
|
+
rpc_options:
|
225
181
|
)
|
226
182
|
end
|
227
183
|
|
228
184
|
# Calls OperatorService.ListNexusEndpoints API call.
|
229
185
|
#
|
230
186
|
# @param request [Temporalio::Api::OperatorService::V1::ListNexusEndpointsRequest] API request.
|
231
|
-
# @param
|
232
|
-
# @param rpc_metadata [Hash<String, String>, nil] Headers to include on the RPC call.
|
233
|
-
# @param rpc_timeout [Float, nil] Number of seconds before timeout.
|
187
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
234
188
|
# @return [Temporalio::Api::OperatorService::V1::ListNexusEndpointsResponse] API response.
|
235
|
-
def list_nexus_endpoints(request,
|
189
|
+
def list_nexus_endpoints(request, rpc_options: nil)
|
236
190
|
invoke_rpc(
|
237
191
|
rpc: 'list_nexus_endpoints',
|
238
192
|
request_class: Temporalio::Api::OperatorService::V1::ListNexusEndpointsRequest,
|
239
193
|
response_class: Temporalio::Api::OperatorService::V1::ListNexusEndpointsResponse,
|
240
194
|
request:,
|
241
|
-
|
242
|
-
rpc_metadata:,
|
243
|
-
rpc_timeout:
|
195
|
+
rpc_options:
|
244
196
|
)
|
245
197
|
end
|
246
198
|
end
|
@@ -17,8 +17,7 @@ module Temporalio
|
|
17
17
|
|
18
18
|
protected
|
19
19
|
|
20
|
-
def invoke_rpc(rpc:, request_class:, response_class:, request:,
|
21
|
-
rpc_timeout:)
|
20
|
+
def invoke_rpc(rpc:, request_class:, response_class:, request:, rpc_options:)
|
22
21
|
raise 'Invalid request type' unless request.is_a?(request_class)
|
23
22
|
|
24
23
|
begin
|
@@ -27,11 +26,13 @@ module Temporalio
|
|
27
26
|
rpc:,
|
28
27
|
request:,
|
29
28
|
response_class:,
|
30
|
-
|
31
|
-
rpc_metadata:,
|
32
|
-
rpc_timeout:
|
29
|
+
rpc_options:
|
33
30
|
)
|
34
31
|
rescue Internal::Bridge::Client::RPCFailure => e
|
32
|
+
if e.code == Error::RPCError::Code::CANCELED && e.message == '<__user_canceled__>'
|
33
|
+
raise Error::CanceledError, 'User canceled'
|
34
|
+
end
|
35
|
+
|
35
36
|
raise Error::RPCError.new(e.message, code: e.code, raw_grpc_status: e.details)
|
36
37
|
end
|
37
38
|
end
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Generated code. DO NOT EDIT!
|
4
|
+
|
5
|
+
require 'temporalio/api'
|
6
|
+
require 'temporalio/client/connection/service'
|
7
|
+
require 'temporalio/internal/bridge/client'
|
8
|
+
|
9
|
+
module Temporalio
|
10
|
+
class Client
|
11
|
+
class Connection
|
12
|
+
# TestService API.
|
13
|
+
class TestService < Service
|
14
|
+
# @!visibility private
|
15
|
+
def initialize(connection)
|
16
|
+
super(connection, Internal::Bridge::Client::SERVICE_TEST)
|
17
|
+
end
|
18
|
+
|
19
|
+
# Calls TestService.LockTimeSkipping API call.
|
20
|
+
#
|
21
|
+
# @param request [Temporalio::Api::TestService::V1::LockTimeSkippingRequest] API request.
|
22
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
23
|
+
# @return [Temporalio::Api::TestService::V1::LockTimeSkippingResponse] API response.
|
24
|
+
def lock_time_skipping(request, rpc_options: nil)
|
25
|
+
invoke_rpc(
|
26
|
+
rpc: 'lock_time_skipping',
|
27
|
+
request_class: Temporalio::Api::TestService::V1::LockTimeSkippingRequest,
|
28
|
+
response_class: Temporalio::Api::TestService::V1::LockTimeSkippingResponse,
|
29
|
+
request:,
|
30
|
+
rpc_options:
|
31
|
+
)
|
32
|
+
end
|
33
|
+
|
34
|
+
# Calls TestService.UnlockTimeSkipping API call.
|
35
|
+
#
|
36
|
+
# @param request [Temporalio::Api::TestService::V1::UnlockTimeSkippingRequest] API request.
|
37
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
38
|
+
# @return [Temporalio::Api::TestService::V1::UnlockTimeSkippingResponse] API response.
|
39
|
+
def unlock_time_skipping(request, rpc_options: nil)
|
40
|
+
invoke_rpc(
|
41
|
+
rpc: 'unlock_time_skipping',
|
42
|
+
request_class: Temporalio::Api::TestService::V1::UnlockTimeSkippingRequest,
|
43
|
+
response_class: Temporalio::Api::TestService::V1::UnlockTimeSkippingResponse,
|
44
|
+
request:,
|
45
|
+
rpc_options:
|
46
|
+
)
|
47
|
+
end
|
48
|
+
|
49
|
+
# Calls TestService.Sleep API call.
|
50
|
+
#
|
51
|
+
# @param request [Temporalio::Api::TestService::V1::SleepRequest] API request.
|
52
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
53
|
+
# @return [Temporalio::Api::TestService::V1::SleepResponse] API response.
|
54
|
+
def sleep(request, rpc_options: nil)
|
55
|
+
invoke_rpc(
|
56
|
+
rpc: 'sleep',
|
57
|
+
request_class: Temporalio::Api::TestService::V1::SleepRequest,
|
58
|
+
response_class: Temporalio::Api::TestService::V1::SleepResponse,
|
59
|
+
request:,
|
60
|
+
rpc_options:
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
# Calls TestService.SleepUntil API call.
|
65
|
+
#
|
66
|
+
# @param request [Temporalio::Api::TestService::V1::SleepUntilRequest] API request.
|
67
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
68
|
+
# @return [Temporalio::Api::TestService::V1::SleepResponse] API response.
|
69
|
+
def sleep_until(request, rpc_options: nil)
|
70
|
+
invoke_rpc(
|
71
|
+
rpc: 'sleep_until',
|
72
|
+
request_class: Temporalio::Api::TestService::V1::SleepUntilRequest,
|
73
|
+
response_class: Temporalio::Api::TestService::V1::SleepResponse,
|
74
|
+
request:,
|
75
|
+
rpc_options:
|
76
|
+
)
|
77
|
+
end
|
78
|
+
|
79
|
+
# Calls TestService.UnlockTimeSkippingWithSleep API call.
|
80
|
+
#
|
81
|
+
# @param request [Temporalio::Api::TestService::V1::SleepRequest] API request.
|
82
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
83
|
+
# @return [Temporalio::Api::TestService::V1::SleepResponse] API response.
|
84
|
+
def unlock_time_skipping_with_sleep(request, rpc_options: nil)
|
85
|
+
invoke_rpc(
|
86
|
+
rpc: 'unlock_time_skipping_with_sleep',
|
87
|
+
request_class: Temporalio::Api::TestService::V1::SleepRequest,
|
88
|
+
response_class: Temporalio::Api::TestService::V1::SleepResponse,
|
89
|
+
request:,
|
90
|
+
rpc_options:
|
91
|
+
)
|
92
|
+
end
|
93
|
+
|
94
|
+
# Calls TestService.GetCurrentTime API call.
|
95
|
+
#
|
96
|
+
# @param request [Google::Protobuf::Empty] API request.
|
97
|
+
# @param rpc_options [RPCOptions, nil] Advanced RPC options.
|
98
|
+
# @return [Temporalio::Api::TestService::V1::GetCurrentTimeResponse] API response.
|
99
|
+
def get_current_time(request, rpc_options: nil)
|
100
|
+
invoke_rpc(
|
101
|
+
rpc: 'get_current_time',
|
102
|
+
request_class: Google::Protobuf::Empty,
|
103
|
+
response_class: Temporalio::Api::TestService::V1::GetCurrentTimeResponse,
|
104
|
+
request:,
|
105
|
+
rpc_options:
|
106
|
+
)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|