class Dynflow::Director::FlowManager

Attributes

cursor_index[R]
execution_plan[R]

Public Class Methods

new(execution_plan, flow) click to toggle source
# File lib/dynflow/director/flow_manager.rb, line 8
def initialize(execution_plan, flow)
  @execution_plan = Type! execution_plan, ExecutionPlan
  @flow           = flow
  @cursor_index   = {}
  @cursor         = build_root_cursor
end

Public Instance Methods

done?() click to toggle source
# File lib/dynflow/director/flow_manager.rb, line 15
def done?
  @cursor.done?
end
start() click to toggle source

@return [Set] of steps to continue with

# File lib/dynflow/director/flow_manager.rb, line 28
def start
  return @cursor.what_is_next.tap do |steps|
    raise 'invalid state' if steps.empty? && !done?
  end
end
what_is_next(flow_step) click to toggle source

@return [Set] of steps to continue with

# File lib/dynflow/director/flow_manager.rb, line 20
def what_is_next(flow_step)
  return [] if flow_step.state == :suspended

  success = flow_step.state != :error
  return cursor_index[flow_step.id].what_is_next(flow_step, success)
end

Private Instance Methods

build_root_cursor() click to toggle source
# File lib/dynflow/director/flow_manager.rb, line 36
def build_root_cursor
  # the root cursor has to always run against sequence
  sequence = @flow.is_a?(Flows::Sequence) ? @flow : Flows::Sequence.new([@flow])
  return SequenceCursor.new(self, sequence, nil)
end