Class: AWS::Flow::Core::RootAsyncScope Private

Inherits:
FlowFiber
  • Object
show all
Defined in:
lib/aws/flow/async_scope.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FlowFiber

#[], [], []=, #[]=, finalize, unset

Constructor Details

#initialize(options = {}, &block) ⇒ RootAsyncScope

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RootAsyncScope.



117
118
119
120
121
122
123
124
125
# File 'lib/aws/flow/async_scope.rb', line 117

def initialize(options = {}, &block)
  @parent = options[:parent_context]
  @daemon = options[:daemon]
  @context = @parent
  @executor = AsyncEventLoop.new
  @task_queue = []
  @complete = false
  @task_queue << Task.new(context, &block) if block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



165
166
167
168
169
170
171
# File 'lib/aws/flow/async_scope.rb', line 165

def method_missing(method_name, *args)
  if DELEGATED_METHODS.include? method_name
    @executor.send(method_name, *args)
  else
    super
  end
end

Instance Attribute Details

#backtraceObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



114
115
116
# File 'lib/aws/flow/async_scope.rb', line 114

def backtrace
  @backtrace
end

#completeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



114
115
116
# File 'lib/aws/flow/async_scope.rb', line 114

def complete
  @complete
end

#executorObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



114
115
116
# File 'lib/aws/flow/async_scope.rb', line 114

def executor
  @executor
end

#failureObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



114
115
116
# File 'lib/aws/flow/async_scope.rb', line 114

def failure
  @failure
end

Instance Method Details

#<<(this_task) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



144
145
146
# File 'lib/aws/flow/async_scope.rb', line 144

def <<(this_task)
  @executor << this_task
end

#eventLoopObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Call out to the AsyncEventLoop.



156
157
158
# File 'lib/aws/flow/async_scope.rb', line 156

def eventLoop
  @executor.executeQueuedTasks
end

#fail(task, error) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

As with remove, the only thing that is under RootAsyncScope should be the root BeginRescueEnsure, so upon failure we will be complete. Also sets failure variable for later raising.



138
139
140
141
# File 'lib/aws/flow/async_scope.rb', line 138

def fail(task, error)
  @failure = error
  @complete = true
end

#get_closest_containing_scopeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return self, a RootAsyncScope is the closest containing scope.



150
151
152
# File 'lib/aws/flow/async_scope.rb', line 150

def get_closest_containing_scope
  self
end

#remove(task) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

The only thing that should be removed from the RootAsyncScope is the root BeginRescueEnsure, so upon removal we are complete.



130
131
132
# File 'lib/aws/flow/async_scope.rb', line 130

def remove(task)
  @complete = true
end