Class: PgEasyReplicate::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/pg_easy_replicate/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.exit_on_failure?Boolean

Returns:

  • (Boolean)


117
118
119
# File 'lib/pg_easy_replicate/cli.rb', line 117

def self.exit_on_failure?
  true
end

Instance Method Details

#bootstrapObject



23
24
25
# File 'lib/pg_easy_replicate/cli.rb', line 23

def bootstrap
  PgEasyReplicate.bootstrap(options)
end

#cleanupObject



40
41
42
# File 'lib/pg_easy_replicate/cli.rb', line 40

def cleanup
  PgEasyReplicate.cleanup(options)
end

#config_checkObject



11
12
13
14
15
# File 'lib/pg_easy_replicate/cli.rb', line 11

def config_check
  PgEasyReplicate.assert_config

  puts "✅ Config is looking good."
end

#start_syncObject



63
64
65
# File 'lib/pg_easy_replicate/cli.rb', line 63

def start_sync
  PgEasyReplicate::Orchestrate.start_sync(options)
end

#statsObject



104
105
106
107
108
109
110
# File 'lib/pg_easy_replicate/cli.rb', line 104

def stats
  if options[:watch]
    PgEasyReplicate::Stats.follow(options[:group_name])
  else
    PgEasyReplicate::Stats.print(options[:group_name])
  end
end

#stop_syncObject



73
74
75
# File 'lib/pg_easy_replicate/cli.rb', line 73

def stop_sync
  PgEasyReplicate::Orchestrate.stop_sync(options[:group_name])
end

#switchoverObject

method_option :bi_directional,

aliases: "-b",
desc:
  "Setup replication from target database to source database"


91
92
93
94
95
96
# File 'lib/pg_easy_replicate/cli.rb', line 91

def switchover
  PgEasyReplicate::Orchestrate.switchover(
    group_name: options[:group_name],
    lag_delta_size: options[:lag_delta_size],
  )
end

#versionObject



113
114
115
# File 'lib/pg_easy_replicate/cli.rb', line 113

def version
  puts PgEasyReplicate::VERSION
end