class DruidConfig::Entities::Tier

Tier class

Attributes

name[R]

Readers

nodes[R]

Readers

servers[R]

Readers

Public Class Methods

new(name, nodes) click to toggle source
# File lib/druid_config/entities/tier.rb, line 10
def initialize(name, nodes)
  @name = name
  @nodes = nodes
end

Public Instance Methods

free() click to toggle source
# File lib/druid_config/entities/tier.rb, line 27
def free
  return @free if @free
  @free = (max_size - size) > 0 ? (max_size - size) : 0
end
historicals() click to toggle source
# File lib/druid_config/entities/tier.rb, line 37
def historicals
  nodes.select { |node| node.type == :historical }
end
max_size() click to toggle source
# File lib/druid_config/entities/tier.rb, line 23
def max_size
  @max_size ||= nodes.map(&:max_size).inject(:+)
end
segments() click to toggle source
# File lib/druid_config/entities/tier.rb, line 41
def segments
  @segments ||= nodes.map(&:segments)
                .flatten.sort_by { |seg| seg.interval.first }
end
segments_count() click to toggle source
# File lib/druid_config/entities/tier.rb, line 46
def segments_count
  @segments_count ||= nodes.map(&:segments_count).inject(:+)
end
segments_to_drop() click to toggle source
# File lib/druid_config/entities/tier.rb, line 55
def segments_to_drop
  @segments_to_drop ||= nodes.map(&:segments_to_drop)
                        .flatten.sort_by { |seg| seg.interval.first }
end
segments_to_drop_count() click to toggle source
# File lib/druid_config/entities/tier.rb, line 65
def segments_to_drop_count
  @segments_to_drop_count ||=
    nodes.map(&:segments_to_drop_count).inject(:+)
end
segments_to_drop_size() click to toggle source
# File lib/druid_config/entities/tier.rb, line 75
def segments_to_drop_size
  @segments_to_drop_size ||=
    nodes.map(&:segments_to_drop_size).reduce(:+)
end
segments_to_load() click to toggle source
# File lib/druid_config/entities/tier.rb, line 50
def segments_to_load
  @segments_to_load ||= nodes.map(&:segments_to_load)
                        .flatten.sort_by { |seg| seg.interval.first }
end
segments_to_load_count() click to toggle source
# File lib/druid_config/entities/tier.rb, line 60
def segments_to_load_count
  @segments_to_load_count ||=
    nodes.map(&:segments_to_load_count).inject(:+)
end
segments_to_load_size() click to toggle source
# File lib/druid_config/entities/tier.rb, line 70
def segments_to_load_size
  @segments_to_load_size ||=
    nodes.map(&:segments_to_load_size).reduce(:+)
end
size() click to toggle source
# File lib/druid_config/entities/tier.rb, line 17
def size
  @size ||= nodes.map(&:size).inject(:+)
end
Also aliased as: used
used()
Alias for: size
used_percent() click to toggle source
# File lib/druid_config/entities/tier.rb, line 32
def used_percent
  return 0 unless max_size && max_size != 0
  ((size.to_f / max_size) * 100).round(2)
end