Class: Gizzard::LookupCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/gizzard/commands.rb

Instance Attribute Summary

Attributes inherited from Command

#argv, #buffer, #command_options, #global_options, #job_injector, #manager

Instance Method Summary collapse

Methods inherited from Command

classify, #confirm!, #get_base_name, #help!, #initialize, make_job_injector, make_manager, #output, #require_tables, #require_template_options, run

Constructor Details

This class inherits a constructor from Gizzard::Command

Instance Method Details

#runObject



530
531
532
533
534
535
536
537
538
539
540
541
# File 'lib/gizzard/commands.rb', line 530

def run
  table_id, source = @argv
  help!("Requires table id and source") unless table_id && source
  case @command_options.hash_function
  when :fnv
    source_id = Digest.fnv1a_64(source)
  else
    source_id = source.to_i
  end
  shard = manager.find_current_forwarding(table_id.to_i, source_id)
  output shard.id.to_unix
end