Class: Kafkat::Command::Describe

Inherits:
Base
  • Object
show all
Defined in:
lib/kafkat/command/partitions.rb

Instance Attribute Summary

Attributes inherited from Base

#config

Instance Method Summary collapse

Methods inherited from Base

#admin, #initialize, #kafka_logs, register_as, usage, usages, #zookeeper

Methods included from Logging

#print_err

Methods included from Kafkat::CommandIO

#prompt_and_execute_assignments

Methods included from Formatting

#justify, #print_assignment, #print_assignment_header, #print_broker, #print_broker_header, #print_partition, #print_partition_header, #print_topic, #print_topic_header, #print_topic_name

Constructor Details

This class inherits a constructor from Kafkat::Command::Base

Instance Method Details

#runObject



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/kafkat/command/partitions.rb', line 13

def run
  topic_name = ARGV.shift unless ARGV[0] && ARGV[0].start_with?('--')
  topic_names = topic_name && [topic_name]

  @options = Trollop.options do
    opt :under_replicated, "only under-replicated"
    opt :unavailable, "only unavailable"
  end

  brokers = zookeeper.get_brokers
  topics = zookeeper.get_topics(topic_names)

  print_partition_header
  topics.each do |name, t|
    t.partitions.each do |p|
      print_partition(p) if selected?(p, brokers)
    end
  end
end