Sha256: 12a60c3fc6a2cbc219625c7105d28beee849c4ab9c0ce4f51f7d72265fe9da9c

Contents?: true

Size: 960 Bytes

Versions: 20

Compression:

Stored size: 960 Bytes

Contents

# frozen_string_literal: true
# This implements a priority in which keys are given values that will keep them
# in the same priority in which they priorities are requested. Nested
# structures (those in which a key is contained within another key) are
# preserved in such a way that child keys are after the parent and before the
# key after the parent.
#
# @api private
class Puppet::Graph::SequentialPrioritizer < Puppet::Graph::Prioritizer
  def initialize
    super
    @container = {}
    @count = Puppet::Graph::Key.new
  end

  def generate_priority_for(key)
    if priority_of(key).nil?
      @count = @count.next
      record_priority_for(key, @count)
    else
      priority_of(key)
    end
  end

  def generate_priority_contained_in(container, key)
    @container[container] ||= priority_of(container).down
    priority = @container[container].next
    record_priority_for(key, priority)
    @container[container] = priority
    priority
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
puppet-8.3.0 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.0-x86-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.0-x64-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.0-universal-darwin lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.1 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.1-x86-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.1-x64-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.3.1-universal-darwin lib/puppet/graph/sequential_prioritizer.rb
puppet-8.2.0 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.2.0-x86-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.2.0-x64-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.2.0-universal-darwin lib/puppet/graph/sequential_prioritizer.rb
puppet-8.1.0 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.1.0-x86-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.1.0-x64-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.1.0-universal-darwin lib/puppet/graph/sequential_prioritizer.rb
puppet-8.0.1 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.0.1-x86-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.0.1-x64-mingw32 lib/puppet/graph/sequential_prioritizer.rb
puppet-8.0.1-universal-darwin lib/puppet/graph/sequential_prioritizer.rb