Class: DataStore::Configuration
- Inherits:
-
Object
- Object
- DataStore::Configuration
- Defined in:
- lib/data_store/configuration.rb
Overview
Used to set up and modify settings for the data store.
Instance Attribute Summary collapse
-
#compression_schema ⇒ Object
The compression schema defines the compression of the data, i.e how the averages of the datapoints are calculated.
-
#data_type ⇒ Object
The data type in which the value is stored Default: double.
-
#database ⇒ Object
The database used for storing the data.
-
#database_config_file ⇒ Object
The location of the database.yml file.
-
#enable_logging ⇒ Object
Enable logging.
-
#frequency ⇒ Object
The frequency tells how often data entry is done.
-
#frequency_tolerance ⇒ Object
Tolerance of the frequency in which datapoints are added Default: 0.05 This means a 5% margin.
-
#log_file ⇒ Object
The location of the log file Default $stdout.
-
#log_level ⇒ Object
The level of logging Default: Logger::ERROR.
-
#maximum_datapoints ⇒ Object
The maximum datapoints is the maximum number of datapoint within a given timeframe Default: 800.
-
#prefix ⇒ Object
The prefix is used as a prefix for the database table name.
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/data_store/configuration.rb', line 52 def initialize @prefix = 'ds_' @database = :postgres @compression_schema = '[6,5,3,4,4,3]' @frequency = 10 @maximum_datapoints = 800 @data_type = :double @database_config_file = File.('../../../config/database.yml', __FILE__) @log_file = $stdout @log_level = Logger::ERROR @enable_logging = true @frequency_tolerance = 0.05 end |
Instance Attribute Details
#compression_schema ⇒ Object
The compression schema defines the compression of the data, i.e how the averages of the datapoints are calculated. Default: ‘[6,5,3,4,4,3]’ With the default settings: from every 6 datapoints an average value is calculated. From those calculated average values from every five values a new average value is created (The compression is now 6 * 5 = 30).
16 17 18 |
# File 'lib/data_store/configuration.rb', line 16 def compression_schema @compression_schema end |
#data_type ⇒ Object
The data type in which the value is stored
Default: double
35 36 37 |
# File 'lib/data_store/configuration.rb', line 35 def data_type @data_type end |
#database ⇒ Object
The database used for storing the data.
10 11 12 |
# File 'lib/data_store/configuration.rb', line 10 def database @database end |
#database_config_file ⇒ Object
The location of the database.yml file
38 39 40 |
# File 'lib/data_store/configuration.rb', line 38 def database_config_file @database_config_file end |
#enable_logging ⇒ Object
Enable logging.
Default: true
42 43 44 |
# File 'lib/data_store/configuration.rb', line 42 def enable_logging @enable_logging end |
#frequency ⇒ Object
The frequency tells how often data entry is done. A frequency of 10 means a data entry once every 10 seconds.
Default: 10 sec
21 22 23 |
# File 'lib/data_store/configuration.rb', line 21 def frequency @frequency end |
#frequency_tolerance ⇒ Object
Tolerance of the frequency in which datapoints are added
Default: 0.05
This means a 5% margin. So with a frequency of 10s, the next datapoint within 9.95 - 10.5 is considered the next datapoint
27 28 29 |
# File 'lib/data_store/configuration.rb', line 27 def frequency_tolerance @frequency_tolerance end |
#log_file ⇒ Object
The location of the log file
Default $stdout
46 47 48 |
# File 'lib/data_store/configuration.rb', line 46 def log_file @log_file end |
#log_level ⇒ Object
The level of logging
Default: Logger::ERROR
50 51 52 |
# File 'lib/data_store/configuration.rb', line 50 def log_level @log_level end |
#maximum_datapoints ⇒ Object
The maximum datapoints is the maximum number of datapoint within a given timeframe
Default: 800
31 32 33 |
# File 'lib/data_store/configuration.rb', line 31 def maximum_datapoints @maximum_datapoints end |
#prefix ⇒ Object
The prefix is used as a prefix for the database table name.
7 8 9 |
# File 'lib/data_store/configuration.rb', line 7 def prefix @prefix end |