Sha256: c2fd695850ff8a695d62caa834cef4f83093c23b4f711d0e05f002faf74a51dc

Contents?: true

Size: 939 Bytes

Versions: 2

Compression:

Stored size: 939 Bytes

Contents

#
#  Copyright (c) 2011, SoundCloud Ltd., Rany Keddo, Tobias Bielohlawek, Tobias
#  Schmidt
#
#  Copies an origin table to an altered destination table. Live activity is
#  synchronized into the destination table using triggers.
#
#  Once the origin and destination tables have converged, origin is archived
#  and replaced by destination.
#

require 'lhm/chunker'
require 'lhm/entangler'
require 'lhm/locked_switcher'
require 'lhm/migration'
require 'lhm/migrator'

module Lhm
  class Invoker
    attr_reader :migrator

    def initialize(origin, connection)
      @connection = connection
      @migrator = Migrator.new(origin, connection)
    end

    def run(chunk_options = {})
      migration = @migrator.run

      Entangler.new(migration, @connection).run do |tangler|
        Chunker.new(migration, tangler.epoch, @connection, chunk_options).run
        LockedSwitcher.new(migration, @connection).run
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lhm-1.0.0.rc2 lib/lhm/invoker.rb
lhm-1.0.0.rc.1 lib/lhm/invoker.rb