Class: Pcrd::Commands::Status
- Inherits:
-
Object
- Object
- Pcrd::Commands::Status
- Defined in:
- lib/pcrd/commands/status.rb
Overview
Displays the current migration state from the checkpoint database and (optionally) queries the live replication slot for current lag.
Reads entirely from local state (checkpoint SQLite) so it works without an active connection to source or target. If source is reachable, also shows live replication lag and estimated time to cutover readiness.
Constant Summary collapse
- PASTEL =
Pastel.new
- PHASE_LABELS =
{ new: "not started", backfill: "backfill in progress", streaming: "streaming (catchup phase)", cutover: "cutover complete" }.freeze
Instance Method Summary collapse
-
#initialize(config, options = {}) ⇒ Status
constructor
A new instance of Status.
- #run ⇒ Object
Constructor Details
Instance Method Details
#run ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/pcrd/commands/status.rb', line 28 def run checkpoint_path = @config.migrate&.checkpoint_db || "./pcrd_checkpoint.sqlite3" unless File.exist?(checkpoint_path) puts puts " #{PASTEL.yellow("No checkpoint found at #{checkpoint_path}")}" puts " Run `pcrd migrate` to start the migration." puts return end store = Checkpoint::Store.new(checkpoint_path) print_status(store) store.close end |