Class: PgBouncerHero::DatabaseController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- PgBouncerHero::DatabaseController
- Defined in:
- app/controllers/pg_bouncer_hero/database_controller.rb
Constant Summary collapse
- DATABASE_ADMIN_ACTIONS =
%i[pause_database reconnect_database wait_close_database resume_database].freeze
- MONITORING_ACTIONS =
%i[databases stats pools clients servers users conf state].freeze
Instance Method Summary collapse
- #clients ⇒ Object
- #conf ⇒ Object
- #databases ⇒ Object
- #pause_database ⇒ Object
- #pools ⇒ Object
- #reconnect_database ⇒ Object
- #reload ⇒ Object
- #resume ⇒ Object
- #resume_database ⇒ Object
- #servers ⇒ Object
- #shutdown ⇒ Object
- #state ⇒ Object
- #stats ⇒ Object
- #summary ⇒ Object
- #suspend ⇒ Object
- #users ⇒ Object
- #wait_close_database ⇒ Object
Instance Method Details
#clients ⇒ Object
37 38 39 40 41 42 43 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 37 def clients if @database.connection @clients = @database.clients else flash[:error] = "#{@database.name} does not look online." end end |
#conf ⇒ Object
61 62 63 64 65 66 67 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 61 def conf if @database.connection @conf = @database.conf else flash[:error] = "#{@database.name} does not look online." end end |
#databases ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 13 def databases if @database.connection @dbs = @database.databases else flash[:error] = "#{@database.name} does not look online." end end |
#pause_database ⇒ Object
89 90 91 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 89 def pause_database execute_database_admin_command(:pause, "paused") end |
#pools ⇒ Object
29 30 31 32 33 34 35 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 29 def pools if @database.connection @pools = @database.pools else flash[:error] = "#{@database.name} does not look online." end end |
#reconnect_database ⇒ Object
93 94 95 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 93 def reconnect_database execute_database_admin_command(:reconnect, "asked to reconnect released server connections") end |
#reload ⇒ Object
77 78 79 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 77 def reload execute_admin_command(:reload, "reloaded") end |
#resume ⇒ Object
85 86 87 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 85 def resume execute_admin_command(:resume, "resumed") end |
#resume_database ⇒ Object
101 102 103 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 101 def resume_database execute_database_admin_command(:resume, "resumed") end |
#servers ⇒ Object
45 46 47 48 49 50 51 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 45 def servers if @database.connection @servers = @database.servers else flash[:error] = "#{@database.name} does not look online." end end |
#shutdown ⇒ Object
105 106 107 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 105 def shutdown execute_admin_command(:shutdown, "asked to shut down after its clients disconnect", :wait_for_clients) end |
#state ⇒ Object
69 70 71 72 73 74 75 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 69 def state if @admin_state @state = @admin_state else flash[:error] = "#{@database.name} does not look online." end end |
#stats ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 21 def stats if @database.connection @stats = @database.stats else flash[:error] = "#{@database.name} does not look online." end end |
#summary ⇒ Object
10 11 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 10 def summary end |
#suspend ⇒ Object
81 82 83 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 81 def suspend execute_admin_command(:suspend, "suspended") end |
#users ⇒ Object
53 54 55 56 57 58 59 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 53 def users if @database.connection @users = @database.users else flash[:error] = "#{@database.name} does not look online." end end |
#wait_close_database ⇒ Object
97 98 99 |
# File 'app/controllers/pg_bouncer_hero/database_controller.rb', line 97 def wait_close_database execute_database_admin_command(:wait_close, "confirmed all marked server connections closed") end |