Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion temporalio/ext/sdk-core
12 changes: 12 additions & 0 deletions temporalio/ext/src/client_rpc_generated.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ impl Client {
"add_namespace_region" => {
rpc_call!(self, callback, call, CloudService, add_namespace_region)
}
"add_user_group_member" => {
rpc_call!(self, callback, call, CloudService, add_user_group_member)
}
"create_api_key" => rpc_call!(self, callback, call, CloudService, create_api_key),
"create_namespace" => {
rpc_call!(self, callback, call, CloudService, create_namespace)
Expand Down Expand Up @@ -594,6 +597,9 @@ impl Client {
CloudService,
delete_namespace_export_sink
),
"delete_namespace_region" => {
rpc_call!(self, callback, call, CloudService, delete_namespace_region)
}
"delete_nexus_endpoint" => {
rpc_call!(self, callback, call, CloudService, delete_nexus_endpoint)
}
Expand Down Expand Up @@ -650,8 +656,14 @@ impl Client {
"get_usage" => rpc_call!(self, callback, call, CloudService, get_usage),
"get_user" => rpc_call!(self, callback, call, CloudService, get_user),
"get_user_group" => rpc_call!(self, callback, call, CloudService, get_user_group),
"get_user_group_members" => {
rpc_call!(self, callback, call, CloudService, get_user_group_members)
}
"get_user_groups" => rpc_call!(self, callback, call, CloudService, get_user_groups),
"get_users" => rpc_call!(self, callback, call, CloudService, get_users),
"remove_user_group_member" => {
rpc_call!(self, callback, call, CloudService, remove_user_group_member)
}
"rename_custom_search_attribute" => rpc_call!(
self,
callback,
Expand Down
1 change: 1 addition & 0 deletions temporalio/lib/temporalio/activity.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# frozen_string_literal: true

require 'temporalio/activity/cancellation_details'
require 'temporalio/activity/complete_async_error'
require 'temporalio/activity/context'
require 'temporalio/activity/definition'
Expand Down
58 changes: 58 additions & 0 deletions temporalio/lib/temporalio/activity/cancellation_details.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# frozen_string_literal: true

require 'temporalio/error'

module Temporalio
module Activity
# Details that are set when an activity is cancelled. This is only valid at the time the cancel was received, the
# state may change on the server after it is received.
class CancellationDetails
def initialize(
gone_from_server: false,
cancel_requested: true,
timed_out: false,
worker_shutdown: false,
paused: false,
reset: false
)
@gone_from_server = gone_from_server
@cancel_requested = cancel_requested
@timed_out = timed_out
@worker_shutdown = worker_shutdown
@paused = paused
@reset = reset
end

# @return [Boolean] Whether the activity no longer exists on the server (may already be completed or its workflow
# may be completed).
def gone_from_server?
@gone_from_server
end

# @return [Boolean] Whether the activity was explicitly cancelled.
def cancel_requested?
@cancel_requested
end

# @return [Boolean] Whether the activity timeout caused activity to be marked cancelled.
def timed_out?
@timed_out
end

# @return [Boolean] Whether the worker the activity is running on is shutting down.
def worker_shutdown?
@worker_shutdown
end

# @return [Boolean] Whether the activity was explicitly paused.
def paused?
@paused
end

# @return [Boolean] Whether the activity was explicitly reset.
def reset?
@reset
end
end
end
end
8 changes: 8 additions & 0 deletions temporalio/lib/temporalio/activity/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ def cancellation
raise NotImplementedError
end

# @return [CancellationDetails, nil] Cancellation details if canceled. These are set just before cancellation is
# actually canceled. These details only represent when the cancel was first performed. Once set, this object is
# never mutated. Therefore, the situation on the server may have changed (e.g. unpause), but this still
# represents the values when cancellation first occurred for this attempt.
def cancellation_details
raise NotImplementedError
end

# @return [Cancellation] Cancellation that is canceled when the worker is shutting down. On worker shutdown, this
# is canceled, then the `graceful_shutdown_period` is waited (default 0s), then the activity is canceled.
def worker_shutdown_cancellation
Expand Down
Loading
Loading