Class: DataStore::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/data_store/configuration.rb

Overview

Used to set up and modify settings for the data store.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

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.expand_path('../../../config/database.yml', __FILE__)
  @log_file                    = $stdout
  @log_level                   = Logger::ERROR
  @enable_logging              = true
  @frequency_tolerance         = 0.05
end

Instance Attribute Details

#compression_schemaObject

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_typeObject

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

#databaseObject

The database used for storing the data.



10
11
12
# File 'lib/data_store/configuration.rb', line 10

def database
  @database
end

#database_config_fileObject

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_loggingObject

Enable logging.

Default: true


42
43
44
# File 'lib/data_store/configuration.rb', line 42

def enable_logging
  @enable_logging
end

#frequencyObject

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_toleranceObject

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_fileObject

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_levelObject

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_datapointsObject

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

#prefixObject

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