Class: SQLiteSweep::Config
- Inherits:
-
Data
- Object
- Data
- SQLiteSweep::Config
- Defined in:
- lib/sqlitesweep/config.rb
Overview
Immutable configuration for a sweep run. Built from CLI flags and passed to every component.
Uses Data.define for a frozen value object — once created, a Config cannot be modified.
Instance Attribute Summary collapse
-
#action ⇒ Object
readonly
Returns the value of attribute action.
-
#batch_size ⇒ Object
readonly
Returns the value of attribute batch_size.
-
#concurrency ⇒ Object
readonly
Returns the value of attribute concurrency.
-
#live ⇒ Object
readonly
Returns the value of attribute live.
-
#max_ssh ⇒ Object
readonly
Returns the value of attribute max_ssh.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#query_timeout ⇒ Object
readonly
Returns the value of attribute query_timeout.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
-
#ssh_timeout ⇒ Object
readonly
Returns the value of attribute ssh_timeout.
Instance Method Summary collapse
-
#initialize(query:, source:, action: :sum, concurrency: 8, max_ssh: 50, live: $stderr.tty?, batch_size: 4, ssh_timeout: 10, query_timeout: 30) ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize(query:, source:, action: :sum, concurrency: 8, max_ssh: 50, live: $stderr.tty?, batch_size: 4, ssh_timeout: 10, query_timeout: 30) ⇒ Config
Returns a new instance of Config.
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/sqlitesweep/config.rb', line 29 def initialize( query:, source:, action: :sum, concurrency: 8, max_ssh: 50, live: $stderr.tty?, batch_size: 4, ssh_timeout: 10, query_timeout: 30 ) action = action.to_sym action = :average if action == :avg unless %i[sum average list].include?(action) raise ConfigError, "Unknown action: #{action}. Must be sum, average/avg, or list" end super( query: query, action: action, source: source, concurrency: concurrency, max_ssh: max_ssh, live: live, batch_size: batch_size, ssh_timeout: ssh_timeout, query_timeout: query_timeout ) end |
Instance Attribute Details
#action ⇒ Object (readonly)
Returns the value of attribute action
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def action @action end |
#batch_size ⇒ Object (readonly)
Returns the value of attribute batch_size
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def batch_size @batch_size end |
#concurrency ⇒ Object (readonly)
Returns the value of attribute concurrency
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def concurrency @concurrency end |
#live ⇒ Object (readonly)
Returns the value of attribute live
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def live @live end |
#max_ssh ⇒ Object (readonly)
Returns the value of attribute max_ssh
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def max_ssh @max_ssh end |
#query ⇒ Object (readonly)
Returns the value of attribute query
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def query @query end |
#query_timeout ⇒ Object (readonly)
Returns the value of attribute query_timeout
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def query_timeout @query_timeout end |
#source ⇒ Object (readonly)
Returns the value of attribute source
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def source @source end |
#ssh_timeout ⇒ Object (readonly)
Returns the value of attribute ssh_timeout
18 19 20 |
# File 'lib/sqlitesweep/config.rb', line 18 def ssh_timeout @ssh_timeout end |