class Flare::Tools::Cli::Index
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/flare/tools/cli/index.rb, line 30 def initialize super @output = nil @increment = nil end
Public Instance Methods
execute(config, args)
click to toggle source
# File lib/flare/tools/cli/index.rb, line 36 def execute(config, args) parse_index_server(config, args) cluster, node_map_version = Flare::Tools::Stats.open(config[:index_server_hostname], config[:index_server_port], @timeout) do |s| nodes = s.stats_nodes.sort_by{|key, val| [val['partition'], val['role'], key]} [Flare::Tools::Cluster.new(s.host, s.port, s.stats_nodes), s.stats['node_map_version']] end output = cluster.serialize(node_map_version.to_i + @increment.to_i) if @output.nil? info output else open(@output, "w") do |f| f.write(output) end end S_OK end
setup()
click to toggle source
Calls superclass method
# File lib/flare/tools/cli/index.rb, line 23 def setup super set_option_index_server @optp.on('--output=FILE', "output index to a file" ) {|v| @output = v} @optp.on('--increment=VERSION', "increment node_map_version") {|v| @increment = v} end