Class: Dynflow::Director::FlowManager

Inherits:
Object
  • Object
show all
Includes:
Algebrick::TypeCheck
Defined in:
lib/dynflow/director/flow_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(execution_plan, flow) ⇒ FlowManager

Returns a new instance of FlowManager.



10
11
12
13
14
15
# File 'lib/dynflow/director/flow_manager.rb', line 10

def initialize(execution_plan, flow)
  @execution_plan = Type! execution_plan, ExecutionPlan
  @flow           = flow
  @cursor_index   = {}
  @cursor         = build_root_cursor
end

Instance Attribute Details

#cursor_indexObject (readonly)

Returns the value of attribute cursor_index.



8
9
10
# File 'lib/dynflow/director/flow_manager.rb', line 8

def cursor_index
  @cursor_index
end

#execution_planObject (readonly)

Returns the value of attribute execution_plan.



8
9
10
# File 'lib/dynflow/director/flow_manager.rb', line 8

def execution_plan
  @execution_plan
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/dynflow/director/flow_manager.rb', line 17

def done?
  @cursor.done?
end

#startSet

Returns of steps to continue with.

Returns:

  • (Set)

    of steps to continue with



30
31
32
33
34
# File 'lib/dynflow/director/flow_manager.rb', line 30

def start
  return @cursor.what_is_next.tap do |steps|
    raise 'invalid state' if steps.empty? && !done?
  end
end

#what_is_next(flow_step) ⇒ Set

Returns of steps to continue with.

Returns:

  • (Set)

    of steps to continue with



22
23
24
25
26
27
# File 'lib/dynflow/director/flow_manager.rb', line 22

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