Class: Readyset::Configuration
- Inherits:
-
Object
- Object
- Readyset::Configuration
- Defined in:
- lib/readyset/configuration.rb
Instance Attribute Summary collapse
-
#migration_path ⇒ Object
Returns the value of attribute migration_path.
-
#shard ⇒ Object
Returns the value of attribute shard.
Instance Method Summary collapse
- #failover ⇒ Object
- #hostname ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
8 9 10 11 |
# File 'lib/readyset/configuration.rb', line 8 def initialize @migration_path = File.join(Rails.root, 'db/readyset_caches.rb') @shard = :readyset end |
Instance Attribute Details
#migration_path ⇒ Object
Returns the value of attribute migration_path.
6 7 8 |
# File 'lib/readyset/configuration.rb', line 6 def migration_path @migration_path end |
#shard ⇒ Object
Returns the value of attribute shard.
6 7 8 |
# File 'lib/readyset/configuration.rb', line 6 def shard @shard end |
Instance Method Details
#failover ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/readyset/configuration.rb', line 13 def failover if @failover @failover else inner = ActiveSupport::OrderedOptions.new inner.enabled = false inner.healthcheck_interval = 5.seconds inner.error_window_period = 1.minute inner.error_window_size = 10 @failover = inner end end |
#hostname ⇒ Object
26 27 28 |
# File 'lib/readyset/configuration.rb', line 26 def hostname ActiveRecord::Base.configurations.configs_for(name: shard.to_s).configuration_hash[:host] end |