Class: ManageIQ::PostgresHaAdmin::LogicalReplicationConfigHandler
- Inherits:
-
ConfigHandler
- Object
- ConfigHandler
- ManageIQ::PostgresHaAdmin::LogicalReplicationConfigHandler
- Defined in:
- lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb
Instance Attribute Summary collapse
-
#conn_info ⇒ Object
readonly
Returns the value of attribute conn_info.
-
#subscription ⇒ Object
readonly
Returns the value of attribute subscription.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ LogicalReplicationConfigHandler
constructor
A new instance of LogicalReplicationConfigHandler.
- #name ⇒ Object
- #read ⇒ Object
- #write(_params) ⇒ Object
Methods inherited from ConfigHandler
#after_failover, #before_failover, #do_after_failover, #do_before_failover
Constructor Details
#initialize(options = {}) ⇒ LogicalReplicationConfigHandler
Returns a new instance of LogicalReplicationConfigHandler.
9 10 11 12 |
# File 'lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb', line 9 def initialize( = {}) @subscription = [:subscription] @conn_info = [:conn_info] end |
Instance Attribute Details
#conn_info ⇒ Object (readonly)
Returns the value of attribute conn_info.
7 8 9 |
# File 'lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb', line 7 def conn_info @conn_info end |
#subscription ⇒ Object (readonly)
Returns the value of attribute subscription.
7 8 9 |
# File 'lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb', line 7 def subscription @subscription end |
Instance Method Details
#name ⇒ Object
14 15 16 |
# File 'lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb', line 14 def name "Logical Replication subscription #{subscription} Config Handler" end |
#read ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb', line 18 def read conn = PG::Connection.open(@conn_info) dsn = conn.exec_params(<<~SQL, [@subscription]).first["subconninfo"] SELECT subconninfo FROM pg_subscription WHERE subname = $1 SQL PG::DSNParser.new.parse(dsn) end |
#write(_params) ⇒ Object
28 29 30 31 |
# File 'lib/manageiq/postgres_ha_admin/config_handler/logical_replication_config_handler.rb', line 28 def write(_params) # Nothing to do here as the expectation is that the user will # remove and re-add the subscription in the after failover callback end |