class DumpTruck
Constants
- VERSION
Attributes
config[R]
Public Class Methods
new(&block)
click to toggle source
# File lib/dump_truck.rb, line 18 def initialize(&block) @config = Configuration.new(&block) end
Public Instance Methods
dump()
click to toggle source
# File lib/dump_truck.rb, line 22 def dump config.each_database do |db_config| dump_database(db_config) end end
Private Instance Methods
client_for(type, db_config, schema_config)
click to toggle source
# File lib/dump_truck.rb, line 56 def client_for(type, db_config, schema_config) case type.to_sym when :mysql Mysql::Client.new(db_config, schema_config) else raise "Unknown type #{type}" end end
dump_database(db_config)
click to toggle source
# File lib/dump_truck.rb, line 30 def dump_database(db_config) db_config.each_schema.map do |schema_config| truck(db_config, schema_config) end.map do |truck| Thread.new(truck){|t| t.dump} end.each do |thread| thread.join end end
translator_for(type)
click to toggle source
# File lib/dump_truck.rb, line 47 def translator_for(type) case type.to_sym when :mysql Mysql::Translator.new else raise "Unknown type #{type}" end end
truck(db_config, schema_config)
click to toggle source
# File lib/dump_truck.rb, line 40 def truck(db_config, schema_config) translator = translator_for(db_config.type) client = client_for(db_config.type, db_config, schema_config) LoggableTruck.new(schema_config, client, translator, config.logger) end