Class: ManageIQ::PostgresHaAdmin::ConfigHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/manageiq/postgres_ha_admin/config_handler.rb

Instance Method Summary collapse

Instance Method Details

#after_failover(&block) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 21

def after_failover(&block)
  raise ArgumentError, "A block is required to set the after failover callback" unless block_given?
  @after_failover_cb = block
end

#before_failover(&block) ⇒ Object

Raises:

  • (ArgumentError)


16
17
18
19
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 16

def before_failover(&block)
  raise ArgumentError, "A block is required to set the before failover callback" unless block_given?
  @before_failover_cb = block
end

#do_after_failover(new_primary_conn_info) ⇒ Object

Upon successful failover



31
32
33
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 31

def do_after_failover(new_primary_conn_info)
  @after_failover_cb&.call(new_primary_conn_info)
end

#do_before_failoverObject



26
27
28
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 26

def do_before_failover
  @before_failover_cb&.call
end

#nameObject



4
5
6
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 4

def name
  "Config Handler"
end

#readObject

Raises:

  • (NotImplementedError)


8
9
10
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 8

def read
  raise NotImplementedError
end

#write(_conninfo) ⇒ Object

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/manageiq/postgres_ha_admin/config_handler.rb', line 12

def write(_conninfo)
  raise NotImplementedError
end