Class: Pcrd::Commands::Readiness

Inherits:
Object
  • Object
show all
Defined in:
lib/pcrd/commands/readiness.rb

Overview

Builds the target-readiness manifest by comparing source and target. Read-only; does not modify either cluster.

Instance Method Summary collapse

Constructor Details

#initialize(config, options = {}) ⇒ Readiness

Returns a new instance of Readiness.



8
9
10
11
# File 'lib/pcrd/commands/readiness.rb', line 8

def initialize(config, options = {})
  @config  = config
  @options = Options.normalize(options)
end

Instance Method Details

#runObject

Raises:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pcrd/commands/readiness.rb', line 13

def run
  raise ConfigError, "target connection required for readiness" if @config.target.nil?
  raise ConfigError, "no tables configured" if (@config.migrate&.tables || []).empty?

  source = Connection::Client.new(@config.source)
  target = Connection::Client.new(@config.target)

  result = Pcrd::Readiness::Manifest.new(
    source_pool: source, target_pool: target, config: @config
  ).build

  source.close
  target.close
  result
end