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.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/data_store/configuration.rb', line 50

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 schema is the way avarages of the datapoints is calculated/

Default: [6,5,3,4,4,3]


14
15
16
# File 'lib/data_store/configuration.rb', line 14

def compression_schema
  @compression_schema
end

#data_typeObject

The data type in which the value is stored

Default: double


33
34
35
# File 'lib/data_store/configuration.rb', line 33

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



36
37
38
# File 'lib/data_store/configuration.rb', line 36

def database_config_file
  @database_config_file
end

#enable_loggingObject

Enable logging.

Default: true


40
41
42
# File 'lib/data_store/configuration.rb', line 40

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


19
20
21
# File 'lib/data_store/configuration.rb', line 19

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



25
26
27
# File 'lib/data_store/configuration.rb', line 25

def frequency_tolerance
  @frequency_tolerance
end

#log_fileObject

The location of the log file

Default $stdout


44
45
46
# File 'lib/data_store/configuration.rb', line 44

def log_file
  @log_file
end

#log_levelObject

The level of logging

Default: Logger::ERROR


48
49
50
# File 'lib/data_store/configuration.rb', line 48

def log_level
  @log_level
end

#maximum_datapointsObject

The maximum datapoints is the maximum number of datapoint within a given timeframe

Default: 800


29
30
31
# File 'lib/data_store/configuration.rb', line 29

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