Class: Smith::Workflow::PreparedStepExecutionAuthorization
- Inherits:
-
Object
- Object
- Smith::Workflow::PreparedStepExecutionAuthorization
show all
- Defined in:
- lib/smith/workflow/prepared_step_execution_authorization.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of PreparedStepExecutionAuthorization.
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 17
def initialize(prepared_step:, dispatch_claim:, execution_bindings:)
unless prepared_step.is_a?(PreparedStep)
raise ArgumentError, "prepared_step must be a Smith::Workflow::PreparedStep"
end
unless dispatch_claim.nil? || dispatch_claim.is_a?(PreparedStepDispatch)
raise ArgumentError, "dispatch_claim must be a Smith::Workflow::PreparedStepDispatch or nil"
end
if dispatch_claim && dispatch_claim.prepared_step.to_h != prepared_step.to_h
raise ArgumentError, "dispatch claim must belong to the prepared step"
end
unless execution_bindings.is_a?(SplitStepPersistence::ExecutionBindingSnapshot)
raise ArgumentError, "execution_bindings must be a Smith execution binding snapshot"
end
@prepared_step = prepared_step
@dispatch_claim = dispatch_claim
@execution_bindings = execution_bindings
@execution_scope = PreparedStepExecutionScope.new
@process_id = Process.pid
freeze
end
|
Instance Attribute Details
#dispatch_claim ⇒ Object
Returns the value of attribute dispatch_claim.
15
16
17
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 15
def dispatch_claim
@dispatch_claim
end
|
#prepared_step ⇒ Object
Returns the value of attribute prepared_step.
15
16
17
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 15
def prepared_step
@prepared_step
end
|
Instance Method Details
#active_in_current_execution? ⇒ Boolean
60
61
62
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 60
def active_in_current_execution?
issued_in_current_process? && @execution_scope.active_for?(Thread.current, Fiber.current)
end
|
#each_agent_binding(&block) ⇒ Object
47
48
49
50
51
52
53
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 47
def each_agent_binding(&block)
ensure_binding_access!
raise ArgumentError, "a block is required to inspect captured agent bindings" unless block
@execution_bindings.each_agent_binding(&block)
self
end
|
#fetch_agent! ⇒ Object
41
42
43
44
45
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 41
def fetch_agent!(...)
ensure_binding_access!
@execution_bindings.fetch!(...)
end
|
#issued_in_current_process? ⇒ Boolean
39
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 39
def issued_in_current_process? = @process_id == Process.pid
|
#verify_workflow!(workflow_class) ⇒ Object
55
56
57
58
|
# File 'lib/smith/workflow/prepared_step_execution_authorization.rb', line 55
def verify_workflow!(workflow_class)
ensure_active_execution!
@execution_bindings.verify_workflow!(workflow_class)
end
|