Sha256: 16faa439ac30e4957816ff52397d32ebc2d63952640f7f1f1848ce3c097ebb82

Contents?: true

Size: 707 Bytes

Versions: 2

Compression:

Stored size: 707 Bytes

Contents

# frozen_string_literal: true

module Dynflow
  class ExecutionPlan::DependencyGraph
    def initialize
      @graph = Hash.new { |h, k| h[k] = Set.new }
    end

    # adds dependencies to graph that +step+ has based
    # on the steps referenced in its +input+
    def add_dependencies(step, action)
      action.required_step_ids.each do |required_step_id|
        @graph[step.id] << required_step_id
      end
    end

    def required_step_ids(step_id)
      @graph[step_id]
    end

    def mark_satisfied(step_id, required_step_id)
      @graph[step_id].delete(required_step_id)
    end

    def unresolved?
      @graph.any? { |step_id, required_step_ids| required_step_ids.any? }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dynflow-1.9.0 lib/dynflow/execution_plan/dependency_graph.rb
dynflow-1.8.3 lib/dynflow/execution_plan/dependency_graph.rb