Class: Wukong::Load::LoadRunner

Inherits:
Wukong::Local::LocalRunner
  • Object
show all
Includes:
Logging
Defined in:
lib/wukong-load/load_runner.rb

Overview

Runs the wu-load command.

Instance Method Summary collapse

Instance Method Details

#data_store_nameString

The name of the data store

Returns:

  • (String)


46
47
48
# File 'lib/wukong-load/load_runner.rb', line 46

def data_store_name
  args.first
end

#processorString

The name of the processor that should handle the data store

Returns:

  • (String)


53
54
55
56
57
58
59
60
# File 'lib/wukong-load/load_runner.rb', line 53

def processor
  case data_store_name
  when 'elasticsearch'   then :elasticsearch_loader
  when 'kafka'           then :kafka_loader
  when 'mongo','mongodb' then :mongodb_loader
  when 'sql', 'mysql'    then :sql_loader
  end
end

#validatetrue

Ensure that we were passed a data store name that we know about.

Returns:

  • (true)

Raises:

  • (Wukong::Error)

    if the data store is missing or unknown



33
34
35
36
37
38
39
40
41
# File 'lib/wukong-load/load_runner.rb', line 33

def validate
  case
  when data_store_name.nil?
    raise Error.new("Must provide the name of a data store as the first argument")
  when processor.nil?
    raise Error.new("No loader defined for data store <#{data_store_name}>")
  end
  true
end