Sha256: aa1fbc624504b0d7edaeb3fbfe3668a9d0cacc8e3b2463abfe34cb33d7f9fe8f
Contents?: true
Size: 995 Bytes
Versions: 5
Compression:
Stored size: 995 Bytes
Contents
class MasterLoader include Singleton attr_accessor_nn :raw_table_load_order, :db_ops, :block_size fattr(:raw_table_delete_order) { raw_table_load_order.reverse } fattr(:tables_in_load_order) do raw_table_load_order.map { |x| table_hash[x.to_s]||raise("can't find table #{x}") } end fattr(:tables_in_delete_order) do raw_table_delete_order.map { |x| table_hash[x.to_s]||raise("can't find table #{x}") } end fattr(:table_hash) { {} } def add(tl) self.table_hash[tl.table_name.to_s] = tl end def delete_rows! tables_in_delete_order.each { |t| t.manager.delete_rows! } end def load_rows! tables_in_load_order.each { |t| t.loader.load! } end def run! tables_in_load_order.each do |t| t.loader.block_size = block_size end tm("MasterLoader run") do connect! delete_rows! load_rows! end end def connect! ActiveRecord::Base.establish_connection(db_ops) Dataload.log "Established Connection" end end
Version data entries
5 entries across 5 versions & 1 rubygems