Class: Dynflow::Executors::Parallel::Pool::JobStorage
- Inherits:
-
Object
- Object
- Dynflow::Executors::Parallel::Pool::JobStorage
- Defined in:
- lib/dynflow/executors/parallel/pool.rb
Instance Method Summary collapse
- #add(work) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ JobStorage
constructor
A new instance of JobStorage.
- #pop ⇒ Object
- #queue_size(execution_plan_id = nil) ⇒ Object
Constructor Details
#initialize ⇒ JobStorage
Returns a new instance of JobStorage.
7 8 9 |
# File 'lib/dynflow/executors/parallel/pool.rb', line 7 def initialize @jobs = [] end |
Instance Method Details
#add(work) ⇒ Object
11 12 13 |
# File 'lib/dynflow/executors/parallel/pool.rb', line 11 def add(work) @jobs << work end |
#empty? ⇒ Boolean
23 24 25 |
# File 'lib/dynflow/executors/parallel/pool.rb', line 23 def empty? @jobs.empty? end |
#pop ⇒ Object
15 16 17 |
# File 'lib/dynflow/executors/parallel/pool.rb', line 15 def pop @jobs.shift end |
#queue_size(execution_plan_id = nil) ⇒ Object
19 20 21 |
# File 'lib/dynflow/executors/parallel/pool.rb', line 19 def queue_size execution_status.values.reduce(0, :+) end |