Class: PartitionGardener::Configuration
- Inherits:
-
Object
- Object
- PartitionGardener::Configuration
- Defined in:
- lib/partition_gardener/configuration.rb
Instance Attribute Summary collapse
-
#advisory_lock_mode ⇒ Object
Returns the value of attribute advisory_lock_mode.
-
#analyze_after_rebalance ⇒ Object
Returns the value of attribute analyze_after_rebalance.
-
#connection_resolver ⇒ Object
Returns the value of attribute connection_resolver.
-
#continue_on_error ⇒ Object
Returns the value of attribute continue_on_error.
-
#current_run_metrics ⇒ Object
Returns the value of attribute current_run_metrics.
-
#incremental_rebalance ⇒ Object
Returns the value of attribute incremental_rebalance.
-
#notifier ⇒ Object
Returns the value of attribute notifier.
-
#retention_detach_concurrently ⇒ Object
Returns the value of attribute retention_detach_concurrently.
-
#run_record_enabled ⇒ Object
Returns the value of attribute run_record_enabled.
- #run_record_store ⇒ Object
-
#schema_name ⇒ Object
Returns the value of attribute schema_name.
-
#statement_timeout_wrapper ⇒ Object
Returns the value of attribute statement_timeout_wrapper.
-
#strict_maintenance_backend_validation ⇒ Object
Returns the value of attribute strict_maintenance_backend_validation.
-
#today_resolver ⇒ Object
Returns the value of attribute today_resolver.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #notify(message_or_error, context: {}) ⇒ Object
- #today ⇒ Object
- #with_statement_timeout(timeout, &block) ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/partition_gardener/configuration.rb', line 19 def initialize @notifier = ->(, context: {}) {} @connection_resolver = method(:default_connection_resolver) @statement_timeout_wrapper = ->(_timeout, &block) { block.call } @today_resolver = -> { Date.today } @schema_name = "public" @continue_on_error = true @advisory_lock_mode = :transaction @analyze_after_rebalance = false @incremental_rebalance = true @run_record_enabled = true @run_record_store = nil @retention_detach_concurrently = false @strict_maintenance_backend_validation = false @current_run_metrics = nil end |
Instance Attribute Details
#advisory_lock_mode ⇒ Object
Returns the value of attribute advisory_lock_mode.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def advisory_lock_mode @advisory_lock_mode end |
#analyze_after_rebalance ⇒ Object
Returns the value of attribute analyze_after_rebalance.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def analyze_after_rebalance @analyze_after_rebalance end |
#connection_resolver ⇒ Object
Returns the value of attribute connection_resolver.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def connection_resolver @connection_resolver end |
#continue_on_error ⇒ Object
Returns the value of attribute continue_on_error.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def continue_on_error @continue_on_error end |
#current_run_metrics ⇒ Object
Returns the value of attribute current_run_metrics.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def current_run_metrics @current_run_metrics end |
#incremental_rebalance ⇒ Object
Returns the value of attribute incremental_rebalance.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def incremental_rebalance @incremental_rebalance end |
#notifier ⇒ Object
Returns the value of attribute notifier.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def notifier @notifier end |
#retention_detach_concurrently ⇒ Object
Returns the value of attribute retention_detach_concurrently.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def retention_detach_concurrently @retention_detach_concurrently end |
#run_record_enabled ⇒ Object
Returns the value of attribute run_record_enabled.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def run_record_enabled @run_record_enabled end |
#run_record_store ⇒ Object
36 37 38 |
# File 'lib/partition_gardener/configuration.rb', line 36 def run_record_store @run_record_store ||= default_run_record_store end |
#schema_name ⇒ Object
Returns the value of attribute schema_name.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def schema_name @schema_name end |
#statement_timeout_wrapper ⇒ Object
Returns the value of attribute statement_timeout_wrapper.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def statement_timeout_wrapper @statement_timeout_wrapper end |
#strict_maintenance_backend_validation ⇒ Object
Returns the value of attribute strict_maintenance_backend_validation.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def strict_maintenance_backend_validation @strict_maintenance_backend_validation end |
#today_resolver ⇒ Object
Returns the value of attribute today_resolver.
3 4 5 |
# File 'lib/partition_gardener/configuration.rb', line 3 def today_resolver @today_resolver end |
Instance Method Details
#connection ⇒ Object
40 41 42 43 44 45 |
# File 'lib/partition_gardener/configuration.rb', line 40 def connection resolved = @connection_resolver.call raise ArgumentError, "PartitionGardener connection is not configured" unless resolved resolved end |
#notify(message_or_error, context: {}) ⇒ Object
47 48 49 |
# File 'lib/partition_gardener/configuration.rb', line 47 def notify(, context: {}) @notifier.call(, context: context) end |
#today ⇒ Object
55 56 57 |
# File 'lib/partition_gardener/configuration.rb', line 55 def today @today_resolver.call end |
#with_statement_timeout(timeout, &block) ⇒ Object
51 52 53 |
# File 'lib/partition_gardener/configuration.rb', line 51 def with_statement_timeout(timeout, &block) @statement_timeout_wrapper.call(timeout, &block) end |