Class: Bosh::Director::DeploymentPlan::PlacementPlanner::BruteForceIpAllocation::AllocatedIps
- Inherits:
-
Object
- Object
- Bosh::Director::DeploymentPlan::PlacementPlanner::BruteForceIpAllocation::AllocatedIps
- Defined in:
- lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb
Instance Method Summary collapse
- #allocate(az_name) ⇒ Object
-
#initialize ⇒ AllocatedIps
constructor
A new instance of AllocatedIps.
- #sort_by_least_allocated_ips(az_names) ⇒ Object
Constructor Details
#initialize ⇒ AllocatedIps
Returns a new instance of AllocatedIps.
85 86 87 |
# File 'lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb', line 85 def initialize @allocated_ips = Hash.new {|h,k| h[k] = 0 } end |
Instance Method Details
#allocate(az_name) ⇒ Object
89 90 91 |
# File 'lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb', line 89 def allocate(az_name) @allocated_ips[az_name] += 1 end |
#sort_by_least_allocated_ips(az_names) ⇒ Object
93 94 95 96 97 |
# File 'lib/bosh/director/deployment_plan/placement_planner/bruteforce_ip_allocation.rb', line 93 def sort_by_least_allocated_ips(az_names) az_names.sort_by do |az_name| @allocated_ips[az_name] end end |